DEV Community

Anasooya
Anasooya

Posted on

File Modes in Nodejs

DAY 1 :

Hey folks,

This is my short tutorial on File Modes (write,append)

1)fs.writeSync(fd, buffer[, offset[, length[, position]]])
const fs=require('fs')
// 1.using writeFileSync
fs.writeFileSync('notes.txt','my name is ana')
Enter fullscreen mode Exit fullscreen mode

Alt Text

2)fs.appendFileSync(path, data[, options])
const fs=require('fs')
// //1.using writeFileSync
fs.appendFileSync('notes.txt',',I live in India')
Enter fullscreen mode Exit fullscreen mode

Alt Text

Will continue further in the next tutorial.

Top comments (0)