fs.truncate()

fs.truncate(path, len, callback) Asynchronous truncate(2). No arguments other than a possible exception are given to the completion callback. A file descriptor can also be passed as the first argument. In this case, fs.ftruncate() is called.

fs.truncateSync()

fs.truncateSync(path, len) Synchronous truncate(2). Returns undefined.

fs.statSync()

fs.statSync(path) Synchronous stat(2). Returns an instance of fs.Stats.

fs.rmdirSync()

fs.rmdirSync(path) Synchronous rmdir(2). Returns undefined.

fs.stat()

fs.stat(path, callback) Asynchronous stat(2). The callback gets two arguments (err, stats) where stats is a fs.Stats object. See the fs.Stats section for more information.

fs.Stats

Class: fs.Stats Objects returned from fs.stat(), fs.lstat() and fs.fstat() and their synchronous counterparts are of this type. stats.isFile() stats.isDirectory() stats.isBlockDevice() stats.isCharacterDevice() stats.isSymbolicLink() (only valid with fs.lstat()) stats.isFIFO() stats.isSocket() For a regular file util.inspect(stats) would return a string very similar to this: { dev: 2114, ino: 48064969, mode: 33188, nlink: 1, uid: 85, gid: 100, rdev: 0, size: 527, blksize:

fs.rmdir()

fs.rmdir(path, callback) Asynchronous rmdir(2). No arguments other than a possible exception are given to the completion callback.

fs.readSync()

fs.readSync(fd, buffer, offset, length, position) Synchronous version of fs.read(). Returns the number of bytesRead.

fs.realpath()

fs.realpath(path[, cache], callback) Asynchronous realpath(2). The callback gets two arguments (err, resolvedPath). May use process.cwd to resolve relative paths. cache is an object literal of mapped paths that can be used to force a specific path resolution or avoid additional fs.stat calls for known real paths. Example: var cache = {'/etc':'/private/etc'}; fs.realpath('/etc/passwd', cache, (err, resolvedPath) => { if (err) throw err; console.log(resolvedPath); });

fs.rename()

fs.rename(oldPath, newPath, callback) Asynchronous rename(2). No arguments other than a possible exception are given to the completion callback.