Need to see if your shared folder is taking up space on your dropbox 👨‍💻? Find out how to check here.

Forum Discussion

danthedev's avatar
danthedev
Explorer | Level 3
8 years ago

How to parse /upload endpoint's response when using pipes in node

Hello 

 

I am piping users request to /upload api endpoint. The file is saved properly, however I can't seem to handle server's response.

 

As you can see from the picture below, my (probably naive) approach ends up in unreadable sequence of characters. Am I missing something here? 

 

Thanks

 

4 Replies

  • Greg-DB's avatar
    Greg-DB
    Icon for Dropbox Community Moderator rankDropbox Community Moderator
    8 years ago
    We can't offer much help with Node itself or using pipes in Node in particular, but for reference, the Dropbox API /2/files/upload endpoint returns the uploaded file metadata as JSON in the HTTPS response body. Exactly what you do with that and how you handle it is up to you, so you may be better helped by asking for general Node help for handling data like this in a Node forum or on StackOverflow.
  • thelwang's avatar
    thelwang
    Helpful | Level 7
    8 years ago

    maybe the reply from DropBox is gzip or deflate compressed? look for the "Content-Encoding" header in the REQUEST youre making.  Though not really sure what is up with node pipes maybe its so low level you have to do your own http parsing or something.  But in general read the request and response headers to help figure out whats going on.

     

    if thats right then just stop the "Accept-Encoding" header from sending to dropbox when you make the request.  You must be sending that already to get a compressed response. Avoiding sending thatll make the reply normal and not globelgook.

  • danthedev's avatar
    danthedev
    Explorer | Level 3
    8 years ago

    Thanks for the answer, if nothing helps I will resort to SO 

About Dropbox API Support & Feedback

Node avatar for Dropbox API Support & Feedback
Find help with the Dropbox API from other developers.

The Dropbox Community team is active from Monday to Friday. We try to respond to you as soon as we can, usually within 2 hours.

If you need more help you can view your support options (expected response time for an email or ticket is 24 hours), or contact us on X, Facebook or Instagram.

For more info on available support options for your Dropbox plan, see this article.

If you found the answer to your question in this Community thread, please 'like' the post to say thanks and to let us know it was useful!