How can I transfer an image from node -webshot to filepicker

Node webshot is used to take a snapshot of an external website. node webshot API:

var webshot = require('webshot');
var fs      = require('fs');

webshot('google.com', function(err, renderStream) {
  var file = fs.createWriteStream('google.png', {encoding: 'binary'});

  renderStream.on('data', function(data) {
    file.write(data.toString('binary'), 'binary');
  });
});

I am confused about the .write file. Is the file saved in the file object?

I want to be able to use the API to describe files in order to upload an image as follows:

curl -X POST -F fileUpload=@filename.txt https://www.filepicker.io/api/store/S3?key=MY_API_KEY

But I am confused about how to integrate webshot with renderStream with a file pixel without first saving the file to disk. When the file is in memory, I want to immediately send it to filepicker, and then get rid of it from memory.

Is it possible? Thank you

+4
source share
1 answer

Source: https://habr.com/ru/post/1548288/


All Articles