Node.js includes fs module to access physical file system. The fs module is responsible for all the asynchronous or synchronous file I/O operations.
Method Description
1. fs.readFile(fileName [,options], callback) {Reads existing file}.
2. fs.writeFile(filename, data[, options], callback) {Writes to the file. If file exists then overwrite the content otherwise creates new file}.
3. fs.open(path, flags[, mode], callback) {Opens file for reading or writing.
4. fs.rename(oldPath, newPath, callback) Renames an existing file.
5. fs.chown(path, uid, gid, callback) Asynchronous chown.
6. fs.stat(path, callback) Returns fs.stat object which includes important file statistics.
7. fs.link(srcpath, dstpath, callback) Links file asynchronously.
8. fs.symlink(destination, path[, type], callback) Symlink asynchronously.
9. fs.rmdir(path, callback) Renames an existing directory.
10. fs.mkdir(path[, mode], callback) Creates a new directory.
11. fs.readdir(path, callback) Reads the content of the specified directory.
12. fs.utimes(path, atime, mtime, callback) Changes the timestamp of the file.
13. fs.exists(path, callback) Determines whether the specified file exists or not.
14. fs.access(path[, mode], callback) Tests a user's permissions for the specified file.
15. fs.appendFile(file, data[, options], callback) Appends new content to the existing file.
Source File Link:- github.com/imravikumar150k/Node.JS/blob/master/fs.…
Please like and subscribe us.
コメント