Confused about node.js file system

Viewed 5336

I used write file with nodejs in two steps:

1.First judge if the file is exist or not,use fs.exists function;

2.Then use fs.writeFile to write file directly;

But now I have notice there have more functions used for write file, like fs.open or fs.close, should I use these for open or close file while writing?

Besides, I noticed there have fs.createReadStream and fs.createWriteStream function , what's the differences between them and fs.writeFile and fs.readFile?

1 Answers
Related