The fs
module provides an API for interacting with the file system in a manner closely modeled around standard POSIX functions.
Goal of this inerface is to be compatible with Node.js File System API
Compatibility objective : 80%
To use this module:
const fs = require('fs');
All file system operations have synchronous and asynchronous forms.
Compatibility : broken
Open, read and return text content of a file. It will throw an exception if it fails.
<string>
Path of the file to read fromlet data = fs.readFile('/etc/passwd');
console.info('Data : {0}', data);
Synchronous readdir(3).
<string>
Path of the directory<object>
OptionsSynchronous stat(2). Returns an instance of fs.Stats.
A fs.Stats
object provides information about a file.
Returns true
if the fs.Stats object describes a file system directory.
Returns true
if the fs.Stats object describes a regular file.
Returns true
if the fs.Stats object describes a symbolic link.
<number>
The numeric identifier of the device containing the file.<number>
The file system specific “Inode” number for the file.<number>
A bit-field describing the file type and mode.<number>
The number of hard-links that exist for the file.<number>
The numeric user identifier of the user that owns the file (POSIX).<number>
The size of the file in bytes.<number>
The number of blocks allocated for this file.