Function |
Async methods |
Synchronization method |
Open File |
Fs.open (Path,flags, [mode], [Callback (Err, FD)]) |
Fs.opensync (path, flags, [mode]) |
Close File |
Fs.close (FD, [Callback (ERR)]) |
Fs.closesync (FD) |
Read file (file descriptor |
) Fs.read (Fd,buffer,offset,length,position, [Callback (Err, bytesread, buffer)]) |
Fs.readsync (fd, buffer, offset, length, position) |
Write file (file descriptor) |
Fs.write (Fd,buffer,offset,length,position, [Callback (Err, Byteswritten, buffer)]) |
Fs.writesync (fd, buffer, offset, length, position) |
Read File contents |
Fs.readfile (Filename,[encoding],[callback (err, data)]) |
Fs.readfilesync (filename, [encoding]) |
Write file contents |
Fs.writefile (filename, data,[encoding], [Callback (ERR)]) |
Fs.writefilesync (filename, data, [encoding]) |
Deleting Files |
Fs.unlink (Path, [Callback (ERR)]) |
Fs.unlinksync (PATH) |
Create a directory |
Fs.mkdir (path, [mode], [Callback (ERR)]) |
Fs.mkdirsync (path, [mode]) |
Delete directory |
Fs.rmdir (Path, [Callback (ERR)]) |
Fs.rmdirsync (PATH) |
Read Directory |
Fs.readdir (Path, [Callback (Err, files)]) |
Fs.readdirsync (PATH) |
Get the real path |
Fs.realpath (Path, [Callback (Err, Resolvedpath)]) |
Fs.realpathsync (PATH) |
renamed |
Fs.rename (path1, path2, [Callback (ERR)]) |
Fs.renamesync (path1, path2) |
truncate |
Fs.truncate (FD, Len, [Callback (ERR)]) Fs.truncatesync (FD, Len) |
|
Change Ownership |
Fs.chown (path, UID, GID, [Callback (ERR)]) |
Fs.chownsync (path, UID, GID) |
Change ownership (file descriptor) |
Fs.fchown (FD, UID, GID, [Callback (ERR)]) |
Fs.fchownsync (FD, UID, GID) |
Change ownership (do not parse symbolic links) |
Fs.lchown (path, UID, GID, [Callback (ERR)]) |
Fs.lchownsync (path, UID, GID) |
Change permissions |
Fs.chmod (path, mode, [Callback (ERR)]) |
Fs.chmodsync (path, mode) |
Change permissions (file descriptors) |
Fs.fchmod (fd, Mode, [Callback (ERR)]) |
Fs.fchmodsync (FD, mode) |
Change permissions (do not parse symbolic links) |
Fs.lchmod (path, mode, [Callback (ERR)]) |
Fs.lchmodsync (path, mode) |
Get file Information |
Fs.stat (Path, [Callback (err, stats)]) |
Fs.statsync (PATH) |
Get file information (file descriptor) |
Fs.fstat (FD, [Callback (err, stats)]) |
Fs.fstatsync (FD) |
Get file information (do not parse symbolic links) |
Fs.lstat (Path, [Callback (err, stats)]) |
Fs.lstatsync (PATH) |
Create a hard link |
Fs.link (Srcpath, Dstpath, [Callback (ERR)]) |
Fs.linksync (Srcpath, Dstpath) |
Creating Symbolic Links |
Fs.symlink (linkdata, path, [type], [Callback (ERR)]) |
Fs.symlinksync (linkdata, path, [type]) |
Read Link |
Fs.readlink (Path, [Callback (Err, linkstring)]) |
Fs.readlinksync (PATH) |
Modify File timestamp |
Fs.utimes (Path, Atime, Mtime, [Callback (ERR)]) |
Fs.utimessync (Path, atime, Mtime) |
Modify file timestamp (file descriptor) |
Fs.futimes (FD, Atime, Mtime, [Callback (ERR)]) |
Fs.futimessync (FD, Atime, Mtime) |
Synchronizing disk caches |
Fs.fsync (FD, [Callback (ERR)]) |
Fs.fsyncsync (FD) |