Use the download method to download the contents of a drive as a compressed ZIP archive.

try {
  const driveId = 'drive_id_here' // The ID of the drive to be zipped and downloaded.
  const zipFileName = 'downloaded_drive' // The name of the downloaded ZIP file.
  const result = await sdk.directory.download(
    driveId,
    zipFileName
  )
  if (result.success) {
    console.log(`Downloaded ZIP file: ${zipFileName}.zip`)
  } else {
    console.error('Failed to download the drive as a ZIP file.')
  }
} catch (error) {
  console.error(error.message)
}

Params

  • driveId - The ID of the drive to be zipped and downloaded.
  • zipFileName - The name of the downloaded ZIP file (excluding the ".zip" extension).

Required API Key Permission

  • Read Directory