Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

writing to file in node js


const fs = require('fs')

const content = 'Some content!'

try {
  fs.writeFileSync('/Users/joe/test.txt', content)
  //file written successfully
} catch (err) {
  console.error(err)
}
Source by nodejs.dev #
 
PREVIOUS NEXT
Tagged: #writing #file #node #js
ADD COMMENT
Topic
Name
5+8 =