What Is the Node.js fs (File System) Module?
The built-in Node.js file system module helps us store, access, and manage data on our operating system. Commonly used features of the fs
module include fs.readFile
to read data from a file, fs.writeFile
to write data to a file and replace the file if it already exists, fs.watchFile
to get notified of changes, and fs.appendFile
to append data to a file. The fs
core module is available in every Node.js project without having to install it.
By the end of this tutorial, you should be able to:
- Understand common uses for the Node file system module
- Learn about relative file paths when using the
fs
module - Asynchronous vs synchronous
fs
methods in Node - Have a good overview of the new promise-based version of the
fs
module - Understand when we can’t rely on the Node
fs
module
Sign in with your Osio Labs account
to gain instant access to our entire library.