Write objects into file with Node.js

后端 未结 6 1694
滥情空心
滥情空心 2020-12-02 10:53

I\'ve searched all over stackoverflow / google for this, but can\'t seem to figure it out.

I\'m scraping social media links of a given URL page, and the function re

6条回答
  •  渐次进展
    2020-12-02 11:49

    Just incase anyone else stumbles across this, I use the fs-extra library in node and write javascript objects to a file like this:

    const fse = require('fs-extra');
    fse.outputJsonSync('path/to/output/file.json', objectToWriteToFile); 
    

提交回复
热议问题