box-node-sdk

Downloads

Downloads module is used to download files from Box.

Download a File

To get the entire contents of the file as ArrayBuffer, call downloadFile method. This method returns a ArrayBuffer object which contains the file content.

const fs = require('fs');

const fileContent = await client.downloads.downloadFile('123456789');
const fileWriteStream = fs.createWriteStream('file.pdf');
fileContent.pipe(fileWriteStream);

Get download URL

Get a URL to download a file

This operation is performed by calling function getDownloadFileUrl.

await client.downloads.getDownloadFileUrl(uploadedFile.id);

Arguments

Returns

This function returns a value of type string.