File System (fs) Module of Node.js

July 6, 2019

This series will in the future contain examples and uses cases of all functions of the file system (fs) module of Node.js. For all methods there is always a synchronous / blocking and one or two asynchronous / non-blocking options.

The asynchronous methods take a callback parameter, which is called whenever the method was executed. It will contain an error argument, that will be undefined if the execution was successful and the error otherwise.

The fs.promises API provides an alternative set of asynchronous file system methods that return Promise objects rather than using callbacks. The API is accessible via require(‘fs’).promises.

Interested in more content like this? Subscribe to my weekly Newsletter!