API Reference

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

  try {
    const id = "directory_id_here"; // The ID of the directory to be zipped and downloaded.
    const name = "downloaded_directory"; // 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 directory as a ZIP file:", error);
    } else {
      console.log(`Downloaded ZIP file: ${zipFileName}.zip`);
    }
  } catch (error) {
    console.error("An unexpected error occurred:", error.message);
  }

Params

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

Required API Key Permission

  • Read Directory