Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

node write text to file

JS
copy
const fs = require('fs')

const content = 'Some content!'

fs.writeFile('/Users/joe/test.txt', content, err => {
  if (err) {
    console.error(err)
    return
  }
  //file written successfully
})
Source by nodejs.dev #
 
PREVIOUS NEXT
Tagged: #node #write #text #file
ADD COMMENT
Topic
Name
1+2 =