node.js - I'm using fs.writeFileSync but the file doesn't appear on the disk and there is no error either -


a similar question asked , solution said use try, catch method ,i've tried file still not written , no error logged console.

i've tried changing directory , running powershell administrator verified code possible errors multiple sources nothing seems .

this code i've written.

const fs = require('fs');  let originalnote = {    title : 'some title',    body : 'some body' } //converting object json string  let originalnotestring = json.stringify(originalnote);  //writing json string 'notes.json' file try{    fs.writefilesync = ('file.json', originalnotestring); } catch(err){    console.log(err); } 

you need function call not assignment

fs.writefilesync('file.json', originalnotestring); 

Comments

Popular posts from this blog

PHP and MySQL WP -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

go - golang pprof for c library code -