4

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

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 file.write. Is the file being stored in the file object?

I want to be able to use filepickers rest API to upload the image like so:

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

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

Is this possible? Thanks!

Nearpoint
  • 7,202
  • 13
  • 46
  • 74

1 Answers1

1

I'm not sure about filepicker, but here is an example that streams the file to S3.

https://github.com/brenden/node-webshot/issues/90

imns
  • 4,996
  • 11
  • 57
  • 80