API Reference

Use the getTotalSize method to retrieve the total size of a directory.

try {
  const id = "directory_id_here"; // The ID of the directory to get the size of.

  const [data, error] = await sdk.directory.getTotalSize({
    id,
  });

  // Check for success
  if (error) {
    console.error("Failed to retrieve directory size: ", error);
  } else {
    console.log(data);
    console.log(`Total size of directory: ${data.totalSize} bytes`);
  }
} catch (error) {
  console.error("An unexpected error occurred:", error.message);
}

Params

  • id (string): The ID of the directory for which you want to retrieve the size.

Required API Key Permission

  • Read Directory