Learning Links: http://www.runoob.com/nodejs/nodejs-global-object.html
In JavaScript, the window is usually a global object, while the global object in node. JS is global, and all global variables (except the global itself) are properties of the global object .
Global objects and global variables
Note: always use var to define variables to avoid introducing global variables, because global variables pollute namespaces and increase the risk of code coupling.
__filename
__dirname
SetTimeout (CB, MS)
Cleartimeout (t)
SetInterval (CB, MS)
Console
Process
Common tools
Util.inherits
Util.inspect
Util.isarray (object)
Util.isregexp (object)
Util.isdate (object)
Util.iserror (object)
File system
The methods in the node. JS File System (FS module) module have asynchronous and synchronous versions, such as functions that read the contents of the file with asynchronous Fs.readfile () and synchronous Fs.readfilesync ().
The last parameter of the Async method function is a callback function, and the first parameter of the callback function contains the error message (ERR).
Open File
The following is the syntax format for opening files in asynchronous mode:
Fs.open (path, flags[, mode], callback)
Get file information
Fs.stat (Path, callback)
Write file
Fs.writefile (file, data[, Options], callback)
Read file
Fs.read (fd, buffer, offset, length, position, callback)
Close File
Fs.close (FD, callback)
Intercepting files
Fs.ftruncate (FD, Len, callback)
deleting files
Fs.unlink (Path, callback)
Create a Directory
Fs.mkdir (path[, mode], callback)
Read Directory
Fs.readdir (Path, callback)
Delete Directory
Fs.rmdir (Path, callback)
"Node. js" Global variables, common tools, file systems