0

My aim to obtain the buffer of the image which is stored in the s3 bucket. I am using a npm package named request which does a simple http/https request to the url provided on the s3 bucket. When I am using the package and doing the https request on the image url provided to me by s3 bucket I am getting the following error

 events.js:85
  throw er; // Unhandled 'error' event
        ^
Error: spawn convert ENOENT
at exports._errnoException (util.js:746:11)
at Process.ChildProcess._handle.onexit (child_process.js:1053:32)
at child_process.js:1144:20
at process._tickDomainCallback (node.js:381:11)

I went through this question on stackOverflow but couldn't find the resolution for my problem. My Code is as follows:

request(url, function (err, response,res1) {
                if (err) {
                    //error Handling;
                } else {
                    buffer = res1;
                    //Some Logic
                }
            });

Can Somebody help me with issue?

Community
  • 1
  • 1
shubhamagiwal92
  • 1,362
  • 4
  • 25
  • 47
  • You're getting a binary response - you need to handle the .on('data') event. – brandonscript Oct 06 '15 at 04:33
  • Thanks Remus!!! I got to know that request has an options parameter where I had to set the encoding to null to get the buffer. – shubhamagiwal92 Oct 07 '15 at 02:20
  • Possible duplicate of [reading a binary file in javascript using browserify](http://stackoverflow.com/questions/17541845/reading-a-binary-file-in-javascript-using-browserify) – Paul Sweatte Jun 20 '16 at 18:55

0 Answers0