Welcome to the new Box Support website. Check out all the details here on what’s changed.

Comments

4 comments

  • Murtza

     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.

     

    0
    Comment actions Permalink
  • loganweilenman

    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?

    0
    Comment actions Permalink
  • Murtza

     

     I incorrectly noted in my response above that Range was a parameter. Range is a header. There was an error in our documentation that we updated this past week. Sorry for the confusion.

    0
    Comment actions Permalink
  • loganweilenman

    Thanks 

     

    I actually worked with Box Support and the Documentation team to test this out and come to the conclusion that Range/BoxAPI were headers not query strings. I believe the documentation was just updated to indicate this. Thanks for your help.

    0
    Comment actions Permalink

Please sign in to leave a comment.