SyNode file-system routines. We try to implement here the same interface as in NodeJS fs
var fs = require('fs');
var content = fs.readFileSync('c:\\a.txt', 'utf-8);
Members
# ReadStream static
Fake class for nodeJS compatibility
Methods
# appendFileSync (fileName: String, data: ArrayBuffer | Object | String, optionsopt: Object) static
Append data to a file, creating the file if it not yet exists Actually implement {UBWriter#write}
Arguments:
fileName
: StringFull absolute file path
data
: ArrayBuffer| Object| StringData to write.
Object
are stringified before writeoptions
: Objectencoding
: StringEncode data to
encoding
before write. Default toutf-8
in case data is String orbin
in case data is ArrayBuffer. Possible values: "utf-8"|"ucs2"|"bin"|"base64"|"base64toBin".base64toBin
applicable only if data is Buffer alike
# existsSync (path) → Boolean static
Check path
exists (can be file, folder or symlync)
Arguments:
path
:
# isDir (path) → Boolean static
Check specified path is folder (or symlynk to folder)
Arguments:
path
:
# isFile (path) → Boolean static
Check specified path is file (or symlynk to file)
Arguments:
path
:
# loadFile (fileName: String, forceUFT8opt: Boolean) → String static
Reads the entire contents of a TEXT file. If BOM found - decode text file to string using BOM If BOM not found - use forceUFT8 parameter.
# mkdirSync (path: String, modeopt: Number) static
Create all missing folders in the given path. Only absolute path supported. Throw error in case of fail
# realpathSync () static
Synchronous realpath(3). Returns the resolved path (resolve symlinks, junctions on Windows, /../)
# renameSync (oldPath: String, newPath: String) static
Move (rename) file.
# rmdirSync (path: String) static
Delete non-empty directory. See removeDir for details
Arguments:
path
: Stringpath to remove
# writeFileSync (fileName: String, data: ArrayBuffer | Object | String, optionsopt: Object) static
Write to file Actually implements UBWriter#write
Arguments:
fileName
: StringFull absolute file path
data
: ArrayBuffer| Object| StringData to write. If Object - it stringify before write
options
: Objectencoding
: StringEncode data to
encoding
before write. Default toutf-8
in case data is String orbin
in case data is ArrayBuffer. One of "utf-8"|"ucs2"|"bin"|"base64"|"base64toBin".base64toBin
applicable only if data is Buffer alike
# readdirSync (path: String) → Array.<String> inner
Read file names from directory (include folder names). Return array of file names. In case directory not exists - throw error
Arguments:
path
: String
# readFileSync (fileName: String, optionsopt: Object) → String | ArrayBuffer inner
Reads the entire contents of a file. If options.encoding == 'bin', then the ArrayBuffer is returned. If no options is specified at all - result is String as in fs.loadFile
# statSync (fileName) → Boolean | Object inner
Get file statistics. Will throw in case file or folder does not exists.
Arguments:
fileName
:
# unlinkSync () inner
Delete file.