a guest Jul 19th, 2018 52 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. request(options, function (error, response, body) {
  2.   if (error) throw new Error(error);
  3.   fs.writeFile('./file1.pdf', body, 'binary', function (err) {
  4.     if (err) throw err;
  5.     console.log('Saved!');
  6.   });
  7.   console.log(body);
  8.   }).pipe(fs.createWriteStream('./file2.pdf'));
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand