daily pastebin goal
45%
SHARE
TWEET

Untitled

a guest Jan 19th, 2019 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. fs = require('fs');
  2.  
  3. logToFile = function(fileName, objectToLog) {
  4.  
  5.   jsonText = JSON.stringify(objectToLog, null, 't');
  6.   fs.writeFileSync(fileName, jsonText, 'utf8');      
  7.  
  8. }
  9.  
  10. sampleData = { name: 'Batman', city: 'Gotham' };
  11. logToFile('log.txt', sampleData);
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
 
Top