Node.js fs.fsyncSync() Method Last Updated : 07 Oct, 2021 Comments Improve Suggest changes Like Article Like Report In this article, we will be learning about fsyncSync() method in NodeJS. Before diving deep into the topic, let's have a brief idea about what a fsync() method is. Node.js provides us with a 'fs' module that helps us with both synchronous and asynchronous forms. An asynchronous form has a callback as the last argument whereas in case of synchronous, it only consists of the file descriptor. A fsync() function does not return any value but helps to get the file descriptor in a synchronous way. A fsyncSync() method is just the synchronized form of fsync(). It helps to synchronize the disc cache. Syntax: fs.fsyncSync(fd) fd refers to the File Descriptor and its return value is undefined. Parameter: File Descriptor. Return Type: Undefined. File descriptor is a number that uniquely identifies an open file in a computer. It provides an entry to the global file table that provides us with the location of that entry. Example : if the file descriptor is 3, it means that in the global file table it is saved as a read/write operation with offset : 12. At first, we need to install 'fs' and 'express' module in our NodeJS project. npm install fs express --save Create a file 'example.txt' inside your node.js project so that we can use any kind of operation for that file. After that write the necessary javascript code for our project. example.txt [tabbyending] node app.jsOUTPUT Comment More infoAdvertise with us Next Article Node.js fs.fsyncSync() Method D dassohom5 Follow Improve Article Tags : Technical Scripter Web Technologies Node.js Technical Scripter 2020 Node.js-Methods +1 More Similar Reads Node.js fs.fsync() Method In Node, the 'fs' module provides an API for interacting with the file system in a manner closely modeled around standard Portable Operating System Interface (POSIX) functions. It has both synchronous and asynchronous forms. The asynchronous form always takes a completion callback as its last argume 2 min read Node.js fs.fstatSync() Method The fs.fstatSync() method is used to synchronously return information about the given file descriptor. The fs.Stat object returns several fields and methods to get more details about the file. Syntax: fstatSync( fd, options ) Parameters: This method accept two parameters as mentioned above and descr 3 min read Node.js fs.ftruncateSync() Method The fs.ftruncateSync() method is used to synchronously change the size of the file i.e. either increase or decrease the file size. It changes the length of the file at the path by len bytes. If len is shorter than the fileâs current length, the file is truncated to that length. If it is greater than 2 min read Node.js fs.futimesSync() Method The fs.futimesSync() method is used to synchronously change the modification and access timestamps of given file descriptor. The timestamps can be specified using a number, string, or Date object. An error would be thrown if the timestamp cannot be converted to a proper number, or is NaN, Infinity o 3 min read Node.js fs.fdatasyncSync() Method The fs(File System) module enables interacting with the file system in a way modeled on standard POSIX functions, which means we can perform I/O operations with our Computer's file System. Like reading data from a file, writing data to a file, etc. All the file system operations have synchronous and 2 min read Node.js fs.fstat() Method The fs.fstat() method is used to return information about the given file descriptor. The fs.Stat object returned has several fields and methods to get more details about the file. Syntax: fs.fstat( fd, options, callback ) Parameters: This method accepts three parameters as mentioned above and descri 3 min read Node.js fs.linksync() Method The fs.linkSync() method is used to synchronously create a hard link to the specified path. The hard link created would still point to the same file even if the file is renamed. The hard links also have the actual file contents of the linked file. Syntax: fs.linkSync( existingPath, newPath ) Paramet 2 min read Node.js fs.fdatasync() Method The fs module provides an API for interacting with the file-system in a manner closely modeled around standard POSIX functions. All the file system operations have synchronous and asynchronous forms and mostly the asynchronous form takes a completion callback as its last argument. The fs.fdatasync() 2 min read Node.js fs.closeSync() Method The fs.closeSync() method is used to synchronously close the given file descriptor thereby clearing the file that is associated with it. It allows the file descriptor to be reused for other files. Calling fs.closeSync() on a file descriptor while some other operation is being performed on it may lea 2 min read Node.js fs.ftruncate() Method The fs.ftruncate() method is used to change the size of the file i.e. either increase or decrease the file size. It changes the length of the file at the path by len bytes. If len is shorter than the fileâs current length, the file is truncated to that length. If it is greater than the file length, 2 min read Like