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

Box Node SDK - upload issue with non-file read stream

Answered
New post

Comments

3 comments

  • mwiller

     In order to construct the API request, the internal networking library the SDK uses requires the stream to supply the amount of data it will provide (measured in bytes).  The allows the library to correctly calculate the `Content-Length` header for the request.  You can read more about this in a previously-reported issue on GitHub, which includes a helpful workaround for custom streams: https://github.com/box/box-node-sdk/issues/143

    0
    Comment actions Permalink
  • stephencweiss

     can you provide any guidance on _how_ you might indicate size?

     

    For example, I have 

     

    await client.files
    .uploadFile(FOLDER_ID, fileName, fileToUpload, {size})

     

    where size is the `size` in bytes of the `fileToUpload`
     
    I've looked at the API docs (https://developer.box.com/reference/post-files-content) and don't see anything there. 
     
    Thanks!
    0
    Comment actions Permalink
  • stephencweiss

    Update -- you can't: https://github.com/box/box-node-sdk/issues/144

     

    size is only available on the Chunked Upload 

    0
    Comment actions Permalink

Please sign in to leave a comment.