Update a file
client.files.update(stringfileID, FileUpdateParams { tags, xProjectID } params, RequestOptionsoptions?): SGPFile { id, created_at, created_by, 7 more }
PATCH/v5/files/{file_id}
Update a file’s mutable metadata by id.
Only the file’s tags can be modified; filename, content, size, and other
attributes are immutable through this endpoint. The supplied tags replace the
file’s existing tags. Returns the updated file metadata.
Update a file
import SGPClient from 'scale-gp';
const client = new SGPClient({
accountID: 'My Account ID',
apiKey: process.env['SGP_API_KEY'], // This is the default and can be omitted
});
const sgpFile = await client.files.update('file_id');
console.log(sgpFile.id);{
"id": "id",
"created_at": "2019-12-27T18:11:19.117Z",
"created_by": {
"id": "id",
"type": "user",
"object": "identity"
},
"filename": "filename",
"md5_checksum": "md5_checksum",
"mime_type": "mime_type",
"size": 0,
"duration_seconds": 0,
"object": "file",
"tags": {
"foo": "bar"
}
}Returns Examples
{
"id": "id",
"created_at": "2019-12-27T18:11:19.117Z",
"created_by": {
"id": "id",
"type": "user",
"object": "identity"
},
"filename": "filename",
"md5_checksum": "md5_checksum",
"mime_type": "mime_type",
"size": 0,
"duration_seconds": 0,
"object": "file",
"tags": {
"foo": "bar"
}
}