Use the update method to update information about a file

try {
  const fileId = 'file_id_here' // The ID of the file to update.
  const newName = 'new_file_name.txt' // The new name for the file (optional).
  const additionalClasses = ['class1', 'class2'] // Additional storage classes (optional).
  const removalClasses = ['class3', 'class4'] // Storage classes to remove (optional).
  const addLabels = ['label1', 'label2'] // Additional labels (optional).
  const removeLabels = ['label3', 'label4'] // labels to remove (optional).

  await sdk.file.update(
    fileId,
    newName,
    additionalClasses,
    removalClasses,
    addLabels,
    removeLabels
  )
  console.log('File information updated successfully')
} catch (error) {
  console.error(error.message)
}

Params

  • fileId (string): The ID of the file you want to rename.
  • newName (string, optional): The new name for the file.
  • addStorageClasses (string[], optional): An array of additional - storage classes.
  • removeStorageClasses (string[], optional): An array of storage classes to remove.
  • addLabels (string[], optional): An array of additional labels.
  • removeLabels (string[], optional): An array of labels to remove.

Required API Key Permission

  • Upload File or Delete File