Box Node SDK - files.getReadStream(fileID, qs, callback)
AnsweredIs there any documentation on what "qs" getReadStream supports?
-
The qs parameter lets you pass in any of the optional parameters for the Download File endpoint including "Range", "version", and "BoxApi".
The "Range" parameter lets you query a specific range of a file in bytes. The "version" parameter lets you download a specific version of a file. The "BoxApi" parameter lets you specify a shared link to a file, which lets you download a file that you might not be collaborated with in your account.
-
Thanks for the response . Using the example provided in the SDK, I'm calling it via:
var opts = {
"Range":"bytes=0-500000"
};
client.files.getReadStream('12345', opts, function(error, stream) { if (error) { // handle error } // write the file to disk var output = fs.createWriteStream('foo.jpg'); stream.pipe(output); });The file on Box is 1.1MB, and the output file 'foo.jpg' is also 1.1MB, which is not what I would expect given a truncated Range. Are the opts formatted properly, or am I missing something else?
Please sign in to leave a comment.
Comments
4 comments