const url2png = require('url2png')('API_KEY', 'PRIVATE_KEY'); const fs = require('fs'); app.get('/screenshot', (req, res) => { url2png.readURL(req.query.url, {}).pipe(fs.createWriteStream('screenshot.png')); res.json({success: true}) });