Method Description:
Sync version of Fs.open ().
Grammar:
Copy Code code as follows:
Fs.opensync (path, flags, [mode])
Because this method belongs to the FS module, it is necessary to introduce FS module (VAR fs= require ("FS") before use.
Receive parameters:
Path file paths
Flags can be the following values
Copy Code code as follows:
' R '-opens the file in read mode.
' r+ '-opens the file in read-write mode.
' RS '-open and read files using synchronous mode. Indicates that the operating system ignores the local file system cache.
' Rs+ '-opens synchronously, reads and writes to the file.
' W '-opens the file in read mode and creates it if the file does not exist
' WX '-and ' W ' mode, return failure if file exists
' w+ '-opens the file in read-write mode and creates it if the file does not exist
' wx+ '-like ' w+ ' mode, return failure if file exists
' A '-opens the file in Append mode and creates if the file does not exist
' Ax '-and ' a ' mode, return failure if file exists
' A + '-opens the file in read Append mode, and creates it if the file does not exist
' ax+ '-as in ' A + ' mode, return failure if file exists
Mode to set permissions on files when you create them, default 0666
Source:
Copy Code code as follows:
Fs.opensync = function (path, flags, mode) {
mode = Modenum (mode, 438/*=0666*/);
Nullcheck (path);
Return Binding.open (Pathmodule._makelong (path), stringtoflags (Flags), mode);
};