Class:Buffer
.{Function}
Used to handle binary data. See the buffer section
require()
to require modules, require isn;t actually a blobal but rather local to each module.
require.resolve()
Use the internal require() machinery to look up the location of a module ,but rather
than loading the module ,,just return the resolved filename.
require.cache
object
Modules are cached in this object when they are required..
By deleting a key value from this object the next require will relodad the module.
require.extensions
Array
Instruct require on how to handle certain file extensions.
Process files with the extendion .sjs as .js
require.extendions['.sjs'] = require.extensions['.js'];
require.extensions['.sjs'] = function(module,filename) {
var content = fs.readFileSync(filename,'utf8');
module.exports = content;
}
__filename
the filename of the code being executed.This is the resolved absolute path of this code file. For a main program this is not necessarily the same filename used in
the command line The value inside a module is the path to that module file
__dirname
The name of the directory that the current executing script resides in
module
{object}
A reference to the current module .
In particular module.exports is the same as the exportts object.
module isn;t actually a global but rather local to each module
exports
An object which is shared between all instances of the current module and made a
module and made a accessible ghrough require(). exports is the same as the module.exports object exports in
setTimeout(cb,ms)
Run callback cb after at least ms milliseconds The actual delay ddepends on extenernal factors like OS timer granularyity and system load.
in the range of 1-2137483647 inclusive
a timer cannot span more than 24.8 days.
Returns an opaque value that represents the timer.
clearTimeout(t)
Stop a timer that was previously created with setTimeout()... The callack will not execute.
setInterval(cb, ms)
Run callback cb repeatedly every ms millseconds vary, depending on external
clearInterval(t)
console
Stability
For printing to stdout and stderr, similar to the console object fuctions provided by most web browsers
console.log([data],[...])
prints to stdout with newline, this function can take multiple arguments in a printf
console.log('count:%d',count);
util.inspect
console.info([data],[...])
console.error([data],[...])
console.warn
console.dir(obj)
console.time(label)
console.timeEnd(label)
console.time('100-elements');
for(var i=0;i<100;i++) {
;
}
console.timeEnd('100-elements');
console.trace(label)
Print a stack trace to stderr of the current position.
console.assert(expression,[message])
Same as assert.ok where if the expression evaluates as false throw as Assertion Error with message
Timers
Stability Locked..
All of the timer functions are globals
setTimeout(callback,delay,[arg],[...])
pass arguments to the callback.
Modules