What is File System module in Node.js ?
Nodejs is an open-source javascript runtime to run javascript outside of the browser. It is a popular choice for backend development. Like every other programming language Nodejs also provides us with the built-in libraries to interact with the system or machine. In Nodejs we call these libraries modules....
read more
Node.js fsPromises.mkdtemp() Method
The fsPromises.mkdtemp() method is an inbuilt method which creates a unique temporary directory and resolves the Promise with the created directory path....
read more
Node.js fs.filehandle.truncate() Method
The fs.filehandle.truncate() method is an inbuilt application programming interface of class fs.filehandle within File System module which is used to truncate the particular file object and only that much byte will be retained which passed as an integer in truncate() method....
read more
Node.js stats.mode Property from fs.Stats Class
The stats.mode property is an inbuilt application programming interface of the fs.Stats class which is used to get the file type and mode as bit-field....
read more
Node.js filehandle.appendFile() Method
The filehandle.appendFile() method is defined in the File System module of Node.js. The File System module is basically to interact with the hard disk of the user’s computer. The appendFile() method is used to asynchronously append new data in the existing file or if the file does not exist then the file is created first and after that given data is appended to it....
read more
Node.js fs.Dir.read() Method
The fs.Dir.read() method is an inbuilt application programming interface of class fs.Dir within File System module which is used to read each next directory (dirent) one by one asynchronously....
read more
Node.js fsPromises.chmod() Method
The fsPromises.chmod() method is used to change the permissions of a given path. These permissions can be specified using string constants or octal numbers that correspond to their respective file modes....
read more
Node.js stats.ino Property
The stats.ino property is an inbuilt application programming interface of the fs.Stats class is used to get the “Inode” number of the file specified by the file system....
read more
How to operate callback-based fs.lstat() method with promises in Node.js ?
The fs.lstat() method is defined in the File System module of Node.js. The File System module is basically to interact with the hard disk of the user’s computer. The lstat() method gives some information specific to files and folders using methods define on stats objects (data provided by lstat).The fs.lstat() method is based on callback. Using callback methods lead to a great chance of callback nesting or callback hell problems. Thus to avoid it, we almost always like to work with a promise-based method. Using some extra node.js methods we can operate a callback-based method in promise way.Syntax:...
read more
Node.js fs.filehandle.sync() Method
The fs.filehandle.sync() method is an inbuilt application programming interface of class fs.filehandle within File System module which is used to synchronize this file’s in-core state with the storage device.Syntax:...
read more
Node.js stats.isSymbolicLink() Method
The stats.isSymbolicLink() method is an inbuilt application programming interface of the fs.Stats class which is used to check whether fs.Stats object describes a symbolic link or not....
read more
Node.js fs.Dir.close() Method
The fs.Dir.close() method is an inbuilt application programming interface of class fs.Dir with in File System module which is used to close the directory’s underlying resource handle asynchronously....
read more