download

Download a file.

Parameters

fileId: string

The identifier of the file to download.

chunkSize?: number

Size of each download chunk in bytes.

offset?: number

Download offset in bytes.

signal?: AbortSignal

Download abort signal.

Result

AsyncGenerator<Uint8Array, void, unknown>

A generator yielding the contents of the file.

Syntax

// Required parameters only.
await client.download(fileId);

// Required parameters + optional parameters.
// Any of the optional parameters can be omitted.
await client.download(fileId, { chunkSize, offset, signal });

Examples

for await (const chunk of client.download(fileId, { chunkSize: 256 * 1024 })) {
  await outFile.write(chunk);
}