Im using the Knox S3 plugin in an ExpressJS web application to display an image uploaded to Amazon S3. When displaying an image, I sometimes get an error below. I have no idea about the error. What caused the error?
events.js:72 throw er; // Unhandled 'error' event ^ Error: read ECONNRESET at errnoException (net.js:884:11) at TCP.onread (net.js:539:19)
Here's how I make an image with Amazon S3:
var data = ''; client.get(url).on('response', function(s3res) { s3res.setEncoding('binary'); s3res.on('data', function(chunk){ data += chunk; }); s3res.on('end', function() { res.contentType('image/jpg'); res.write(data, encoding='binary'); res.end(); }); }).end();
source share