The getUrl method retrieves a temporary URL for downloading an encrypted file. It allows you to specify a password for decryption, track download progress, and initiate the download using the obtained URL.

try {
  const result = await sdk.file.getURL({
    id: 'file_id_here', // The ID of the file to retrieve.
    password: 'file_password_here', // The password to decrypt the file.
    signal: abortSignal, // Optional: Pass an abort signal to cancel the operation.
    setProgress: (progress) => {
      console.log(`Download Progress: ${progress}%`);
    },
  });
} catch (error) {
  console.error(error.message);
}

Params

  • id (string): The ID of the file.
  • password (string, optional): An optional password to access the file.
  • signal (optional): An abort signal to cancel the operation.
  • setProgress (optional): A callback function to track the download progress.