Use the download
method to download the contents of a drive as a compressed ZIP archive.
try {
const id = 'drive_id_here' // The ID of the drive to be zipped and downloaded.
const name = 'downloaded_drive' // The name of the downloaded ZIP file.
const [data, error] = await sdk.directory.download({
id,
name
})
// Check for success
if (error) {
console.error('Failed to download the drive as a ZIP file.')
} else {
console.log(`Downloaded ZIP file: ${zipFileName}.zip`)
}
} catch (error) {
console.error(error.message)
}
Params
id
- The ID of the drive to be zipped and downloaded.name
- The name of the downloaded ZIP file (excluding the ".zip" extension).
Required API Key Permission
Read Directory