# Files

When making changes to existing files, the file may be a string representing the file ID or a File object.

# Upload File

Upload a File (opens new window).

Returns a File item.

const media_item = await media.upload(file)

# Upload with options

Specify options such as resource name, disk, etc.

const options = {}
const media_item = await media.upload(file, options, (progress) => {
  console.log(`Uploaded ${progress}%`)
})

# Update File

Returns an updated File item.

See input options.

const media_item = await media.update(file, input)

# Move File

The location string may be the destination folder ID or a path.

const media_item = await media.move(file, location)

Returns a DownloadableLinkData item.

The options argument is optional.

const options = {}
const data = await media.downloadableLink(file, options)

# Share File

Returns a SharedContent item.

The options argument is optional.

const options = {}
const data = await media.share(file, options)

# Delete File

The options argument is optional.

const options = {}
const media_item = await media.delete(file, options)