Skip to content

Instantly share code, notes, and snippets.

@bgoonz
Last active December 10, 2021 08:01
Show Gist options
  • Save bgoonz/d5cf41d127b965b405514f261070230a to your computer and use it in GitHub Desktop.
Save bgoonz/d5cf41d127b965b405514f261070230a to your computer and use it in GitHub Desktop.
jAVASCRIPT-cHEAT-sHEET.md

Vanilla JS

Global object: properties

Object.length(obj);

length is a property of a function object, and indicates how many arguments the function expects, i.e. the number of formal parameters. This number does not include the rest parameter. Has a value of 1

Object.prototype;

Represents the Object prototype object and allows to add new properties and methods to all objects of type Object

Methods of the Object constructor

Object.assign(target, ...sources);

Copies the values of all enumerable own properties from one or more source objects to a target object. method is used to copy the values of all enumerable own properties from one or more source objects to a target object. It will return the target object

Object.create(MyObject);

Creates a new object with the specified prototype object and properties. The object which should be the prototype of the newly-created object

Object.defineProperty(obj, prop, descriptor);

Adds the named property described by a given descriptor to an object

Object.defineProperties(obj, props);

Adds the named properties described by the given descriptors to an object

Object.entries(obj);

Returns an array containing all of the [key, value] pairs of a given object's own enumerable string properties

Object.freeze(obj);

Freezes an object: other code can't delete or change any properties

Object.getOwnPropertyDescriptor(obj, prop);

Returns a property descriptor for a named property on an object

Object.getOwnPropertyDescriptors(obj);

Returns an object containing all own property descriptors for an object

Object.getOwnPropertyNames(obj);

Returns an array containing the names of all of the given object's own enumerable and non-enumerable properties

Object.getOwnPropertySymbols(obj);

Returns an array of all symbol properties found directly upon a given object

Object.getPrototypeOf(obj);

Returns the prototype of the specified object

Object.is(value1, value2);

Compares if two values are the same value. Equates all NaN values (which differs from both Abstract Equality Comparison and Strict Equality Comparison)

Object.isExtensible(obj);

Determines if extending of an object is allowed

Object.isFrozen(obj);

Determines if an object was frozen

Object.isSealed(obj);

Determines if an object is sealed

Object.keys(obj);

Returns an array containing the names of all of the given object's own enumerable string properties

Object.preventExtensions(obj);

Prevents any extensions of an object

Object.seal(obj);

Prevents other code from deleting properties of an object

Object.setPrototypeOf(obj, prototype);

Sets the prototype (i.e., the internal [[Prototype]] property)

Object.values(obj);

Returns an array containing the values that correspond to all of a given object's own enumerable string properties

Object instances and Object prototype object (Object.prototype.property or Object.prototype.method()) Properties

obj.constructor;

Specifies the function that creates an object's prototype

obj.__proto__;

Points to the object which was used as prototype when the object was instantiated

Methods

obj.hasOwnProperty(prop);

Returns a boolean indicating whether an object contains the specified property as a direct property of that object and not inherited through the prototype chain

prototypeObj.isPrototypeOf(object);

Returns a boolean indicating whether the object this method is called upon is in the prototype chain of the specified object

obj.propertyIsEnumerable(prop);

Returns a boolean indicating if the internal ECMAScript [[Enumerable]] attribute is set

obj.toLocaleString();

Calls toString()

obj.toString();

Returns a string representation of the object

object.valueOf();

Returns the primitive value of the specified object

Global object: properties

Array.length;

Reflects the number of elements in an array

Array.prototype;

Represents the prototype for the Array constructor and allows to add new properties and methods to all Array objects

Global object: methods

Array.from(arrayLike[, mapFn[, thisArg]]);

Creates a new Array instance from an array-like or iterable object

Array.isArray(obj);

Returns true if a variable is an array, if not false

Array.of(element0[, element1[, ...[, elementN]]]);

Creates a new Array instance with a variable number of arguments, regardless of number or type of the arguments

Instance: properties

arr.length;

Reflects the number of elements in an array

Instance: mutator methods

arr.copyWithin(target, start, end);

Copies a sequence of array elements within the array

arr.fill(value, start, end);

Fills all the elements of an array from a start index to an end index with a static value

arr.pop();

Removes the last element from an array and returns that element

arr.push([element1[, ...[, elementN]]]);

Adds one or more elements to the end of an array and returns the new length of the array

arr.reverse();

Reverses the order of the elements of an array in place — the first becomes the last, and the last becomes the first

arr.shift();

Removes the first element from an array and returns that element

arr.sort();

Sorts the elements of an array in place and returns the array

array.splice(start, deleteCount, item1, item2, ...)

Adds and/or removes elements from an array.


arr.unshift([element1[, ...[, elementN]]]);

Adds one or more elements to the front of an array and returns the new length of the array

Instance: accessor methods

arr.concat(value1[, value2[, ...[, valueN]]]);

Returns a new array comprised of this array joined with other array(s) and/or value(s)

arr.includes(searchElement, fromIndex);

Determines whether an array contains a certain element, returning true or false as appropriate

arr.indexOf(searchElement[, fromIndex]);

Returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found

arr.join(separator);

Joins all elements of an array into a string

arr.lastIndexOf(searchElement, fromIndex);

Returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found

arr.slice(begin, end);

Extracts a section of an array and returns a new array

arr.toString();

Returns a string representing the array and its elements. Overrides the Object.prototype.toString() method

arr.toLocaleString(locales, options);

Returns a localized string representing the array and its elements. Overrides the Object.prototype.toLocaleString() method

Instance: iteration methods

arr.entries();

Returns a new Array Iterator object that contains the key/value pairs for each index in the array

arr.every(callback[, thisArg]);

Returns true if every element in this array satisfies the provided testing function

arr.filter(callback[, thisArg]);

Creates a new array with all of the elements of this array for which the provided filtering function returns true

arr.find(callback[, thisArg]);

Returns the found value in the array, if an element in the array satisfies the provided testing function or undefined if not found

arr.findIndex(callback[, thisArg]);

Returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found

arr.forEach(callback[, thisArg]);

Calls a function for each element in the array

arr.keys();

Returns a new Array Iterator that contains the keys for each index in the array

arr.map(callback[, initialValue]);

Creates a new array with the results of calling a provided function on every element in this array

arr.reduce(callback[, initialValue]);

Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value

arr.reduceRight(callback[, initialValue]);

Apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value

arr.some(callback[, initialValue]);

Returns true if at least one element in this array satisfies the provided testing function

arr.values();

Returns a new Array Iterator object that contains the values for each index in the array






NodeJS


let http = require("http");

An example of a web server written with Node which responds with 'Hello World'

To run the server, put the code into a file called example.js and execute it with the node program.


http
  .createServer(function (request, response) {
    response.writeHead(200, { "Content-Type": "text/plain" });
    response.end("Hello World\n");
  })
  .listen(8124);
console.log("Server running at http://127.0.0.1:8124/");

GLOBAL OBJECTS


In browsers, the top-level scope is the global scope

That means that in browsers if you're in the global scope let something will define a global variable.

In Node this is different. The top-level scope is not the global scope; let something inside a Node module will be local to that module.


__filename;


The filename of the code being executed. (absolute path)

__dirname;



---

###   The name of the directory that the currently executing script resides in. (absolute path)
module;


A reference to the current module. In particular module.exports is used for defining what a module exports and makes available through require()

exports;


A reference to the module.exports that is shorter to type

process;


The process object is a global object and can be accessed from anywhere. It is an instance of EventEmitter

Buffer;


The Buffer class is a global type for dealing with binary data directly

console.log([data], [...]);


Prints to stdout with newline

console.info([data], [...]);

Same as console.log.


console.error([data], [...]);


Same as console.log but prints to stderr

console.warn([data], [...]);


Same as console.error

console.dir(obj);

Uses util.inspect on obj and prints resulting string to stdout

console.time(label);


Mark a time

console.timeEnd(label);

Finish timer, record output

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 an AssertionError with message

setTimeout(callback, delay, [arg], [...]);

To schedule execution of a one-time callback after delay milliseconds. Optionally you can also pass arguments to the callback

clearTimeout(t);

Stop a timer that was previously created with setTimeout()

setInterval(callback, delay, [arg], [...]);


To schedule the repeated execution of callback every delay milliseconds. Optionally you can also pass arguments to the callback

clearInterval(t);

Stop a timer that was previously created with setInterval()

setImmediate(callback, [arg], [...]);

To schedule the "immediate" execution of callback after I/O events callbacks and before setTimeout and setInterval

clearImmediate(immediateObject);

Stop a timer that was previously created with setImmediate()

unref();

Allow you to create a timer that is active but if it is the only item left in the event loop, node won't keep the program running

ref();

If you had previously unref()d a timer you can call ref() to explicitly request the timer hold the program open

let module = require('./module.js');

Loads the module module.js in the same directory.


module.require("./another_module.js");


load another_module as if require() was called from the module itself

module.id;

The identifier for the module. Typically this is the fully resolved filename

module.filename;


The fully resolved filename to the module

module.loaded;

Whether or not the module is done loading, or is in the process of loading

module.parent;

The module that required this one

module.children;


The module objects required by this one

exports.area = function (r) {
  return Math.PI * r * r;
};

If you want the root of your module's export to be a function (such as a constructor)

or if you want to export a complete object in one assignment instead of building it one property at a time, assign it to module.exports instead of exports.


module.exports = function (width) {
  return {
    area: function () {
      return width * width;
    },
  };
};

process.on("exit", function (code) {});

Emitted when the process is about to exit

> process.on('uncaughtException', function(err) {});

Emitted when an exception bubbles all the way back to the event loop. (should not be used)

process.stdout;

A writable stream to stdout

process.stderr;

A writable stream to stderr

process.stdin;


A readable stream for stdin

process.argv;

An array containing the command line arguments

process.env;

An object containing the user environment

process.execPath;

This is the absolute pathname of the executable that started the process

process.execArgv;

This is the set of node-specific command line options from the executable that started the process

process.arch;

What processor architecture you're running on: 'arm', 'ia32', or 'x64'

process.config;

An Object containing the JavaScript representation of the configure options that were used to compile the current node executable

process.pid;

The PID of the process

process.platform;

What platform you're running on: 'darwin', 'freebsd', 'linux', 'sunos' or 'win32'

process.title;


Getter/setter to set what is displayed in 'ps'

process.version;

A compiled-in property t

hat exposes NODE_VERSION.


process.versions;

A property exposing version strings of node and its dependencies

> process.abort();

This causes node to emit an abort. This will cause node to exit and generate a core file

process.chdir(dir);

Changes the current working directory of the process or throws an exception if that fails

process.cwd();


Returns the current working directory of the process

?process.exit([code]);
Ends the process with the specified code. If omitted, exit uses the 'success' code 0.


process.getgid();

Gets the group identity of the process

process.setgid(id);

Sets the group identity of the process

process.getuid();

Gets the user identity of the process

process.setuid(id);

Sets the user identity of the process

process.getgroups();


Returns an array with the supplementary group IDs

process.setgroups(grps);


Sets the supplementary group IDs

process.initgroups(user, extra_grp);


Reads /etc/group and initializes the group access list, using all groups of which the user is a member

process.kill(pid, [signal]);

Send a signal to a process. pid is the process id and signal is the string describing the signal to send

process.memoryUsage();

Returns an object describing the memory usage of the Node process measured in bytes

process.nextTick(callback);

On the next loop around the event loop call this callback

process.maxTickDepth;

Callbacks passed to process.nextTick will usually be called at the end of the current flow of execution, and are thus approximately as fast as calling a function synchronously

process.umask([mask]);

Sets or reads the process's file mode creation mask

process.uptime();

Number of seconds Node has been running

process.hrtime();

Returns the current high-resolution real time in a [seconds, nanoseconds] tuple Array

Node provides a tri-directional popen facility through the child_process module.

It is possible to stream data through a child's stdin, stdout, and stderr in a fully non-blocking way.


ChildProcess;

Class. ChildProcess is an EventEmitter

child.stdin;

A Writable Stream that represents the child process's stdin

child.stdout;



---

###   A Readable Stream that represents the child process's stdout
child.stderr;


A Readable Stream that represents the child process's stderr

child.pid;

The PID of the child process

child.connected;



---

###   If .connected is false, it is no longer possible to send messages
child.kill([signal]);


Send a signal to the child process

> child.send(message, [sendHandle]);

When using child_process.fork() you can write to the child using child.send(message, [sendHandle]) and messages are received by a 'message' event on the child


child.disconnect();

Close the IPC channel between parent and child, allowing the child to exit gracefully once there are no other connections keeping it alive

child_process.spawn(command, [args], [options]);

Launches a new process with the given command, with command line arguments in args. If omitted, args defaults to an empty Array

child_process.exec(command, [options], callback);

Runs a command in a shell and buffers the output

child_process.execFile(file, [args], [options], [callback]);


Runs a command in a shell and buffers the output

child_process.fork(modulePath, [args], [options]);


This is a special case of the spawn() functionality for spawning Node processes. In addition to having all the methods in a normal ChildProcess instance, the returned object has a communication channel built-in

These functions are in the module 'util'. Use require('util') to access them.


util.format(format, [...]);

Returns a formatted string using the first argument as a printf-like format. (%s, %d, %j)

util.debug(string);



A synchronous output function. Will block the process and output string immediately to stderr

util.error([...]);

Same as util.debug() except this will output all arguments immediately to stderr

util.puts([...]);

A synchronous output function. Will block the process and output all arguments to stdout with newlines after each argument

util.print([...]);

A synchronous output function. Will block the process, cast each argument to a string then output to stdout. (no newlines)

util.log(string);

Output with timestamp on stdout.


util.inspect(object, [opts]);


Return a string representation of object, which is useful for debugging. (options: showHidden, depth, colors, customInspect)

util.isArray(object);

Returns true if the given "object" is an Array. false otherwise.


util.isRegExp(object);

Returns true if the given "object" is a RegExp. false otherwise

util.isDate(object);

Returns true if the given "object" is a Date. false otherwise

util.isError(object);

Returns true if the given "object" is an Error. false otherwise

util.promisify(fn);

Takes a function whose last argument is a callback and returns a version that returns promises

util.inherits(constructor, superConstructor);


Inherit the prototype methods from one constructor into another


EVENTS

All objects which emit events are instances of events.EventEmitter. You can access this module by doing: require("events");


To access the EventEmitter class, require('events').EventEmitter

All EventEmitters emit the event 'newListener' when new listeners are added and 'removeListener' when a listener is removed.


emitter.addListener(event, listener);

Adds a listener to the end of the listeners array for the specified event

emitter.on(event, listener);

Same as emitter.addListener()

emitter.once(event, listener);

Adds a one time listener for the event. This listener is invoked only the next time the event is fired, after which it is removed.


emitter.removeListener(event, listener);

Remove a listener from the listener array for the specified event

emitter.removeAllListeners([event]);

Removes all listeners, or those of the specified event

emitter.setMaxListeners(n);

By default EventEmitters will print a warning if more than 10 listeners are added for a particular event

emitter.listeners(event);

Returns an array of listeners for the specified event

emitter.emit(event, [arg1], [arg2], [...]);


Execute each of the listeners in order with the supplied arguments. Returns true if event had listeners, false otherwise

EventEmitter.listenerCount(emitter, event);


Return the number of listeners for a given event

A stream is an abstract interface implemented by various objects in Node. For example a request to an HTTP server is a stream, as is stdout.

Streams are readable, writable, or both. All streams are instances of EventEmitter.

The Readable stream interface is the abstraction for a source of data that you are reading from.

In other words, data comes out of a Readable stream.

A Readable stream will not start emitting data until you indicate that you are ready to receive it.

Examples of readable streams include: http responses on the client, http requests on the server, fs read streams zlib streams, crypto streams, tcp sockets, child process stdout and stderr, process.stdin.


let readable = getReadableStreamSomehow();
readable.on("readable", function () {});

When a chunk of data can be read from the stream, it will emit a 'readable' event

readable.on("data", function (chunk) {});


If you attach a data event listener, then it will switch the stream into flowing mode, and data will be passed to your handler as soon as it is available

readable.on("end", function () {});

This event fires when there will be no more data to read

readable.on("close", function () {});


Emitted when the underlying resource (for example, the backing file descriptor) has been closed. Not all streams will emit this

readable.on("error", function () {});


Emitted if there was an error receiving data

The read() method pulls some data out of the internal buffer and returns it. If there is no data available, then it will return null.

This method should only be called in non-flowing mode. In flowing-mode, this method is called automatically until the internal buffer is drained.


readable.read([size]);
readable.setEncoding(encoding);

Call this function to cause the stream to return strings of the specified encoding instead of Buffer objects

readable.resume();

This method will cause the readable stream to resume emitting data events

readable.pause();

This method will cause a stream in flowing-mode to stop emitting data events

readable.pipe(destination, [options]);

This method pulls all the data out of a readable stream, and writes it to the supplied destination, automatically managing the flow so that the destination is not overwhelmed by a fast readable stream

readable.unpipe([destination]);

This method will remove the hooks set up for a previous pipe() call. If the destination is not specified, then all pipes are removed

readable.unshift(chunk);

This is useful in certain cases where a stream is being consumed by a parser, which needs to "un-consume" some data that it has optimistically pulled out of the source, so that the stream can be passed on to some other party

The Writable stream interface is an abstraction for a destination that you are writing data to.

Examples of writable streams include: http requests on the client, http responses on the server, fs write streams, zlib streams, crypto streams, tcp sockets, child process stdin, process.stdout, process.stderr.


let writer = getWritableStreamSomehow();
writable.write(chunk, [encoding], [callback]);


This method writes some data to the underlying system, and calls the supplied callback once the data has been fully handled

writer.once("drain", write);

If a writable.write(chunk) call returns false, then the drain event will indicate when it is appropriate to begin writing more data to the stream

writable.end([chunk], [encoding], [callback]);


Call this method when no more data will be written to the stream

writer.on("finish", function () {});

When the end() method has been called, and all data has been flushed to the underlying system, this event is emitted

writer.on("pipe", function (src) {});


This is emitted whenever the pipe() method is called on a readable stream, adding this writable to its set of destinations

writer.on("unpipe", function (src) {});

This is emitted whenever the unpipe() method is called on a readable stream, removing this writable from its set of destinations

writer.on("error", function (src) {});

Emitted if there was an error when writing or piping data

Duplex streams are streams that implement both the Readable and Writable interfaces. See above for usage.

Examples of Duplex streams include: tcp sockets, zlib streams, crypto streams.

Transform streams are Duplex streams where the output is in some way computed from the input. They implement both the Readable and Writable interfaces. See above for usage.

Examples of Transform streams include: zlib streams, crypto streams.





To use this module do require('fs')

All the methods have asynchronous and synchronous forms.


fs.rename(oldPath, newPath, callback);


Asynchronous rename. No arguments other than a possible exception are given to the completion callback.Asynchronous ftruncate. No arguments other than a possible exception are given to the completion callback

fs.renameSync(oldPath, newPath);

Synchronous rename

fs.ftruncate(fd, len, callback);

Asynchronous ftruncate. No arguments other than a possible exception are given to the completion callback

fs.ftruncateSync(fd, len);

Synchronous ftruncate

fs.truncate(path, len, callback);

Asynchronous truncate. No arguments other than a possible exception are given to the completion callback

fs.truncateSync(path, len);

Synchronous truncate

fs.chown(path, uid, gid, callback);

Asynchronous chown. No arguments other than a possible exception are given to the completion callback

fs.chownSync(path, uid, gid);

Synchronous chown

fs.fchown(fd, uid, gid, callback);


Asynchronous fchown. No arguments other than a possible exception are given to the completion callback

fs.fchownSync(fd, uid, gid);


Synchronous fchown

fs.lchown(path, uid, gid, callback);

Asynchronous lchown. No arguments other than a possible exception are given to the completion callback

fs.lchownSync(path, uid, gid);

Synchronous lchown

fs.chmod(path, mode, callback);

Asynchronous chmod. No arguments other than a possible exception are given to the completion callback

fs.chmodSync(path, mode);

Synchronous chmod

fs.fchmod(fd, mode, callback);

Asynchronous fchmod. No arguments other than a possible exception are given to the completion callback

fs.fchmodSync(fd, mode);

Synchronous fchmod

fs.lchmod(path, mode, callback);

Asynchronous lchmod. No arguments other than a possible exception are given to the completion callback

fs.lchmodSync(path, mode);

Synchronous lchmod

fs.stat(path, callback);

Asynchronous stat. The callback gets two arguments (err, stats) where stats is a fs.Stats object

fs.statSync(path);

Synchronous stat. Returns an instance of fs.Stats

fs.lstat(path, callback);

Asynchronous lstat. The callback gets two arguments (err, stats) where stats is a fs.Stats object. lstat() is identical to stat(), except that if path is a symbolic link, then the link itself is stat-ed, not the file that it refers to

fs.lstatSync(path);

Synchronous lstat. Returns an instance of fs.Stats

fs.fstat(fd, callback);

Asynchronous fstat. The callback gets two arguments (err, stats) where stats is a fs.Stats object. fstat() is identical to stat(), except that the file to be stat-ed is specified by the file descriptor fd

fs.fstatSync(fd);


Synchronous fstat. Returns an instance of fs.Stats

fs.link(srcpath, dstpath, callback);

Asynchronous link. No arguments other than a possible exception are given to the completion callback

fs.linkSync(srcpath, dstpath);

Synchronous link

fs.symlink(srcpath, dstpath, [type], callback);


Asynchronous symlink. No arguments other than a possible exception are given to the completion callback. The type argument can be set to 'dir', 'file', or 'junction' (default is 'file') and is only available on Windows (ignored on other platforms)

fs.symlinkSync(srcpath, dstpath, [type]);

Synchronous symlink

fs.readlink(path, callback);

Asynchronous readlink. The callback gets two arguments (err, linkString)

fs.readlinkSync(path);


Synchronous readlink. Returns the symbolic link's string value

fs.unlink(path, callback);


Asynchronous unlink. No arguments other than a possible exception are given to the completion callback

fs.unlinkSync(path);

Synchronous unlink

fs.realpath(path, [cache], callback);

Asynchronous realpath. The callback gets two arguments (err, resolvedPath)

fs.realpathSync(path, [cache]);

Synchronous realpath. Returns the resolved path

fs.rmdir(path, callback);

Asynchronous rmdir. No arguments other than a possible exception are given to the completion callback

fs.rmdirSync(path);


Synchronous rmdir

fs.mkdir(path, [mode], callback);

Asynchronous mkdir. No arguments other than a possible exception are given to the completion callback. mode defaults to 0777

fs.mkdirSync(path, [mode]);

Synchronous mkdir

fs.readdir(path, callback);

Asynchronous readdir. Reads the contents of a directory. The callback gets two arguments (err, files) where files is an array of the names of the files in the directory excluding '.' and '..'

fs.readdirSync(path);

Synchronous readdir. Returns an array of filenames excluding '.' and '..'

fs.close(fd, callback);

Asynchronous close. No arguments other than a possible exception are given to the completion callback

fs.closeSync(fd);

Synchronous close

fs.open(path, flags, [mode], callback);

Asynchronous file open

fs.openSync(path, flags, [mode]);

Synchronous version of fs.open()

fs.utimes(path, atime, mtime, callback);


Change file timestamps of the file referenced by the supplied path

fs.utimesSync(path, atime, mtime);

Synchronous version of fs.utimes()

fs.futimes(fd, atime, mtime, callback);

Change the file timestamps of a file referenced by the supplied file descriptor

fs.futimesSync(fd, atime, mtime);

Synchronous version of fs.futimes()

fs.fsync(fd, callback);

Asynchronous fsync. No arguments other than a possible exception are given to the completion callback

fs.fsyncSync(fd);

Synchronous fsync

fs.write(fd, buffer, offset, length, position, callback);


Write buffer to the file specified by fd

fs.writeSync(fd, buffer, offset, length, position);

Synchronous version of fs.write(). Returns the number of bytes written

fs.read(fd, buffer, offset, length, position, callback);

Read data from the file specified by fd

fs.readSync(fd, buffer, offset, length, position);

Synchronous version of fs.read. Returns the number of bytesRead

fs.readFile(filename, [options], callback);

Asynchronously reads the entire contents of a file

fs.readFileSync(filename, [options]);

Synchronous version of fs.readFile. Returns the contents of the filename. If the encoding option is specified then this function returns a string. Otherwise it returns a buffer

fs.writeFile(filename, data, [options], callback);

Asynchronously writes data to a file, replacing the file if it already exists. data can be a string or a buffer

fs.writeFileSync(filename, data, [options]);

The synchronous version of fs.writeFile

fs.appendFile(filename, data, [options], callback);


Asynchronously append data to a file, creating the file if it not yet exists. data can be a string or a buffer

fs.appendFileSync(filename, data, [options]);

The synchronous version of fs.appendFile

fs.watch(filename, [options], [listener]);

Watch for changes on filename, where filename is either a file or a directory. The returned object is a fs.FSWatcher. The listener callback gets two arguments (event, filename). event is either 'rename' or 'change', and filename is the name of the file which triggered the event

fs.exists(path, callback);


Test whether or not the given path exists by checking with the file system. Then call the callback argument with either true or false. (should not be used)

> fs.existsSync(path);

Synchronous version of fs.exists. (should not be used) fs.Stats: objects returned from fs.stat(), fs.lstat() and fs.fstat() and their synchronous counterparts are of this type.


stats.isFile();
stats.isDirectory()
stats.isBlockDevice()
stats.isCharacterDevice()
stats.isSymbolicLink()
>  (only valid with fs.lstat())
stats.isFIFO()
stats.isSocket()
fs.createReadStream(path, [options]);

Returns a new ReadStream object

fs.createWriteStream(path, [options]);


Returns a new WriteStream object

Use require('path') to use this module.

This module contains utilities for handling and transforming file paths.

Almost all these methods perform only string transformations.

The file system is not consulted to check whether paths are valid.


path.normalize(p);

Normalize a string path, taking care of '..' and '.' parts

path.join([path1], [path2], [...]);

Join all arguments together and normalize the resulting path

path.resolve([from ...], to);

Resolves 'to' to an absolute path

path.relative(from, to);

Solve the relative path from 'from' to 'to'

path.dirname(p);

Return the directory name of a path. Similar to the Unix dirname command

path.basename(p, [ext]);

Return the last portion of a path. Similar to the Unix basename command.


path.extname(p);


Return the extension of the path, from the last '.' to end of string in the last portion of the path

path.sep;


The platform-specific file separator. '\' or '/'

path.delimiter;


The platform-specific path delimiter, ';' or ':'

To use the HTTP server and client one must require('http').


http.STATUS_CODES;

A collection of all the standard HTTP response status codes, and the short description of each

http.request(options, [callback]);

This function allows one to transparently issue requests.


http.get(options, [callback]);

Set the method to GET and calls req.end() automatically

server = http.createServer([requestListener]);


Returns a new web server object. The requestListener is a function which is automatically added to the 'request' event

server.listen(port, [hostname], [backlog], [callback]);

Begin accepting connections on the specified port and hostname

server.listen(path, [callback]);

Start a UNIX socket server listening for connections on the given path

server.listen(handle, [callback]);

The handle object can be set to either a server or socket (anything with an underlying _handle member), or a {fd: } object

server.close([callback]);

Stops the server from accepting new connections

server.setTimeout(msecs, callback);

Sets the timeout value for sockets, and emits a 'timeout' event on the Server object, passing the socket as an argument, if a timeout occurs

server.maxHeadersCount;


Limits maximum incoming headers count, equal to 1000 by default. If set to 0 - no limit will be applied

server.timeout;

The number of milliseconds of inactivity before a socket is presumed to have timed out

server.on("request", function (request, response) {});

Emitted each time there is a request

server.on("connection", function (socket) {});

When a new TCP stream is established

server.on("close", function () {});


Emitted when the server closes

server.on("checkContinue", function (request, response) {});


Emitted each time a request with an http Expect: 100-continue is received

server.on("connect", function (request, socket, head) {});

Emitted each time a client requests a http CONNECT method

server.on("upgrade", function (request, socket, head) {});

Emitted each time a client requests a http upgrade

server.on("clientError", function (exception, socket) {});

If a client connection emits an 'error' event - it will forwarded here

request.write(chunk, [encoding]);

Sends a chunk of the body

request.end([data], [encoding]);

Finishes sending the request. If any parts of the body are unsent, it will flush them to the stream

request.abort();

Aborts a request

request.setTimeout(timeout, [callback]);


Once a socket is assigned to this request and is connected socket.setTimeout() will be called

request.setNoDelay([noDelay]);

Once a socket is assigned to this request and is connected socket.setNoDelay() will be called

request.setSocketKeepAlive([enable], [initialDelay]);

Once a socket is assigned to this request and is connected socket.setKeepAlive() will be called

request.on("response", function (response) {});

Emitted when a response is received to this request. This event is emitted only once

request.on("socket", function (socket) {});

Emitted after a socket is assigned to this request

request.on("connect", function (response, socket, head) {});

Emitted each time a server responds to a request with a CONNECT method. If this event isn't being listened for, clients receiving a CONNECT method will have their connections closed

request.on("upgrade", function (response, socket, head) {});

Emitted each time a server responds to a request with an upgrade. If this event isn't being listened for, clients receiving an upgrade header will have their connections closed

request.on("continue", function () {});

Emitted when the server sends a '100 Continue' HTTP response, usually because the request contained 'Expect: 100-continue'. This is an instruction that the client should send the request body

response.write(chunk, [encoding]);

This sends a chunk of the response body. If this merthod is called and response.writeHead() has not been called, it will switch to implicit header mode and flush the implicit headers

response.writeContinue();

Sends a HTTP/1.1 100 Continue message to the client, indicating that the request body should be sent

response.writeHead(statusCode, [reasonPhrase], [headers]);

Sends a response header to the request

response.setTimeout(msecs, callback);

Sets the Socket's timeout value to msecs. If a callback is provided, then it is added as a listener on the 'timeout' event on the response object

response.setHeader(name, value);

Sets a single header value for implicit headers. If this header already exists in the to-be-sent headers, its value will be replaced. Use an array of strings here if you need to send multiple headers with the same name

response.getHeader(name);

Reads out a header that's already been queued but not sent to the client. Note that the name is case insensitive

response.removeHeader(name);

Removes a header that's queued for implicit sending

response.addTrailers(headers);

This method adds HTTP trailing headers (a header but at the end of the message) to the response

response.end([data], [encoding]);

This method signals to the server that all of the response headers and body have been sent; that server should consider this message complete. The method, response.end(), MUST be called on each response

response.statusCode;

When using implicit headers (not calling response.writeHead() explicitly), this property controls the status code that will be sent to the client when the headers get flushed

response.headersSent;

Boolean (read-only). True if headers were sent, false otherwise

response.sendDate;

When true, the Date header will be automatically generated and sent in the response if it is not already present in the headers. Defaults to true

response.on("close", function () {});


Indicates that the underlying connection was terminated before response.end() was called or able to flush

response.on("finish", function () {});


Emitted when the response has been sent

message.httpVersion;

In case of server request, the HTTP version sent by the client. In the case of client response, the HTTP version of the connected-to server

message.headers;

The request/response headers object

message.trailers;


The request/response trailers object. Only populated after the 'end' event

message.method;

The request method as a string. Read only. Example: 'GET', 'DELETE'

message.url;

Request URL string. This contains only the URL that is present in the actual HTTP request

message.statusCode;

The 3-digit HTTP response status code. E.G. 404.


message.socket;

The net.Socket object associated with the connection

message.setTimeout(msecs, callback);

Calls message.connection.setTimeout(msecs, callback)

This module has utilities for URL resolution and parsing. Call require('url') to use it.


url.parse(urlStr, [parseQueryString], [slashesDenoteHost]);


Take a URL string, and return an object

url.format(urlObj);

Take a parsed URL object, and return a formatted URL string

url.resolve(from, to);

Take a base URL, and a href URL, and resolve them as a browser would for an anchor tag





This module provides utilities for dealing with query strings. Call require('querystring') to use it

querystring.stringify(obj, [sep], [eq]);

Serialize an object to a query string. Optionally override the default separator ('&') and assignment ('=') characters

querystring.parse(str, [sep], [eq], [options]);


Deserialize a query string to an object. Optionally override the default separator ('&') and assignment ('=') characters

This module is used for writing unit tests for your applications, you can access it with require('assert').


assert.fail(actual, expected, message, operator);

Throws an exception that displays the values for actual and expected separated by the provided operator

assert(value, message);
assert.ok(value, [message]);


Tests if value is truthy, it is equivalent to assert.equal(true, !!value, message)

assert.equal(actual, expected, [message]);


Tests shallow, coercive equality with the equal comparison operator ( == )

assert.notEqual(actual, expected, [message]);

Tests shallow, coercive non-equality with the not equal comparison operator ( != )

assert.deepEqual(actual, expected, [message]);

Tests for deep equality

assert.notDeepEqual(actual, expected, [message]);

Tests for any deep inequality

assert.strictEqual(actual, expected, [message]);


Tests strict equality, as determined by the strict equality operator ( === )

assert.notStrictEqual(actual, expected, [message]);

Tests strict non-equality, as determined by the strict not equal operator ( !== )

assert.throws(block, [error], [message]);

Expects block to throw an error. error can be constructor, RegExp or validation function

assert.doesNotThrow(block, [message]);

Expects block not to throw an error, see assert.throws for details

assert.ifError(value);

Tests if value is not a false value, throws if it is a true value. Useful when testing the first argument, error in callbacks

Provides a few basic operating-system related utility functions.

Use require('os') to access this module.


os.tmpdir();

Returns the operating system's default directory for temp files

os.endianness();

Returns the endianness of the CPU. Possible values are "BE" or "LE"

os.hostname();

Returns the hostname of the operating system

os.type();

Returns the operating system name

os.platform();

Returns the operating system platform

os.arch();

Returns the operating system CPU architecture

os.release();


Returns the operating system release

os.uptime();

Returns the system uptime in seconds

os.loadavg();


Returns an array containing the 1, 5, and 15 minute load averages

os.totalmem();

Returns the total amount of system memory in bytes

os.freemem();


Returns the amount of free system memory in bytes

os.cpus();

Returns an array of objects containing information about each CPU/core installed: model, speed (in MHz), and times (an object containing the number of milliseconds the CPU/core spent in: user, nice, sys, idle, and irq)

os.networkInterfaces();


Get a list of network interfaces

os.EOL;

A constant defining the appropriate End-of-line marker for the operating system

Buffer is used to dealing with binary data Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap

Buffer.from(size);

Allocates a new buffer of size octets

Buffer.from(array);

Allocates a new buffer using an array of octets

Buffer.from(str, [encoding]);

Allocates a new buffer containing the given str. encoding defaults to 'utf8'

Buffer.isEncoding(encoding);

Returns true if the encoding is a valid encoding argument, or false otherwise

Buffer.isBuffer(obj);

Tests if obj is a Buffer

Buffer.concat(list, [totalLength]);

Returns a buffer which is the result of concatenating all the buffers in the list together

Buffer.byteLength(string, [encoding]);

Gives the actual byte length of a string

buf.write(string, [offset], [length], [encoding]);

Writes string to the buffer at offset using the given encoding

buf.toString([encoding], [start], [end]);


Decodes and returns a string from buffer data encoded with encoding (defaults to 'utf8') beginning at start (defaults to 0) and ending at end (defaults to buffer.length).


buf.toJSON();

Returns a JSON-representation of the Buffer instance, which is identical to the output for JSON Arrays

buf.copy(targetBuffer, [targetStart], [sourceStart], [sourceEnd]);


Does copy between buffers. The source and target regions can be overlapped

buf.slice([start], [end]);

Returns a new buffer which references the same memory as the old, but offset and cropped by the start (defaults to 0) and end (defaults to buffer.length) indexes. Negative indexes start from the end of the buffer

buf.fill(value, [offset], [end]);

Fills the buffer with the specified value

buf[index];

Get and set the octet at index

buf.length;

The size of the buffer in bytes, Note that this is not necessarily the size of the contents

buffer.INSPECT_MAX_BYTES;

How many bytes will be returned when buffer.inspect() is called. This can be overridden by user modules





ReactJS


npm install --save react
#// declarative and flexible JavaScript library for building UI
npm install --save react-dom
---
---
---
---


#> serves as the entry point of the DOM-related rendering paths
npm install --save prop-types
#// runtime type checking for React props and similar objects

notes: don't forget the command lines

Create and return a new React element of the given type.

Code written with JSX will be converted to use React.createElement().


You will not typically invoke React.createElement() directly if you are using JSX

React.createElement(type, [props], [...children]);

Clone and return a new React element using element as the starting point

The resulting element will have the original element's props with the new props merged in shallowly.


React.cloneElement(element, [props], [...children]);

Verifies the object is a React element. Returns true or false

React.isValidElement(object);

React.Children> provides utilities for dealing with the this.props.children opaque data structure

Invokes a function on every immediate child contained within children with this set to thisArg.


React.Children.map(children, function[(thisArg)]);

Like React.Children.map() but does not return an array

React.Children.forEach(children, function[(thisArg)]);

Returns the total number of components in children, equal to the number of times that a callback passed to map or forEach would be invoked

React.Children.count(children);

Verifies that children has only one child (a React element) and returns it

Otherwise this method throws an error.


React.Children.only(children);

Returns the children opaque data structure as a flat array with keys assigned to each child

Useful if you want to manipulate collections of children in your render methods, especially if you want to reorder or slice this.props.children before passing it down.


React.Children.toArray(children);

The React.Fragment component lets you return multiple elements in a render() method without creating an additional DOM element


You can also use it with the shorthand <></> syntax

class Component extends React.Component {

Will be called before it is mounted constructor(props) { Call this method before any other statement or this.props will be undefined in the constructor super(props);

The constructor is also often used to bind event handlers to the class instance.

Binding makes sure the method has access to component attributes like this.props and this.state

this.method = this.method.bind(this);

The constructor is the right place to initialize state

  this.state = {
    active: true,

In rare cases, it's okay to initialize state based on props

This effectively "forks" the props and sets the state with the initial props.

If you "fork" props by using them for state, you might also want to implement componentWillReceiveProps(nextProps) to keep the state up-to-date with them. But lifting state up is often easier and less bug-prone.


    color: props.initialColor
  };
}

Enqueues changes to the component state and tells React that this component and its children need to be re-rendered with the updated state.

setState() does not always immediately update the component. It may batch or defer the update until later.

This makes reading this.state right after calling setState() a potential pitfall.

Instead, use componentDidUpdate or a setState callback.


You may optionally pass an object as the first argument to setState() instead of a function

setState(updater[, callback]) { }

Invoked just before mounting occurs (before render())

This is the only lifecycle hook called on server rendering.


componentWillMount() { }

Invoked immediately after a component is mounted.

Initialization that requires DOM nodes should go here.

If you need to load data from a remote endpoint, this is a good place to instantiate the network request.

This method is a good place to set up any subscriptions. If you do that, don't forget to unsubscribe in componentWillUnmount().


componentDidMount() { }

Invoked before a mounted component receives new props.

If you need to update the state in response to prop changes (for example, to reset it), you may compare this.props and nextProps and perform state transitions using this.setState() in this method.


componentWillReceiveProps(nextProps) { }

^^^^ Let React know if a component's output is not affected by the current change in state or props

The default behavior is to re-render on every state change, and in the vast majority of cases you should rely on the default behavior.


shouldComponentUpdate() is invoked before rendering when new props or state are being received. Defaults to true

This method is not called for the initial render or when forceUpdate() is used.

Returning false does not prevent child components from re-rendering when their state changes.


shouldComponentUpdate(nextProps, nextState) { }

Invoked just before rendering when new props or state are being received.

Use this as an opportunity to perform preparation before an update occurs. This method is not called for the initial render.

Note that you cannot call this.setState() here; nor should you do anything else

(e.g. dispatch a Redux action) that would trigger an update to a React component before componentWillUpdate() returns.

If you need to update state in response to props changes, use componentWillReceiveProps() instead.


componentWillUpdate(nextProps, nextState) { }

Invoked immediately after updating occurs. This method is not called for the initial render.

Use this as an opportunity to operate on the DOM when the component has been updated.

This is also a good place to do network requests as long as you compare the current props to previous props (e.g. a network request may not be necessary if the props have not changed).


componentDidUpdate(prevProps, prevState) { }

Invoked immediately before a component is unmounted and destroyed.

Perform any necessary cleanup in this method, such as invalidating timers, canceling network requests, or cleaning up any subscriptions that were created in componentDidMount().


componentWillUnmount() { }

Error boundaries are React components that catch JavaScript errors anywhere in their child component tree, log those errors, and display a fallback UI instead of the component tree that crashed.

Error boundaries catch errors during rendering, in lifecycle methods, and in constructors of the whole tree below them.


componentDidCatch() { }

This method is required.

It should be pure, meaning that it does not modify component state, it returns the same result each time it's invoked, and

it does not directly interact with the browser (use lifecycle methods for this)

It must return one of the following types: react elements, string and numbers, portals, null or booleans.


render() {

Contains the props that were defined by the caller of this component.


console.log(this.props);

Contains data specific to this component that may change over time

The state is user-defined, and it should be a plain JavaScript object.

If you don't use it in render(), it shouldn't be in the state.

For example, you can put timer IDs directly on the instance.

Never mutate this.state directly, as calling setState() afterwards may replace the mutation you made.

Treat this.state as if it were immutable.


  console.log(this.state);
  return (
    <div>
      {/* Comment goes here */}
      Hello, {this.props.name}!
    </div>
  );
}
}

Can be defined as a property on the component class itself, to set the default props for the class.

This is used for undefined props, but not for null props.


Component.defaultProps = {
  color: "blue",
};
component = new Component();

By default, when your component's state or props change, your component will re-render

If your render() method depends on some other data, you can tell React that the component needs re-rendering by calling forceUpdate().

Normally you should try to avoid all uses of forceUpdate() and only read from this.props and this.state in render().


component.forceUpdate(callback);




REACT.DOM

  • The react-dom package provides DOM-specific methods that can be used at the top level of

  • your app and as an escape hatch to get outside of the React model if you need to.

  • Most of your components should not need to use this module.

Render a React element into the DOM in the supplied container and return a reference

to the component (or returns null for stateless components).


ReactDOM.render(element, container[, callback]);

Same as render(), but is used to hydrate a container whose HTML contents were rendered

by ReactDOMServer. React will attempt to attach event listeners to the existing markup.


ReactDOM.hydrate(element, container[, callback]);

Remove a mounted React component from the DOM and clean up its event handlers and state

If no component was mounted in the container, calling this function does nothing.

Returns true if a component was unmounted and false if there was no component to unmount.


ReactDOM.unmountComponentAtNode(container);

If this component has been mounted into the DOM, this returns the corresponding native browser

DOM element. This method is useful for reading values out of the DOM, such as form field values

and performing DOM measurements. In most cases, you can attach a ref to the DOM node and avoid

using findDOMNode at all.


ReactDOM.findDOMNode(component);

Creates a portal. Portals provide a way to render children into a DOM node that exists outside

the hierarchy of the DOM component.



ReactDOM.createPortal(child, container);




REACTDOMSERVER

  • The ReactDOMServer object enables you to render components to static markup.

Render a React element to its initial HTML. React will return an HTML string.


You can use this method to generate HTML on the server and send the markup down on the initial

request for faster page loads and to allow search engines to crawl your pages for SEO purposes.


ReactDOMServer.renderToString(element);

Similar to renderToString, except this doesn't create extra DOM attributes that React uses

internally, such as data-reactroot. This is useful if you want to use React as a simple static

page generator, as stripping away the extra attributes can save some bytes.


ReactDOMServer.renderToStaticMarkup(element);

Render a React element to its initial HTML. Returns a Readable stream that outputs an HTML string

The HTML output by this stream is exactly equal to what ReactDOMServer.renderToString would return.


You can use this method to generate HTML on the server and send the markup down on the initial

request for faster page loads and to allow search engines to crawl your pages for SEO purposes.


ReactDOMServer.renderToNodeStream(element);

Similar to renderToNodeStream, except this doesn't create extra DOM attributes that React uses

internally, such as data-reactroot. This is useful if you want to use React as a simple static

page generator, as stripping away the extra attributes can save some bytes.


ReactDOMServer.renderToStaticNodeStream(element)

import PropTypes from 'prop-types';
MyComponent.propTypes = {

You can declare that a prop is a specific JS type. By default, these are all optional

optionalArray: PropTypes.array,
optionalBool: PropTypes.bool,
optionalFunc: PropTypes.func,
optionalNumber: PropTypes.number,
optionalObject: PropTypes.object,
optionalString: PropTypes.string,
optionalSymbol: PropTypes.symbol,  Anything that can be rendered: numbers, strings, elements or an array

(or fragment) containing these types

optionalNode: PropTypes.node, A React element.


optionalElement: PropTypes.element, You can also declare that a prop is an instance of a class. This uses

JS's instanceof operator.

optionalMessage: PropTypes.instanceOf(Message), You can ensure that your prop is limited to specific values by treating

it as an enum.


optionalEnum: PropTypes.oneOf(['News', 'Photos']),  An object that could be one of many types
optionalUnion: PropTypes.oneOfType([
  PropTypes.string,
  PropTypes.number,
  PropTypes.instanceOf(Message)
]),  An array of a certain type
optionalArrayOf: PropTypes.arrayOf(PropTypes.number),  An object with property values of a certain type
optionalObjectOf: PropTypes.objectOf(PropTypes.number),  An object taking on a particular shape
optionalObjectWithShape: PropTypes.shape({
  color: PropTypes.string,
  fontSize: PropTypes.number
}),  You can chain any of the above with `isRequired` to make sure a warning

is shown if the prop isn't provided

  • requiredFunc: PropTypes.func.isRequired, A value of any data type
  • requiredAny: PropTypes.any.isRequired, You can also specify a custom validator. It should return an Error

object if the validation fails. Don't console.warn or throw, as this

won't work inside oneOfType.


customProp: function(props, propName, componentName) {
  if (!/matchme/.test(props[propName])) {
    return new Error(
      'Invalid prop `' + propName + '` supplied to' +
      ' `' + componentName + '`. Validation failed.'
    );
  }
},

You can also supply a custom validator to arrayOf and objectOf

It should return an Error object if the validation fails. The validator

will be called for each key in the array or object. The first two

arguments of the validator are the array or object itself, and the

current item's key.


customArrayProp: PropTypes.arrayOf(function(propValue, key, componentName, location, propFullName) {
  if (!/matchme/.test(propValue[key])) {
    return new Error(
      'Invalid prop `' + propFullName + '` supplied to' +
      ' `' + componentName + '`. Validation failed.'
    );
  }
})
};
<!DOCTYPE html><html><head>
<title>scrap</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="file:///c:\Users\bryan\.vscode-insiders\extensions\shd101wyy.markdown-preview-enhanced-0.6.1\node_modules\@shd101wyy\mume\dependencies\katex\katex.min.css">
<style>
/**
* prism.js Github theme based on GitHub's theme.
* @author Sam Clarke
*/
code[class*="language-"],
pre[class*="language-"] {
color: #333;
background: none;
font-family: Consolas, "Liberation Mono", Menlo, Courier, monospace;
text-align: left;
white-space: pre;
word-spacing: normal;
word-break: normal;
word-wrap: normal;
line-height: 1.4;
-moz-tab-size: 8;
-o-tab-size: 8;
tab-size: 8;
-webkit-hyphens: none;
-moz-hyphens: none;
-ms-hyphens: none;
hyphens: none;
}
/* Code blocks */
pre[class*="language-"] {
padding: .8em;
overflow: auto;
/* border: 1px solid #ddd; */
border-radius: 3px;
/* background: #fff; */
background: #f5f5f5;
}
/* Inline code */
:not(pre) > code[class*="language-"] {
padding: .1em;
border-radius: .3em;
white-space: normal;
background: #f5f5f5;
}
.token.comment,
.token.blockquote {
color: #969896;
}
.token.cdata {
color: #183691;
}
.token.doctype,
.token.punctuation,
.token.variable,
.token.macro.property {
color: #333;
}
.token.operator,
.token.important,
.token.keyword,
.token.rule,
.token.builtin {
color: #a71d5d;
}
.token.string,
.token.url,
.token.regex,
.token.attr-value {
color: #183691;
}
.token.property,
.token.number,
.token.boolean,
.token.entity,
.token.atrule,
.token.constant,
.token.symbol,
.token.command,
.token.code {
color: #0086b3;
}
.token.tag,
.token.selector,
.token.prolog {
color: #63a35c;
}
.token.function,
.token.namespace,
.token.pseudo-element,
.token.class,
.token.class-name,
.token.pseudo-class,
.token.id,
.token.url-reference .token.variable,
.token.attr-name {
color: #795da3;
}
.token.entity {
cursor: help;
}
.token.title,
.token.title .token.punctuation {
font-weight: bold;
color: #1d3e81;
}
.token.list {
color: #ed6a43;
}
.token.inserted {
background-color: #eaffea;
color: #55a532;
}
.token.deleted {
background-color: #ffecec;
color: #bd2c00;
}
.token.bold {
font-weight: bold;
}
.token.italic {
font-style: italic;
}
/* JSON */
.language-json .token.property {
color: #183691;
}
.language-markup .token.tag .token.punctuation {
color: #333;
}
/* CSS */
code.language-css,
.language-css .token.function {
color: #0086b3;
}
/* YAML */
.language-yaml .token.atrule {
color: #63a35c;
}
code.language-yaml {
color: #183691;
}
/* Ruby */
.language-ruby .token.function {
color: #333;
}
/* Markdown */
.language-markdown .token.url {
color: #795da3;
}
/* Makefile */
.language-makefile .token.symbol {
color: #795da3;
}
.language-makefile .token.variable {
color: #183691;
}
.language-makefile .token.builtin {
color: #0086b3;
}
/* Bash */
.language-bash .token.keyword {
color: #0086b3;
}
/* highlight */
pre[data-line] {
position: relative;
padding: 1em 0 1em 3em;
}
pre[data-line] .line-highlight-wrapper {
position: absolute;
top: 0;
left: 0;
background-color: transparent;
display: block;
width: 100%;
}
pre[data-line] .line-highlight {
position: absolute;
left: 0;
right: 0;
padding: inherit 0;
margin-top: 1em;
background: hsla(24, 20%, 50%,.08);
background: linear-gradient(to right, hsla(24, 20%, 50%,.1) 70%, hsla(24, 20%, 50%,0));
pointer-events: none;
line-height: inherit;
white-space: pre;
}
pre[data-line] .line-highlight:before,
pre[data-line] .line-highlight[data-end]:after {
content: attr(data-start);
position: absolute;
top: .4em;
left: .6em;
min-width: 1em;
padding: 0 .5em;
background-color: hsla(24, 20%, 50%,.4);
color: hsl(24, 20%, 95%);
font: bold 65%/1.5 sans-serif;
text-align: center;
vertical-align: .3em;
border-radius: 999px;
text-shadow: none;
box-shadow: 0 1px white;
}
pre[data-line] .line-highlight[data-end]:after {
content: attr(data-end);
top: auto;
bottom: .4em;
}html body{font-family:"Helvetica Neue",Helvetica,"Segoe UI",Arial,freesans,sans-serif;font-size:16px;line-height:1.6;color:#333;background-color:#fff;overflow:initial;box-sizing:border-box;word-wrap:break-word}html body>:first-child{margin-top:0}html body h1,html body h2,html body h3,html body h4,html body h5,html body h6{line-height:1.2;margin-top:1em;margin-bottom:16px;color:#000}html body h1{font-size:2.25em;font-weight:300;padding-bottom:.3em}html body h2{font-size:1.75em;font-weight:400;padding-bottom:.3em}html body h3{font-size:1.5em;font-weight:500}html body h4{font-size:1.25em;font-weight:600}html body h5{font-size:1.1em;font-weight:600}html body h6{font-size:1em;font-weight:600}html body h1,html body h2,html body h3,html body h4,html body h5{font-weight:600}html body h5{font-size:1em}html body h6{color:#5c5c5c}html body strong{color:#000}html body del{color:#5c5c5c}html body a:not([href]){color:inherit;text-decoration:none}html body a{color:#08c;text-decoration:none}html body a:hover{color:#00a3f5;text-decoration:none}html body img{max-width:100%}html body>p{margin-top:0;margin-bottom:16px;word-wrap:break-word}html body>ul,html body>ol{margin-bottom:16px}html body ul,html body ol{padding-left:2em}html body ul.no-list,html body ol.no-list{padding:0;list-style-type:none}html body ul ul,html body ul ol,html body ol ol,html body ol ul{margin-top:0;margin-bottom:0}html body li{margin-bottom:0}html body li.task-list-item{list-style:none}html body li>p{margin-top:0;margin-bottom:0}html body .task-list-item-checkbox{margin:0 .2em .25em -1.8em;vertical-align:middle}html body .task-list-item-checkbox:hover{cursor:pointer}html body blockquote{margin:16px 0;font-size:inherit;padding:0 15px;color:#5c5c5c;background-color:#f0f0f0;border-left:4px solid #d6d6d6}html body blockquote>:first-child{margin-top:0}html body blockquote>:last-child{margin-bottom:0}html body hr{height:4px;margin:32px 0;background-color:#d6d6d6;border:0 none}html body table{margin:10px 0 15px 0;border-collapse:collapse;border-spacing:0;display:block;width:100%;overflow:auto;word-break:normal;word-break:keep-all}html body table th{font-weight:bold;color:#000}html body table td,html body table th{border:1px solid #d6d6d6;padding:6px 13px}html body dl{padding:0}html body dl dt{padding:0;margin-top:16px;font-size:1em;font-style:italic;font-weight:bold}html body dl dd{padding:0 16px;margin-bottom:16px}html body code{font-family:Menlo,Monaco,Consolas,'Courier New',monospace;font-size:.85em !important;color:#000;background-color:#f0f0f0;border-radius:3px;padding:.2em 0}html body code::before,html body code::after{letter-spacing:-0.2em;content:"\00a0"}html body pre>code{padding:0;margin:0;font-size:.85em !important;word-break:normal;white-space:pre;background:transparent;border:0}html body .highlight{margin-bottom:16px}html body .highlight pre,html body pre{padding:1em;overflow:auto;font-size:.85em !important;line-height:1.45;border:#d6d6d6;border-radius:3px}html body .highlight pre{margin-bottom:0;word-break:normal}html body pre code,html body pre tt{display:inline;max-width:initial;padding:0;margin:0;overflow:initial;line-height:inherit;word-wrap:normal;background-color:transparent;border:0}html body pre code:before,html body pre tt:before,html body pre code:after,html body pre tt:after{content:normal}html body p,html body blockquote,html body ul,html body ol,html body dl,html body pre{margin-top:0;margin-bottom:16px}html body kbd{color:#000;border:1px solid #d6d6d6;border-bottom:2px solid #c7c7c7;padding:2px 4px;background-color:#f0f0f0;border-radius:3px}@media print{html body{background-color:#fff}html body h1,html body h2,html body h3,html body h4,html body h5,html body h6{color:#000;page-break-after:avoid}html body blockquote{color:#5c5c5c}html body pre{page-break-inside:avoid}html body table{display:table}html body img{display:block;max-width:100%;max-height:100%}html body pre,html body code{word-wrap:break-word;white-space:pre}}.markdown-preview{width:100%;height:100%;box-sizing:border-box}.markdown-preview .pagebreak,.markdown-preview .newpage{page-break-before:always}.markdown-preview pre.line-numbers{position:relative;padding-left:3.8em;counter-reset:linenumber}.markdown-preview pre.line-numbers>code{position:relative}.markdown-preview pre.line-numbers .line-numbers-rows{position:absolute;pointer-events:none;top:1em;font-size:100%;left:0;width:3em;letter-spacing:-1px;border-right:1px solid #999;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none}.markdown-preview pre.line-numbers .line-numbers-rows>span{pointer-events:none;display:block;counter-increment:linenumber}.markdown-preview pre.line-numbers .line-numbers-rows>span:before{content:counter(linenumber);color:#999;display:block;padding-right:.8em;text-align:right}.markdown-preview .mathjax-exps .MathJax_Display{text-align:center !important}.markdown-preview:not([for="preview"]) .code-chunk .btn-group{display:none}.markdown-preview:not([for="preview"]) .code-chunk .status{display:none}.markdown-preview:not([for="preview"]) .code-chunk .output-div{margin-bottom:16px}.scrollbar-style::-webkit-scrollbar{width:8px}.scrollbar-style::-webkit-scrollbar-track{border-radius:10px;background-color:transparent}.scrollbar-style::-webkit-scrollbar-thumb{border-radius:5px;background-color:rgba(150,150,150,0.66);border:4px solid rgba(150,150,150,0.66);background-clip:content-box}html body[for="html-export"]:not([data-presentation-mode]){position:relative;width:100%;height:100%;top:0;left:0;margin:0;padding:0;overflow:auto}html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{position:relative;top:0}@media screen and (min-width:914px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{padding:2em calc(50% - 457px + 2em)}}@media screen and (max-width:914px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{padding:2em}}@media screen and (max-width:450px){html body[for="html-export"]:not([data-presentation-mode]) .markdown-preview{font-size:14px !important;padding:1em}}@media print{html body[for="html-export"]:not([data-presentation-mode]) #sidebar-toc-btn{display:none}}html body[for="html-export"]:not([data-presentation-mode]) #sidebar-toc-btn{position:fixed;bottom:8px;left:8px;font-size:28px;cursor:pointer;color:inherit;z-index:99;width:32px;text-align:center;opacity:.4}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] #sidebar-toc-btn{opacity:1}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc{position:fixed;top:0;left:0;width:300px;height:100%;padding:32px 0 48px 0;font-size:14px;box-shadow:0 0 4px rgba(150,150,150,0.33);box-sizing:border-box;overflow:auto;background-color:inherit}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar{width:8px}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar-track{border-radius:10px;background-color:transparent}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc::-webkit-scrollbar-thumb{border-radius:5px;background-color:rgba(150,150,150,0.66);border:4px solid rgba(150,150,150,0.66);background-clip:content-box}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc a{text-decoration:none}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc ul{padding:0 1.6em;margin-top:.8em}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc li{margin-bottom:.8em}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .md-sidebar-toc ul{list-style-type:none}html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{left:300px;width:calc(100% - 300px);padding:2em calc(50% - 457px - 150px);margin:0;box-sizing:border-box}@media screen and (max-width:1274px){html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{padding:2em}}@media screen and (max-width:450px){html body[for="html-export"]:not([data-presentation-mode])[html-show-sidebar-toc] .markdown-preview{width:100%}}html body[for="html-export"]:not([data-presentation-mode]):not([html-show-sidebar-toc]) .markdown-preview{left:50%;transform:translateX(-50%)}html body[for="html-export"]:not([data-presentation-mode]):not([html-show-sidebar-toc]) .md-sidebar-toc{display:none}
html body:before {
content: "Failed to compile `style.less`. NameError: Property '$font-primary' is undefined in input on line 10, column 18:
9 html {
10 font-family: $font-primary;
11 font-size: 110%;
" !important;
padding: 2em !important;
}
.mume.mume { display: none !important; }
</style>
</head>
<body for="html-export">
<div class="mume markdown-preview ">
<h1 class="mume-header" id="vanilla-js">Vanilla JS</h1>
<blockquote>
<p>Global object: properties</p>
</blockquote>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token known-class-name class-name">Object</span><span class="token punctuation">.</span><span class="token method function property-access">length</span><span class="token punctuation">(</span>obj<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="length-is-a-property-of-a-function-object-and-indicates-how-many-arguments-the-function-expects-ie-the-number-of-formal-parameters-this-number-does-not-include-the-rest-parameter-has-a-value-of-1">length is a property of a function object, and indicates how many arguments the function expects, i.e. the number of formal parameters. This number does not include the rest parameter. Has a value of 1</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token class-name">Object</span><span class="token punctuation">.</span><span class="token property-access">prototype</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="represents-the-object-prototype-object-and-allows-to-add-new-properties-and-methods-to-all-objects-of-type-object">Represents the Object prototype object and allows to add new properties and methods to all objects of type Object</h3>
<blockquote>
<p>Methods of the Object constructor</p>
</blockquote>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token known-class-name class-name">Object</span><span class="token punctuation">.</span><span class="token method function property-access">assign</span><span class="token punctuation">(</span>target<span class="token punctuation">,</span> <span class="token spread operator">...</span>sources<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="copies-the-values-of-all-enumerable-own-properties-from-one-or-more-source-objects-to-a-target-object-method-is-used-to-copy-the-values-of-all-enumerable-own-properties-from-one-or-more-source-objects-to-a-target-object-it-will-return-the-target-object">Copies the values of all enumerable own properties from one or more source objects to a target object. method is used to copy the values of all enumerable own properties from one or more source objects to a target object. It will return the target object</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token known-class-name class-name">Object</span><span class="token punctuation">.</span><span class="token method function property-access">create</span><span class="token punctuation">(</span><span class="token maybe-class-name">MyObject</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="creates-a-new-object-with-the-specified-prototype-object-and-properties-the-object-which-should-be-the-prototype-of-the-newly-created-object">Creates a new object with the specified prototype object and properties. The object which should be the prototype of the newly-created object</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token known-class-name class-name">Object</span><span class="token punctuation">.</span><span class="token method function property-access">defineProperty</span><span class="token punctuation">(</span>obj<span class="token punctuation">,</span> prop<span class="token punctuation">,</span> descriptor<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="adds-the-named-property-described-by-a-given-descriptor-to-an-object">Adds the named property described by a given descriptor to an object</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token known-class-name class-name">Object</span><span class="token punctuation">.</span><span class="token method function property-access">defineProperties</span><span class="token punctuation">(</span>obj<span class="token punctuation">,</span> props<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="adds-the-named-properties-described-by-the-given-descriptors-to-an-object">Adds the named properties described by the given descriptors to an object</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token known-class-name class-name">Object</span><span class="token punctuation">.</span><span class="token method function property-access">entries</span><span class="token punctuation">(</span>obj<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-an-array-containing-all-of-the-key-value-pairs-of-a-given-objects-own-enumerable-string-properties">Returns an array containing all of the [key, value] pairs of a given object&apos;s own enumerable string properties</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token known-class-name class-name">Object</span><span class="token punctuation">.</span><span class="token method function property-access">freeze</span><span class="token punctuation">(</span>obj<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="freezes-an-object-other-code-cant-delete-or-change-any-properties">Freezes an object: other code can&apos;t delete or change any properties</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token known-class-name class-name">Object</span><span class="token punctuation">.</span><span class="token method function property-access">getOwnPropertyDescriptor</span><span class="token punctuation">(</span>obj<span class="token punctuation">,</span> prop<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-a-property-descriptor-for-a-named-property-on-an-object">Returns a property descriptor for a named property on an object</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token known-class-name class-name">Object</span><span class="token punctuation">.</span><span class="token method function property-access">getOwnPropertyDescriptors</span><span class="token punctuation">(</span>obj<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-an-object-containing-all-own-property-descriptors-for-an-object">Returns an object containing all own property descriptors for an object</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token known-class-name class-name">Object</span><span class="token punctuation">.</span><span class="token method function property-access">getOwnPropertyNames</span><span class="token punctuation">(</span>obj<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-an-array-containing-the-names-of-all-of-the-given-objects-own-enumerable-and-non-enumerable-properties">Returns an array containing the names of all of the given object&apos;s own enumerable and non-enumerable properties</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token known-class-name class-name">Object</span><span class="token punctuation">.</span><span class="token method function property-access">getOwnPropertySymbols</span><span class="token punctuation">(</span>obj<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-an-array-of-all-symbol-properties-found-directly-upon-a-given-object">Returns an array of all symbol properties found directly upon a given object</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token known-class-name class-name">Object</span><span class="token punctuation">.</span><span class="token method function property-access">getPrototypeOf</span><span class="token punctuation">(</span>obj<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-the-prototype-of-the-specified-object">Returns the prototype of the specified object</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token known-class-name class-name">Object</span><span class="token punctuation">.</span><span class="token method function property-access">is</span><span class="token punctuation">(</span>value1<span class="token punctuation">,</span> value2<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="compares-if-two-values-are-the-same-value-equates-all-nan-values-which-differs-from-both-abstract-equality-comparison-and-strict-equality-comparison">Compares if two values are the same value. Equates all NaN values (which differs from both Abstract Equality Comparison and Strict Equality Comparison)</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token known-class-name class-name">Object</span><span class="token punctuation">.</span><span class="token method function property-access">isExtensible</span><span class="token punctuation">(</span>obj<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="determines-if-extending-of-an-object-is-allowed">Determines if extending of an object is allowed</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token known-class-name class-name">Object</span><span class="token punctuation">.</span><span class="token method function property-access">isFrozen</span><span class="token punctuation">(</span>obj<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="determines-if-an-object-was-frozen">Determines if an object was frozen</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token known-class-name class-name">Object</span><span class="token punctuation">.</span><span class="token method function property-access">isSealed</span><span class="token punctuation">(</span>obj<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="determines-if-an-object-is-sealed">Determines if an object is sealed</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token known-class-name class-name">Object</span><span class="token punctuation">.</span><span class="token method function property-access">keys</span><span class="token punctuation">(</span>obj<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-an-array-containing-the-names-of-all-of-the-given-objects-own-enumerable-string-properties">Returns an array containing the names of all of the given object&apos;s own enumerable string properties</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token known-class-name class-name">Object</span><span class="token punctuation">.</span><span class="token method function property-access">preventExtensions</span><span class="token punctuation">(</span>obj<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="prevents-any-extensions-of-an-object">Prevents any extensions of an object</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token known-class-name class-name">Object</span><span class="token punctuation">.</span><span class="token method function property-access">seal</span><span class="token punctuation">(</span>obj<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="prevents-other-code-from-deleting-properties-of-an-object">Prevents other code from deleting properties of an object</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token known-class-name class-name">Object</span><span class="token punctuation">.</span><span class="token method function property-access">setPrototypeOf</span><span class="token punctuation">(</span>obj<span class="token punctuation">,</span> prototype<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="sets-the-prototype-ie-the-internal-prototype-property">Sets the prototype (i.e., the internal <a href="Prototype.md">Prototype</a> property)</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token known-class-name class-name">Object</span><span class="token punctuation">.</span><span class="token method function property-access">values</span><span class="token punctuation">(</span>obj<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-an-array-containing-the-values-that-correspond-to-all-of-a-given-objects-own-enumerable-string-properties">Returns an array containing the values that correspond to all of a given object&apos;s own enumerable string properties</h3>
<blockquote>
<p>Object instances and Object prototype object (Object.prototype.property or Object.prototype.method())<br>
Properties</p>
</blockquote>
<pre data-role="codeBlock" data-info="js" class="language-javascript">obj<span class="token punctuation">.</span><span class="token property-access">constructor</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="specifies-the-function-that-creates-an-objects-prototype">Specifies the function that creates an object&apos;s prototype</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">obj<span class="token punctuation">.</span><span class="token property-access">__proto__</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="points-to-the-object-which-was-used-as-prototype-when-the-object-was-instantiated">Points to the object which was used as prototype when the object was instantiated</h3>
<blockquote>
<p>Methods</p>
</blockquote>
<pre data-role="codeBlock" data-info="js" class="language-javascript">obj<span class="token punctuation">.</span><span class="token method function property-access">hasOwnProperty</span><span class="token punctuation">(</span>prop<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-a-boolean-indicating-whether-an-object-contains-the-specified-property-as-a-direct-property-of-that-object-and-not-inherited-through-the-prototype-chain">Returns a boolean indicating whether an object contains the specified property as a direct property of that object and not inherited through the prototype chain</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">prototypeObj<span class="token punctuation">.</span><span class="token method function property-access">isPrototypeOf</span><span class="token punctuation">(</span>object<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-a-boolean-indicating-whether-the-object-this-method-is-called-upon-is-in-the-prototype-chain-of-the-specified-object">Returns a boolean indicating whether the object this method is called upon is in the prototype chain of the specified object</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">obj<span class="token punctuation">.</span><span class="token method function property-access">propertyIsEnumerable</span><span class="token punctuation">(</span>prop<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-a-boolean-indicating-if-the-internal-ecmascript-enumerable-attribute-is-set">Returns a boolean indicating if the internal ECMAScript <a href="Enumerable.md">Enumerable</a> attribute is set</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">obj<span class="token punctuation">.</span><span class="token method function property-access">toLocaleString</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="calls-tostring">Calls toString()</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">obj<span class="token punctuation">.</span><span class="token method function property-access">toString</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-a-string-representation-of-the-object">Returns a string representation of the object</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">object<span class="token punctuation">.</span><span class="token method function property-access">valueOf</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-the-primitive-value-of-the-specified-object">Returns the primitive value of the specified object</h3>
<h2 class="mume-header" id="global-object-properties">Global object: properties</h2>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token known-class-name class-name">Array</span><span class="token punctuation">.</span><span class="token property-access">length</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="reflects-the-number-of-elements-in-an-array">Reflects the number of elements in an array</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token class-name">Array</span><span class="token punctuation">.</span><span class="token property-access">prototype</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="represents-the-prototype-for-the-array-constructor-and-allows-to-add-new-properties-and-methods-to-all-array-objects">Represents the prototype for the Array constructor and allows to add new properties and methods to all Array objects</h3>
<h2 class="mume-header" id="global-object-methods">Global object: methods</h2>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token known-class-name class-name">Array</span><span class="token punctuation">.</span><span class="token keyword module keyword-from">from</span><span class="token punctuation">(</span>arrayLike<span class="token punctuation">[</span><span class="token punctuation">,</span> mapFn<span class="token punctuation">[</span><span class="token punctuation">,</span> thisArg<span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="creates-a-new-array-instance-from-an-array-like-or-iterable-object">Creates a new Array instance from an array-like or iterable object</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token known-class-name class-name">Array</span><span class="token punctuation">.</span><span class="token method function property-access">isArray</span><span class="token punctuation">(</span>obj<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-true-if-a-variable-is-an-array-if-not-false">Returns true if a variable is an array, if not false</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token known-class-name class-name">Array</span><span class="token punctuation">.</span><span class="token method function property-access">of</span><span class="token punctuation">(</span>element0<span class="token punctuation">[</span><span class="token punctuation">,</span> element1<span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token spread operator">...</span><span class="token punctuation">[</span><span class="token punctuation">,</span> elementN<span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="creates-a-new-array-instance-with-a-variable-number-of-arguments-regardless-of-number-or-type-of-the-arguments">Creates a new Array instance with a variable number of arguments, regardless of number or type of the arguments</h3>
<blockquote>
<p>Instance: properties</p>
</blockquote>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token property-access">length</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="reflects-the-number-of-elements-in-an-array-1">Reflects the number of elements in an array</h3>
<blockquote>
<p>Instance: mutator methods</p>
</blockquote>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">copyWithin</span><span class="token punctuation">(</span>target<span class="token punctuation">,</span> start<span class="token punctuation">,</span> end<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="copies-a-sequence-of-array-elements-within-the-array">Copies a sequence of array elements within the array</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">fill</span><span class="token punctuation">(</span>value<span class="token punctuation">,</span> start<span class="token punctuation">,</span> end<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="fills-all-the-elements-of-an-array-from-a-start-index-to-an-end-index-with-a-static-value">Fills all the elements of an array from a start index to an end index with a static value</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">pop</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="removes-the-last-element-from-an-array-and-returns-that-element">Removes the last element from an array and returns that element</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">push</span><span class="token punctuation">(</span><span class="token punctuation">[</span>element1<span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token spread operator">...</span><span class="token punctuation">[</span><span class="token punctuation">,</span> elementN<span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="adds-one-or-more-elements-to-the-end-of-an-array-and-returns-the-new-length-of-the-array">Adds one or more elements to the end of an array and returns the new length of the array</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">reverse</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="reverses-the-order-of-the-elements-of-an-array-in-place-the-first-becomes-the-last-and-the-last-becomes-the-first">Reverses the order of the elements of an array in place &#x2014; the first becomes the last, and the last becomes the first</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">shift</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="removes-the-first-element-from-an-array-and-returns-that-element">Removes the first element from an array and returns that element</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">sort</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="sorts-the-elements-of-an-array-in-place-and-returns-the-array">Sorts the elements of an array in place and returns the array</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">array<span class="token punctuation">.</span><span class="token method function property-access">splice</span><span class="token punctuation">(</span>start<span class="token punctuation">,</span> deleteCount<span class="token punctuation">,</span> item1<span class="token punctuation">,</span> item2<span class="token punctuation">,</span> <span class="token spread operator">...</span><span class="token punctuation">)</span>
</pre><blockquote>
<p>Adds and/or removes elements from an array.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">unshift</span><span class="token punctuation">(</span><span class="token punctuation">[</span>element1<span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token spread operator">...</span><span class="token punctuation">[</span><span class="token punctuation">,</span> elementN<span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="adds-one-or-more-elements-to-the-front-of-an-array-and-returns-the-new-length-of-the-array">Adds one or more elements to the front of an array and returns the new length of the array</h3>
<blockquote>
<p>Instance: accessor methods</p>
</blockquote>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">concat</span><span class="token punctuation">(</span>value1<span class="token punctuation">[</span><span class="token punctuation">,</span> value2<span class="token punctuation">[</span><span class="token punctuation">,</span> <span class="token spread operator">...</span><span class="token punctuation">[</span><span class="token punctuation">,</span> valueN<span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-a-new-array-comprised-of-this-array-joined-with-other-arrays-andor-values">Returns a new array comprised of this array joined with other array(s) and/or value(s)</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">includes</span><span class="token punctuation">(</span>searchElement<span class="token punctuation">,</span> fromIndex<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="determines-whether-an-array-contains-a-certain-element-returning-true-or-false-as-appropriate">Determines whether an array contains a certain element, returning true or false as appropriate</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">indexOf</span><span class="token punctuation">(</span>searchElement<span class="token punctuation">[</span><span class="token punctuation">,</span> fromIndex<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-the-first-least-index-of-an-element-within-the-array-equal-to-the-specified-value-or-1-if-none-is-found">Returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">join</span><span class="token punctuation">(</span>separator<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="joins-all-elements-of-an-array-into-a-string">Joins all elements of an array into a string</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">lastIndexOf</span><span class="token punctuation">(</span>searchElement<span class="token punctuation">,</span> fromIndex<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-the-last-greatest-index-of-an-element-within-the-array-equal-to-the-specified-value-or-1-if-none-is-found">Returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">slice</span><span class="token punctuation">(</span>begin<span class="token punctuation">,</span> end<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="extracts-a-section-of-an-array-and-returns-a-new-array">Extracts a section of an array and returns a new array</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">toString</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-a-string-representing-the-array-and-its-elements-overrides-the-objectprototypetostring-method">Returns a string representing the array and its elements. Overrides the Object.prototype.toString() method</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">toLocaleString</span><span class="token punctuation">(</span>locales<span class="token punctuation">,</span> options<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-a-localized-string-representing-the-array-and-its-elements-overrides-the-objectprototypetolocalestring-method">Returns a localized string representing the array and its elements. Overrides the Object.prototype.toLocaleString() method</h3>
<blockquote>
<p>Instance: iteration methods</p>
</blockquote>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">entries</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-a-new-array-iterator-object-that-contains-the-keyvalue-pairs-for-each-index-in-the-array">Returns a new Array Iterator object that contains the key/value pairs for each index in the array</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">every</span><span class="token punctuation">(</span>callback<span class="token punctuation">[</span><span class="token punctuation">,</span> thisArg<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-true-if-every-element-in-this-array-satisfies-the-provided-testing-function">Returns true if every element in this array satisfies the provided testing function</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">filter</span><span class="token punctuation">(</span>callback<span class="token punctuation">[</span><span class="token punctuation">,</span> thisArg<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="creates-a-new-array-with-all-of-the-elements-of-this-array-for-which-the-provided-filtering-function-returns-true">Creates a new array with all of the elements of this array for which the provided filtering function returns true</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">find</span><span class="token punctuation">(</span>callback<span class="token punctuation">[</span><span class="token punctuation">,</span> thisArg<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-the-found-value-in-the-array-if-an-element-in-the-array-satisfies-the-provided-testing-function-or-undefined-if-not-found">Returns the found value in the array, if an element in the array satisfies the provided testing function or undefined if not found</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">findIndex</span><span class="token punctuation">(</span>callback<span class="token punctuation">[</span><span class="token punctuation">,</span> thisArg<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-the-found-index-in-the-array-if-an-element-in-the-array-satisfies-the-provided-testing-function-or-1-if-not-found">Returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">forEach</span><span class="token punctuation">(</span>callback<span class="token punctuation">[</span><span class="token punctuation">,</span> thisArg<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="calls-a-function-for-each-element-in-the-array">Calls a function for each element in the array</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">keys</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-a-new-array-iterator-that-contains-the-keys-for-each-index-in-the-array">Returns a new Array Iterator that contains the keys for each index in the array</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">map</span><span class="token punctuation">(</span>callback<span class="token punctuation">[</span><span class="token punctuation">,</span> initialValue<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="creates-a-new-array-with-the-results-of-calling-a-provided-function-on-every-element-in-this-array">Creates a new array with the results of calling a provided function on every element in this array</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">reduce</span><span class="token punctuation">(</span>callback<span class="token punctuation">[</span><span class="token punctuation">,</span> initialValue<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="apply-a-function-against-an-accumulator-and-each-value-of-the-array-from-left-to-right-as-to-reduce-it-to-a-single-value">Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">reduceRight</span><span class="token punctuation">(</span>callback<span class="token punctuation">[</span><span class="token punctuation">,</span> initialValue<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="apply-a-function-against-an-accumulator-and-each-value-of-the-array-from-right-to-left-as-to-reduce-it-to-a-single-value">Apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">some</span><span class="token punctuation">(</span>callback<span class="token punctuation">[</span><span class="token punctuation">,</span> initialValue<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-true-if-at-least-one-element-in-this-array-satisfies-the-provided-testing-function">Returns true if at least one element in this array satisfies the provided testing function</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">arr<span class="token punctuation">.</span><span class="token method function property-access">values</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-a-new-array-iterator-object-that-contains-the-values-for-each-index-in-the-array">Returns a new Array Iterator object that contains the values for each index in the array</h3>
<hr>
<hr>
<hr>
<hr>
<hr>
<h1 class="mume-header" id="nodejs">NodeJS</h1>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token keyword keyword-let">let</span> http <span class="token operator">=</span> <span class="token function">require</span><span class="token punctuation">(</span><span class="token string">&quot;http&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="an-example-of-a-web-server-written-with-node-which-responds-with-hello-world">An example of a web server written with Node which responds with &apos;Hello World&apos;</h3>
<blockquote>
<p>To run the server, put the code into a file called example.js and execute it with the node program.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">http
<span class="token punctuation">.</span><span class="token method function property-access">createServer</span><span class="token punctuation">(</span><span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token parameter">request<span class="token punctuation">,</span> response</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
response<span class="token punctuation">.</span><span class="token method function property-access">writeHead</span><span class="token punctuation">(</span><span class="token number">200</span><span class="token punctuation">,</span> <span class="token punctuation">{</span> <span class="token string">&quot;Content-Type&quot;</span><span class="token operator">:</span> <span class="token string">&quot;text/plain&quot;</span> <span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
response<span class="token punctuation">.</span><span class="token method function property-access">end</span><span class="token punctuation">(</span><span class="token string">&quot;Hello World\n&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token punctuation">.</span><span class="token method function property-access">listen</span><span class="token punctuation">(</span><span class="token number">8124</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">log</span><span class="token punctuation">(</span><span class="token string">&quot;Server running at http://127.0.0.1:8124/&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><h2 class="mume-header" id="global-objects">GLOBAL OBJECTS</h2>
<hr>
<h3 class="mume-header" id="in-browsers-the-top-level-scope-is-the-global-scope">In browsers, the top-level scope is the global scope</h3>
<blockquote>
<p>That means that in browsers if you&apos;re in the global scope let something will define a global variable.</p>
</blockquote>
<blockquote>
<p>In Node this is different. The top-level scope is not the global scope; let something inside a Node module will be local to that module.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">__filename<span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="the-filename-of-the-code-being-executed-absolute-path">The filename of the code being executed. (absolute path)</h3>
<blockquote>
<p>__dirname;</p>
</blockquote>
<pre data-role="codeBlock" data-info class="language-"><code>
---
### The name of the directory that the currently executing script resides in. (absolute path)
module;
</code></pre><hr>
<hr>
<h3 class="mume-header" id="a-reference-to-the-current-module-in-particular-moduleexports-is-used-for-defining-what-a-module-exports-and-makes-available-through-require">A reference to the current module. In particular module.exports is used for defining what a module exports and makes available through require()</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">exports<span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="a-reference-to-the-moduleexports-that-is-shorter-to-type">A reference to the module.exports that is shorter to type</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="the-process-object-is-a-global-object-and-can-be-accessed-from-anywhere-it-is-an-instance-of-eventemitter">The process object is a global object and can be accessed from anywhere. It is an instance of EventEmitter</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">Buffer</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="the-buffer-class-is-a-global-type-for-dealing-with-binary-data-directly">The Buffer class is a global type for dealing with binary data directly</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">log</span><span class="token punctuation">(</span><span class="token punctuation">[</span>data<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token spread operator">...</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="prints-to-stdout-with-newline">Prints to stdout with newline</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">info</span><span class="token punctuation">(</span><span class="token punctuation">[</span>data<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token spread operator">...</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><blockquote>
<p>Same as console.log.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">error</span><span class="token punctuation">(</span><span class="token punctuation">[</span>data<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token spread operator">...</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="same-as-consolelog-but-prints-to-stderr">Same as console.log but prints to stderr</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">warn</span><span class="token punctuation">(</span><span class="token punctuation">[</span>data<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token spread operator">...</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="same-as-consoleerror">Same as console.error</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">dir</span><span class="token punctuation">(</span>obj<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="uses-utilinspect-on-obj-and-prints-resulting-string-to-stdout">Uses util.inspect on obj and prints resulting string to stdout</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">time</span><span class="token punctuation">(</span>label<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="mark-a-time">Mark a time</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">timeEnd</span><span class="token punctuation">(</span>label<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="finish-timer-record-output">Finish timer, record output</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">trace</span><span class="token punctuation">(</span>label<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="print-a-stack-trace-to-stderr-of-the-current-position">Print a stack trace to stderr of the current position</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">assert</span><span class="token punctuation">(</span>expression<span class="token punctuation">,</span> <span class="token punctuation">[</span>message<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="same-as-assertok-where-if-the-expression-evaluates-as-false-throw-an-assertionerror-with-message">Same as assert.ok() where if the expression evaluates as false throw an AssertionError with message</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">setTimeout</span><span class="token punctuation">(</span>callback<span class="token punctuation">,</span> delay<span class="token punctuation">,</span> <span class="token punctuation">[</span>arg<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token spread operator">...</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="to-schedule-execution-of-a-one-time-callback-after-delay-milliseconds-optionally-you-can-also-pass-arguments-to-the-callback">To schedule execution of a one-time callback after delay milliseconds. Optionally you can also pass arguments to the callback</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">clearTimeout</span><span class="token punctuation">(</span>t<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="stop-a-timer-that-was-previously-created-with-settimeout">Stop a timer that was previously created with setTimeout()</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">setInterval</span><span class="token punctuation">(</span>callback<span class="token punctuation">,</span> delay<span class="token punctuation">,</span> <span class="token punctuation">[</span>arg<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token spread operator">...</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="to-schedule-the-repeated-execution-of-callback-every-delay-milliseconds-optionally-you-can-also-pass-arguments-to-the-callback">To schedule the repeated execution of callback every delay milliseconds. Optionally you can also pass arguments to the callback</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">clearInterval</span><span class="token punctuation">(</span>t<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="stop-a-timer-that-was-previously-created-with-setinterval">Stop a timer that was previously created with setInterval()</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">setImmediate</span><span class="token punctuation">(</span>callback<span class="token punctuation">,</span> <span class="token punctuation">[</span>arg<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token spread operator">...</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="to-schedule-the-immediate-execution-of-callback-after-io-events-callbacks-and-before-settimeout-and-setinterval">To schedule the &quot;immediate&quot; execution of callback after I/O events callbacks and before setTimeout and setInterval</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">clearImmediate</span><span class="token punctuation">(</span>immediateObject<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="stop-a-timer-that-was-previously-created-with-setimmediate">Stop a timer that was previously created with setImmediate()</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">unref</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="allow-you-to-create-a-timer-that-is-active-but-if-it-is-the-only-item-left-in-the-event-loop-node-wont-keep-the-program-running">Allow you to create a timer that is active but if it is the only item left in the event loop, node won&apos;t keep the program running</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">ref</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="if-you-had-previously-unrefd-a-timer-you-can-call-ref-to-explicitly-request-the-timer-hold-the-program-open">If you had previously unref()d a timer you can call ref() to explicitly request the timer hold the program open</h3>
<blockquote>
<p>let module = require(&apos;./module.js&apos;);</p>
</blockquote>
<blockquote>
<p>Loads the module module.js in the same directory.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">module<span class="token punctuation">.</span><span class="token method function property-access">require</span><span class="token punctuation">(</span><span class="token string">&quot;./another_module.js&quot;</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="load-another_module-as-if-require-was-called-from-the-module-itself">load another_module as if require() was called from the module itself</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">module<span class="token punctuation">.</span><span class="token property-access">id</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="the-identifier-for-the-module-typically-this-is-the-fully-resolved-filename">The identifier for the module. Typically this is the fully resolved filename</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">module<span class="token punctuation">.</span><span class="token property-access">filename</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="the-fully-resolved-filename-to-the-module">The fully resolved filename to the module</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">module<span class="token punctuation">.</span><span class="token property-access">loaded</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="whether-or-not-the-module-is-done-loading-or-is-in-the-process-of-loading">Whether or not the module is done loading, or is in the process of loading</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">module<span class="token punctuation">.</span><span class="token property-access">parent</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="the-module-that-required-this-one">The module that required this one</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">module<span class="token punctuation">.</span><span class="token property-access">children</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="the-module-objects-required-by-this-one">The module objects required by this one</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">exports<span class="token punctuation">.</span><span class="token method-variable function-variable method function property-access">area</span> <span class="token operator">=</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token parameter">r</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
<span class="token keyword control-flow keyword-return">return</span> <span class="token known-class-name class-name">Math</span><span class="token punctuation">.</span><span class="token constant">PI</span> <span class="token operator">*</span> r <span class="token operator">*</span> r<span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="if-you-want-the-root-of-your-modules-export-to-be-a-function-such-as-a-constructor">If you want the root of your module&apos;s export to be a function (such as a constructor)</h3>
<blockquote>
<p>or if you want to export a complete object in one assignment instead of building it one property at a time,<br>
assign it to module.exports instead of exports.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">module<span class="token punctuation">.</span><span class="token method-variable function-variable method function property-access">exports</span> <span class="token operator">=</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token parameter">width</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
<span class="token keyword control-flow keyword-return">return</span> <span class="token punctuation">{</span>
<span class="token function-variable function">area</span><span class="token operator">:</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
<span class="token keyword control-flow keyword-return">return</span> width <span class="token operator">*</span> width<span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</pre><hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">&quot;exit&quot;</span><span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token parameter">code</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="emitted-when-the-process-is-about-to-exit">Emitted when the process is about to exit</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token operator">&gt;</span> process<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">&apos;uncaughtException&apos;</span><span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span><span class="token punctuation">(</span><span class="token parameter">err</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<blockquote>
<p>Emitted when an exception bubbles all the way back to the event loop. (should not be used)</p>
</blockquote>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token property-access">stdout</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="a-writable-stream-to-stdout">A writable stream to stdout</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token property-access">stderr</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="a-writable-stream-to-stderr">A writable stream to stderr</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token property-access">stdin</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="a-readable-stream-for-stdin">A readable stream for stdin</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token property-access">argv</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="an-array-containing-the-command-line-arguments">An array containing the command line arguments</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token property-access">env</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="an-object-containing-the-user-environment">An object containing the user environment</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token property-access">execPath</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="this-is-the-absolute-pathname-of-the-executable-that-started-the-process">This is the absolute pathname of the executable that started the process</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token property-access">execArgv</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="this-is-the-set-of-node-specific-command-line-options-from-the-executable-that-started-the-process">This is the set of node-specific command line options from the executable that started the process</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token property-access">arch</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="what-processor-architecture-youre-running-on-arm-ia32-or-x64">What processor architecture you&apos;re running on: &apos;arm&apos;, &apos;ia32&apos;, or &apos;x64&apos;</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token property-access">config</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="an-object-containing-the-javascript-representation-of-the-configure-options-that-were-used-to-compile-the-current-node-executable">An Object containing the JavaScript representation of the configure options that were used to compile the current node executable</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token property-access">pid</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="the-pid-of-the-process">The PID of the process</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token property-access">platform</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="what-platform-youre-running-on-darwin-freebsd-linux-sunos-or-win32">What platform you&apos;re running on: &apos;darwin&apos;, &apos;freebsd&apos;, &apos;linux&apos;, &apos;sunos&apos; or &apos;win32&apos;</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token property-access">title</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="gettersetter-to-set-what-is-displayed-in-ps">Getter/setter to set what is displayed in &apos;ps&apos;</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token property-access">version</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="a-compiled-in-property-t">A compiled-in property t</h3>
<blockquote>
<p>hat exposes NODE_VERSION.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token property-access">versions</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="a-property-exposing-version-strings-of-node-and-its-dependencies">A property exposing version strings of node and its dependencies</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token operator">&gt;</span> process<span class="token punctuation">.</span><span class="token method function property-access">abort</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="this-causes-node-to-emit-an-abort-this-will-cause-node-to-exit-and-generate-a-core-file">This causes node to emit an abort. This will cause node to exit and generate a core file</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token method function property-access">chdir</span><span class="token punctuation">(</span>dir<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="changes-the-current-working-directory-of-the-process-or-throws-an-exception-if-that-fails">Changes the current working directory of the process or throws an exception if that fails</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token method function property-access">cwd</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="returns-the-current-working-directory-of-the-process">Returns the current working directory of the process</h3>
<blockquote>
<p>?process.exit([code]);<br>
Ends the process with the specified code. If omitted, exit uses the &apos;success&apos; code 0.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token method function property-access">getgid</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="gets-the-group-identity-of-the-process">Gets the group identity of the process</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token method function property-access">setgid</span><span class="token punctuation">(</span>id<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="sets-the-group-identity-of-the-process">Sets the group identity of the process</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token method function property-access">getuid</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="gets-the-user-identity-of-the-process">Gets the user identity of the process</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token method function property-access">setuid</span><span class="token punctuation">(</span>id<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="sets-the-user-identity-of-the-process">Sets the user identity of the process</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token method function property-access">getgroups</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="returns-an-array-with-the-supplementary-group-ids">Returns an array with the supplementary group IDs</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token method function property-access">setgroups</span><span class="token punctuation">(</span>grps<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="sets-the-supplementary-group-ids">Sets the supplementary group IDs</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token method function property-access">initgroups</span><span class="token punctuation">(</span>user<span class="token punctuation">,</span> extra_grp<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="reads-etcgroup-and-initializes-the-group-access-list-using-all-groups-of-which-the-user-is-a-member">Reads /etc/group and initializes the group access list, using all groups of which the user is a member</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token method function property-access">kill</span><span class="token punctuation">(</span>pid<span class="token punctuation">,</span> <span class="token punctuation">[</span>signal<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="send-a-signal-to-a-process-pid-is-the-process-id-and-signal-is-the-string-describing-the-signal-to-send">Send a signal to a process. pid is the process id and signal is the string describing the signal to send</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token method function property-access">memoryUsage</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-an-object-describing-the-memory-usage-of-the-node-process-measured-in-bytes">Returns an object describing the memory usage of the Node process measured in bytes</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token method function property-access">nextTick</span><span class="token punctuation">(</span>callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="on-the-next-loop-around-the-event-loop-call-this-callback">On the next loop around the event loop call this callback</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token property-access">maxTickDepth</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="callbacks-passed-to-processnexttick-will-usually-be-called-at-the-end-of-the-current-flow-of-execution-and-are-thus-approximately-as-fast-as-calling-a-function-synchronously">Callbacks passed to process.nextTick will usually be called at the end of the current flow of execution, and are thus approximately as fast as calling a function synchronously</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token method function property-access">umask</span><span class="token punctuation">(</span><span class="token punctuation">[</span>mask<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="sets-or-reads-the-processs-file-mode-creation-mask">Sets or reads the process&apos;s file mode creation mask</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token method function property-access">uptime</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="number-of-seconds-node-has-been-running">Number of seconds Node has been running</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">process<span class="token punctuation">.</span><span class="token method function property-access">hrtime</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-the-current-high-resolution-real-time-in-a-seconds-nanoseconds-tuple-array">Returns the current high-resolution real time in a [seconds, nanoseconds] tuple Array</h3>
<blockquote>
<p>Node provides a tri-directional popen facility through the child_process module.</p>
</blockquote>
<blockquote>
<p>It is possible to stream data through a child&apos;s stdin, stdout, and stderr in a fully non-blocking way.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">ChildProcess</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="class-childprocess-is-an-eventemitter">Class. ChildProcess is an EventEmitter</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">child<span class="token punctuation">.</span><span class="token property-access">stdin</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="a-writable-stream-that-represents-the-child-processs-stdin">A Writable Stream that represents the child process&apos;s stdin</h3>
<blockquote>
<p>child.stdout;</p>
</blockquote>
<pre data-role="codeBlock" data-info class="language-"><code>
---
### A Readable Stream that represents the child process&apos;s stdout
child.stderr;
</code></pre><hr>
<h3 class="mume-header" id="a-readable-stream-that-represents-the-child-processs-stderr">A Readable Stream that represents the child process&apos;s stderr</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">child<span class="token punctuation">.</span><span class="token property-access">pid</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="the-pid-of-the-child-process">The PID of the child process</h3>
<blockquote>
<p>child.connected;</p>
</blockquote>
<pre data-role="codeBlock" data-info class="language-"><code>
---
### If .connected is false, it is no longer possible to send messages
child.kill([signal]);
</code></pre><hr>
<h3 class="mume-header" id="send-a-signal-to-the-child-process">Send a signal to the child process</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token operator">&gt;</span> child<span class="token punctuation">.</span><span class="token method function property-access">send</span><span class="token punctuation">(</span>message<span class="token punctuation">,</span> <span class="token punctuation">[</span>sendHandle<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="when-using-child_processfork-you-can-write-to-the-child-using-childsendmessage-sendhandle-and-messages-are-received-by-a-message-event-on-the-child">When using child_process.fork() you can write to the child using child.send(message, [sendHandle]) and messages are received by a &apos;message&apos; event on the child</h3>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">child<span class="token punctuation">.</span><span class="token method function property-access">disconnect</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="close-the-ipc-channel-between-parent-and-child-allowing-the-child-to-exit-gracefully-once-there-are-no-other-connections-keeping-it-alive">Close the IPC channel between parent and child, allowing the child to exit gracefully once there are no other connections keeping it alive</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">child_process<span class="token punctuation">.</span><span class="token method function property-access">spawn</span><span class="token punctuation">(</span>command<span class="token punctuation">,</span> <span class="token punctuation">[</span>args<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>options<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="launches-a-new-process-with-the-given-command-with-command-line-arguments-in-args-if-omitted-args-defaults-to-an-empty-array">Launches a new process with the given command, with command line arguments in args. If omitted, args defaults to an empty Array</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">child_process<span class="token punctuation">.</span><span class="token method function property-access">exec</span><span class="token punctuation">(</span>command<span class="token punctuation">,</span> <span class="token punctuation">[</span>options<span class="token punctuation">]</span><span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="runs-a-command-in-a-shell-and-buffers-the-output">Runs a command in a shell and buffers the output</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">child_process<span class="token punctuation">.</span><span class="token method function property-access">execFile</span><span class="token punctuation">(</span>file<span class="token punctuation">,</span> <span class="token punctuation">[</span>args<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>options<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>callback<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="runs-a-command-in-a-shell-and-buffers-the-output-1">Runs a command in a shell and buffers the output</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">child_process<span class="token punctuation">.</span><span class="token method function property-access">fork</span><span class="token punctuation">(</span>modulePath<span class="token punctuation">,</span> <span class="token punctuation">[</span>args<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>options<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="this-is-a-special-case-of-the-spawn-functionality-for-spawning-node-processes-in-addition-to-having-all-the-methods-in-a-normal-childprocess-instance-the-returned-object-has-a-communication-channel-built-in">This is a special case of the spawn() functionality for spawning Node processes. In addition to having all the methods in a normal ChildProcess instance, the returned object has a communication channel built-in</h3>
<blockquote>
<p>These functions are in the module &apos;util&apos;. Use require(&apos;util&apos;) to access them.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">util<span class="token punctuation">.</span><span class="token method function property-access">format</span><span class="token punctuation">(</span>format<span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token spread operator">...</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-a-formatted-string-using-the-first-argument-as-a-printf-like-format-s-d-j">Returns a formatted string using the first argument as a printf-like format. (%s, %d, %j)</h3>
<blockquote>
<p>util.debug(string);</p>
</blockquote>
<hr>
<hr>
<h3 class="mume-header" id="a-synchronous-output-function-will-block-the-process-and-output-string-immediately-to-stderr">A synchronous output function. Will block the process and output string immediately to stderr</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">util<span class="token punctuation">.</span><span class="token method function property-access">error</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token spread operator">...</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="same-as-utildebug-except-this-will-output-all-arguments-immediately-to-stderr">Same as util.debug() except this will output all arguments immediately to stderr</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">util<span class="token punctuation">.</span><span class="token method function property-access">puts</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token spread operator">...</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="a-synchronous-output-function-will-block-the-process-and-output-all-arguments-to-stdout-with-newlines-after-each-argument">A synchronous output function. Will block the process and output all arguments to stdout with newlines after each argument</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">util<span class="token punctuation">.</span><span class="token method function property-access">print</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token spread operator">...</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="a-synchronous-output-function-will-block-the-process-cast-each-argument-to-a-string-then-output-to-stdout-no-newlines">A synchronous output function. Will block the process, cast each argument to a string then output to stdout. (no newlines)</h3>
<blockquote>
<p>util.log(string);</p>
</blockquote>
<blockquote>
<p>Output with timestamp on stdout.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">util<span class="token punctuation">.</span><span class="token method function property-access">inspect</span><span class="token punctuation">(</span>object<span class="token punctuation">,</span> <span class="token punctuation">[</span>opts<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="return-a-string-representation-of-object-which-is-useful-for-debugging-options-showhidden-depth-colors-custominspect">Return a string representation of object, which is useful for debugging. (options: showHidden, depth, colors, customInspect)</h3>
<blockquote>
<p>util.isArray(object);</p>
</blockquote>
<blockquote>
<p>Returns true if the given &quot;object&quot; is an Array. false otherwise.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">util<span class="token punctuation">.</span><span class="token method function property-access">isRegExp</span><span class="token punctuation">(</span>object<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-true-if-the-given-object-is-a-regexp-false-otherwise">Returns true if the given &quot;object&quot; is a RegExp. false otherwise</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">util<span class="token punctuation">.</span><span class="token method function property-access">isDate</span><span class="token punctuation">(</span>object<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-true-if-the-given-object-is-a-date-false-otherwise">Returns true if the given &quot;object&quot; is a Date. false otherwise</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">util<span class="token punctuation">.</span><span class="token method function property-access">isError</span><span class="token punctuation">(</span>object<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-true-if-the-given-object-is-an-error-false-otherwise">Returns true if the given &quot;object&quot; is an Error. false otherwise</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">util<span class="token punctuation">.</span><span class="token method function property-access">promisify</span><span class="token punctuation">(</span>fn<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="takes-a-function-whose-last-argument-is-a-callback-and-returns-a-version-that-returns-promises">Takes a function whose last argument is a callback and returns a version that returns promises</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">util<span class="token punctuation">.</span><span class="token method function property-access">inherits</span><span class="token punctuation">(</span>constructor<span class="token punctuation">,</span> superConstructor<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="inherit-the-prototype-methods-from-one-constructor-into-another">Inherit the prototype methods from one constructor into another</h3>
<hr>
<h1 class="mume-header" id="events">EVENTS</h1>
<blockquote>
<p>All objects which emit events are instances of events.EventEmitter. You can access this module by doing: require(&quot;events&quot;);</p>
</blockquote>
<hr>
<h3 class="mume-header" id="to-access-the-eventemitter-class-requireeventseventemitter">To access the EventEmitter class, require(&apos;events&apos;).EventEmitter</h3>
<blockquote>
<p>All EventEmitters emit the event &apos;newListener&apos; when new listeners are added and &apos;removeListener&apos; when a listener is removed.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">emitter<span class="token punctuation">.</span><span class="token method function property-access">addListener</span><span class="token punctuation">(</span>event<span class="token punctuation">,</span> listener<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="adds-a-listener-to-the-end-of-the-listeners-array-for-the-specified-event">Adds a listener to the end of the listeners array for the specified event</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">emitter<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span>event<span class="token punctuation">,</span> listener<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="same-as-emitteraddlistener">Same as emitter.addListener()</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">emitter<span class="token punctuation">.</span><span class="token method function property-access">once</span><span class="token punctuation">(</span>event<span class="token punctuation">,</span> listener<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><blockquote>
<p>Adds a one time listener for the event. This listener is invoked only the next time the event is fired, after which it is removed.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">emitter<span class="token punctuation">.</span><span class="token method function property-access">removeListener</span><span class="token punctuation">(</span>event<span class="token punctuation">,</span> listener<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="remove-a-listener-from-the-listener-array-for-the-specified-event">Remove a listener from the listener array for the specified event</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">emitter<span class="token punctuation">.</span><span class="token method function property-access">removeAllListeners</span><span class="token punctuation">(</span><span class="token punctuation">[</span>event<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="removes-all-listeners-or-those-of-the-specified-event">Removes all listeners, or those of the specified event</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">emitter<span class="token punctuation">.</span><span class="token method function property-access">setMaxListeners</span><span class="token punctuation">(</span>n<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="by-default-eventemitters-will-print-a-warning-if-more-than-10-listeners-are-added-for-a-particular-event">By default EventEmitters will print a warning if more than 10 listeners are added for a particular event</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">emitter<span class="token punctuation">.</span><span class="token method function property-access">listeners</span><span class="token punctuation">(</span>event<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-an-array-of-listeners-for-the-specified-event">Returns an array of listeners for the specified event</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">emitter<span class="token punctuation">.</span><span class="token method function property-access">emit</span><span class="token punctuation">(</span>event<span class="token punctuation">,</span> <span class="token punctuation">[</span>arg1<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>arg2<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token spread operator">...</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="execute-each-of-the-listeners-in-order-with-the-supplied-arguments-returns-true-if-event-had-listeners-false-otherwise">Execute each of the listeners in order with the supplied arguments. Returns true if event had listeners, false otherwise</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">EventEmitter</span><span class="token punctuation">.</span><span class="token method function property-access">listenerCount</span><span class="token punctuation">(</span>emitter<span class="token punctuation">,</span> event<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="return-the-number-of-listeners-for-a-given-event">Return the number of listeners for a given event</h3>
<blockquote>
<p>A stream is an abstract interface implemented by various objects in Node. For example a request to an HTTP server is a stream, as is stdout.</p>
</blockquote>
<blockquote>
<p>Streams are readable, writable, or both. All streams are instances of EventEmitter.</p>
</blockquote>
<blockquote>
<p>The Readable stream interface is the abstraction for a source of data that you are reading from.</p>
</blockquote>
<blockquote>
<p>In other words, data comes out of a Readable stream.</p>
</blockquote>
<blockquote>
<p>A Readable stream will not start emitting data until you indicate that you are ready to receive it.</p>
</blockquote>
<blockquote>
<p>Examples of readable streams include: http responses on the client, http requests on the server, fs read streams<br>
zlib streams, crypto streams, tcp sockets, child process stdout and stderr, process.stdin.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token keyword keyword-let">let</span> readable <span class="token operator">=</span> <span class="token function">getReadableStreamSomehow</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
readable<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">&quot;readable&quot;</span><span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="when-a-chunk-of-data-can-be-read-from-the-stream-it-will-emit-a-readable-event">When a chunk of data can be read from the stream, it will emit a &apos;readable&apos; event</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">readable<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">&quot;data&quot;</span><span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token parameter">chunk</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="if-you-attach-a-data-event-listener-then-it-will-switch-the-stream-into-flowing-mode-and-data-will-be-passed-to-your-handler-as-soon-as-it-is-available">If you attach a data event listener, then it will switch the stream into flowing mode, and data will be passed to your handler as soon as it is available</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">readable<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">&quot;end&quot;</span><span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="this-event-fires-when-there-will-be-no-more-data-to-read">This event fires when there will be no more data to read</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">readable<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">&quot;close&quot;</span><span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="emitted-when-the-underlying-resource-for-example-the-backing-file-descriptor-has-been-closed-not-all-streams-will-emit-this">Emitted when the underlying resource (for example, the backing file descriptor) has been closed. Not all streams will emit this</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">readable<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">&quot;error&quot;</span><span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="emitted-if-there-was-an-error-receiving-data">Emitted if there was an error receiving data</h3>
<blockquote>
<p>The read() method pulls some data out of the internal buffer and returns it. If there is no data available, then it will return null.</p>
</blockquote>
<blockquote>
<p>This method should only be called in non-flowing mode. In flowing-mode, this method is called automatically until the internal buffer is drained.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">readable<span class="token punctuation">.</span><span class="token method function property-access">read</span><span class="token punctuation">(</span><span class="token punctuation">[</span>size<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
readable<span class="token punctuation">.</span><span class="token method function property-access">setEncoding</span><span class="token punctuation">(</span>encoding<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="call-this-function-to-cause-the-stream-to-return-strings-of-the-specified-encoding-instead-of-buffer-objects">Call this function to cause the stream to return strings of the specified encoding instead of Buffer objects</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">readable<span class="token punctuation">.</span><span class="token method function property-access">resume</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="this-method-will-cause-the-readable-stream-to-resume-emitting-data-events">This method will cause the readable stream to resume emitting data events</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">readable<span class="token punctuation">.</span><span class="token method function property-access">pause</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="this-method-will-cause-a-stream-in-flowing-mode-to-stop-emitting-data-events">This method will cause a stream in flowing-mode to stop emitting data events</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">readable<span class="token punctuation">.</span><span class="token method function property-access">pipe</span><span class="token punctuation">(</span>destination<span class="token punctuation">,</span> <span class="token punctuation">[</span>options<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="this-method-pulls-all-the-data-out-of-a-readable-stream-and-writes-it-to-the-supplied-destination-automatically-managing-the-flow-so-that-the-destination-is-not-overwhelmed-by-a-fast-readable-stream">This method pulls all the data out of a readable stream, and writes it to the supplied destination, automatically managing the flow so that the destination is not overwhelmed by a fast readable stream</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">readable<span class="token punctuation">.</span><span class="token method function property-access">unpipe</span><span class="token punctuation">(</span><span class="token punctuation">[</span>destination<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="this-method-will-remove-the-hooks-set-up-for-a-previous-pipe-call-if-the-destination-is-not-specified-then-all-pipes-are-removed">This method will remove the hooks set up for a previous pipe() call. If the destination is not specified, then all pipes are removed</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">readable<span class="token punctuation">.</span><span class="token method function property-access">unshift</span><span class="token punctuation">(</span>chunk<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="this-is-useful-in-certain-cases-where-a-stream-is-being-consumed-by-a-parser-which-needs-to-un-consume-some-data-that-it-has-optimistically-pulled-out-of-the-source-so-that-the-stream-can-be-passed-on-to-some-other-party">This is useful in certain cases where a stream is being consumed by a parser, which needs to &quot;un-consume&quot; some data that it has optimistically pulled out of the source, so that the stream can be passed on to some other party</h3>
<blockquote>
<p>The Writable stream interface is an abstraction for a destination that you are writing data to.</p>
</blockquote>
<blockquote>
<p>Examples of writable streams include: http requests on the client, http responses on the server, fs write streams,<br>
zlib streams, crypto streams, tcp sockets, child process stdin, process.stdout, process.stderr.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token keyword keyword-let">let</span> writer <span class="token operator">=</span> <span class="token function">getWritableStreamSomehow</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
writable<span class="token punctuation">.</span><span class="token method function property-access">write</span><span class="token punctuation">(</span>chunk<span class="token punctuation">,</span> <span class="token punctuation">[</span>encoding<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>callback<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="this-method-writes-some-data-to-the-underlying-system-and-calls-the-supplied-callback-once-the-data-has-been-fully-handled">This method writes some data to the underlying system, and calls the supplied callback once the data has been fully handled</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">writer<span class="token punctuation">.</span><span class="token method function property-access">once</span><span class="token punctuation">(</span><span class="token string">&quot;drain&quot;</span><span class="token punctuation">,</span> write<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="if-a-writablewritechunk-call-returns-false-then-the-drain-event-will-indicate-when-it-is-appropriate-to-begin-writing-more-data-to-the-stream">If a writable.write(chunk) call returns false, then the drain event will indicate when it is appropriate to begin writing more data to the stream</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">writable<span class="token punctuation">.</span><span class="token method function property-access">end</span><span class="token punctuation">(</span><span class="token punctuation">[</span>chunk<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>encoding<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>callback<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="call-this-method-when-no-more-data-will-be-written-to-the-stream">Call this method when no more data will be written to the stream</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">writer<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">&quot;finish&quot;</span><span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="when-the-end-method-has-been-called-and-all-data-has-been-flushed-to-the-underlying-system-this-event-is-emitted">When the end() method has been called, and all data has been flushed to the underlying system, this event is emitted</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">writer<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">&quot;pipe&quot;</span><span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token parameter">src</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="this-is-emitted-whenever-the-pipe-method-is-called-on-a-readable-stream-adding-this-writable-to-its-set-of-destinations">This is emitted whenever the pipe() method is called on a readable stream, adding this writable to its set of destinations</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">writer<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">&quot;unpipe&quot;</span><span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token parameter">src</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="this-is-emitted-whenever-the-unpipe-method-is-called-on-a-readable-stream-removing-this-writable-from-its-set-of-destinations">This is emitted whenever the unpipe() method is called on a readable stream, removing this writable from its set of destinations</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">writer<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">&quot;error&quot;</span><span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token parameter">src</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="emitted-if-there-was-an-error-when-writing-or-piping-data">Emitted if there was an error when writing or piping data</h3>
<blockquote>
<p>Duplex streams are streams that implement both the Readable and Writable interfaces. See above for usage.</p>
</blockquote>
<blockquote>
<p>Examples of Duplex streams include: tcp sockets, zlib streams, crypto streams.</p>
</blockquote>
<blockquote>
<p>Transform streams are Duplex streams where the output is in some way computed from the input. They implement both the Readable and Writable interfaces. See above for usage.</p>
</blockquote>
<blockquote>
<p>Examples of Transform streams include: zlib streams, crypto streams.</p>
</blockquote>
<hr>
<hr>
<hr>
<hr>
<h1 class="mume-header" id="to-use-this-module-do-requirefs">To use this module do require(&apos;fs&apos;)</h1>
<blockquote>
<p>All the methods have asynchronous and synchronous forms.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">rename</span><span class="token punctuation">(</span>oldPath<span class="token punctuation">,</span> newPath<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="asynchronous-rename-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callbackasynchronous-ftruncate-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous rename. No arguments other than a possible exception are given to the completion callback.Asynchronous ftruncate. No arguments other than a possible exception are given to the completion callback</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">renameSync</span><span class="token punctuation">(</span>oldPath<span class="token punctuation">,</span> newPath<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="synchronous-rename">Synchronous rename</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">ftruncate</span><span class="token punctuation">(</span>fd<span class="token punctuation">,</span> len<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="asynchronous-ftruncate-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous ftruncate. No arguments other than a possible exception are given to the completion callback</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">ftruncateSync</span><span class="token punctuation">(</span>fd<span class="token punctuation">,</span> len<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="synchronous-ftruncate">Synchronous ftruncate</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">truncate</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> len<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="asynchronous-truncate-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous truncate. No arguments other than a possible exception are given to the completion callback</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">truncateSync</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> len<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="synchronous-truncate">Synchronous truncate</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">chown</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> uid<span class="token punctuation">,</span> gid<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="asynchronous-chown-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous chown. No arguments other than a possible exception are given to the completion callback</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">chownSync</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> uid<span class="token punctuation">,</span> gid<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="synchronous-chown">Synchronous chown</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">fchown</span><span class="token punctuation">(</span>fd<span class="token punctuation">,</span> uid<span class="token punctuation">,</span> gid<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="asynchronous-fchown-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous fchown. No arguments other than a possible exception are given to the completion callback</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">fchownSync</span><span class="token punctuation">(</span>fd<span class="token punctuation">,</span> uid<span class="token punctuation">,</span> gid<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="synchronous-fchown">Synchronous fchown</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">lchown</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> uid<span class="token punctuation">,</span> gid<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="asynchronous-lchown-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous lchown. No arguments other than a possible exception are given to the completion callback</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">lchownSync</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> uid<span class="token punctuation">,</span> gid<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="synchronous-lchown">Synchronous lchown</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">chmod</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> mode<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="asynchronous-chmod-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous chmod. No arguments other than a possible exception are given to the completion callback</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">chmodSync</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> mode<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="synchronous-chmod">Synchronous chmod</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">fchmod</span><span class="token punctuation">(</span>fd<span class="token punctuation">,</span> mode<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="asynchronous-fchmod-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous fchmod. No arguments other than a possible exception are given to the completion callback</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">fchmodSync</span><span class="token punctuation">(</span>fd<span class="token punctuation">,</span> mode<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="synchronous-fchmod">Synchronous fchmod</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">lchmod</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> mode<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="asynchronous-lchmod-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous lchmod. No arguments other than a possible exception are given to the completion callback</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">lchmodSync</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> mode<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="synchronous-lchmod">Synchronous lchmod</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">stat</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="asynchronous-stat-the-callback-gets-two-arguments-err-stats-where-stats-is-a-fsstats-object">Asynchronous stat. The callback gets two arguments (err, stats) where stats is a fs.Stats object</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">statSync</span><span class="token punctuation">(</span>path<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="synchronous-stat-returns-an-instance-of-fsstats">Synchronous stat. Returns an instance of fs.Stats</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">lstat</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="asynchronous-lstat-the-callback-gets-two-arguments-err-stats-where-stats-is-a-fsstats-object-lstat-is-identical-to-stat-except-that-if-path-is-a-symbolic-link-then-the-link-itself-is-stat-ed-not-the-file-that-it-refers-to">Asynchronous lstat. The callback gets two arguments (err, stats) where stats is a fs.Stats object. lstat() is identical to stat(), except that if path is a symbolic link, then the link itself is stat-ed, not the file that it refers to</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">lstatSync</span><span class="token punctuation">(</span>path<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="synchronous-lstat-returns-an-instance-of-fsstats">Synchronous lstat. Returns an instance of fs.Stats</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">fstat</span><span class="token punctuation">(</span>fd<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="asynchronous-fstat-the-callback-gets-two-arguments-err-stats-where-stats-is-a-fsstats-object-fstat-is-identical-to-stat-except-that-the-file-to-be-stat-ed-is-specified-by-the-file-descriptor-fd">Asynchronous fstat. The callback gets two arguments (err, stats) where stats is a fs.Stats object. fstat() is identical to stat(), except that the file to be stat-ed is specified by the file descriptor fd</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">fstatSync</span><span class="token punctuation">(</span>fd<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="synchronous-fstat-returns-an-instance-of-fsstats">Synchronous fstat. Returns an instance of fs.Stats</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">link</span><span class="token punctuation">(</span>srcpath<span class="token punctuation">,</span> dstpath<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="asynchronous-link-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous link. No arguments other than a possible exception are given to the completion callback</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">linkSync</span><span class="token punctuation">(</span>srcpath<span class="token punctuation">,</span> dstpath<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="synchronous-link">Synchronous link</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">symlink</span><span class="token punctuation">(</span>srcpath<span class="token punctuation">,</span> dstpath<span class="token punctuation">,</span> <span class="token punctuation">[</span>type<span class="token punctuation">]</span><span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="asynchronous-symlink-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback-the-type-argument-can-be-set-to-dir-file-or-junction-default-is-file-and-is-only-available-on-windows-ignored-on-other-platforms">Asynchronous symlink. No arguments other than a possible exception are given to the completion callback. The type argument can be set to &apos;dir&apos;, &apos;file&apos;, or &apos;junction&apos; (default is &apos;file&apos;) and is only available on Windows (ignored on other platforms)</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">symlinkSync</span><span class="token punctuation">(</span>srcpath<span class="token punctuation">,</span> dstpath<span class="token punctuation">,</span> <span class="token punctuation">[</span>type<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="synchronous-symlink">Synchronous symlink</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">readlink</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="asynchronous-readlink-the-callback-gets-two-arguments-err-linkstring">Asynchronous readlink. The callback gets two arguments (err, linkString)</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">readlinkSync</span><span class="token punctuation">(</span>path<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="synchronous-readlink-returns-the-symbolic-links-string-value">Synchronous readlink. Returns the symbolic link&apos;s string value</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">unlink</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="asynchronous-unlink-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous unlink. No arguments other than a possible exception are given to the completion callback</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">unlinkSync</span><span class="token punctuation">(</span>path<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="synchronous-unlink">Synchronous unlink</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">realpath</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> <span class="token punctuation">[</span>cache<span class="token punctuation">]</span><span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="asynchronous-realpath-the-callback-gets-two-arguments-err-resolvedpath">Asynchronous realpath. The callback gets two arguments (err, resolvedPath)</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">realpathSync</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> <span class="token punctuation">[</span>cache<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h1 class="mume-header" id="synchronous-realpath-returns-the-resolved-path">Synchronous realpath. Returns the resolved path</h1>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">rmdir</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="asynchronous-rmdir-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous rmdir. No arguments other than a possible exception are given to the completion callback</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">rmdirSync</span><span class="token punctuation">(</span>path<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="synchronous-rmdir">Synchronous rmdir</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">mkdir</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> <span class="token punctuation">[</span>mode<span class="token punctuation">]</span><span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="asynchronous-mkdir-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback-mode-defaults-to-0777">Asynchronous mkdir. No arguments other than a possible exception are given to the completion callback. mode defaults to 0777</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">mkdirSync</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> <span class="token punctuation">[</span>mode<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="synchronous-mkdir">Synchronous mkdir</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">readdir</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="asynchronous-readdir-reads-the-contents-of-a-directory-the-callback-gets-two-arguments-err-files-where-files-is-an-array-of-the-names-of-the-files-in-the-directory-excluding-and">Asynchronous readdir. Reads the contents of a directory. The callback gets two arguments (err, files) where files is an array of the names of the files in the directory excluding &apos;.&apos; and &apos;..&apos;</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">readdirSync</span><span class="token punctuation">(</span>path<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="synchronous-readdir-returns-an-array-of-filenames-excluding-and">Synchronous readdir. Returns an array of filenames excluding &apos;.&apos; and &apos;..&apos;</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">close</span><span class="token punctuation">(</span>fd<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="asynchronous-close-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous close. No arguments other than a possible exception are given to the completion callback</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">closeSync</span><span class="token punctuation">(</span>fd<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="synchronous-close">Synchronous close</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">open</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> flags<span class="token punctuation">,</span> <span class="token punctuation">[</span>mode<span class="token punctuation">]</span><span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="asynchronous-file-open">Asynchronous file open</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">openSync</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> flags<span class="token punctuation">,</span> <span class="token punctuation">[</span>mode<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="synchronous-version-of-fsopen">Synchronous version of fs.open()</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">utimes</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> atime<span class="token punctuation">,</span> mtime<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="change-file-timestamps-of-the-file-referenced-by-the-supplied-path">Change file timestamps of the file referenced by the supplied path</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">utimesSync</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> atime<span class="token punctuation">,</span> mtime<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="synchronous-version-of-fsutimes">Synchronous version of fs.utimes()</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">futimes</span><span class="token punctuation">(</span>fd<span class="token punctuation">,</span> atime<span class="token punctuation">,</span> mtime<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="change-the-file-timestamps-of-a-file-referenced-by-the-supplied-file-descriptor">Change the file timestamps of a file referenced by the supplied file descriptor</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">futimesSync</span><span class="token punctuation">(</span>fd<span class="token punctuation">,</span> atime<span class="token punctuation">,</span> mtime<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="synchronous-version-of-fsfutimes">Synchronous version of fs.futimes()</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">fsync</span><span class="token punctuation">(</span>fd<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="asynchronous-fsync-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous fsync. No arguments other than a possible exception are given to the completion callback</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">fsyncSync</span><span class="token punctuation">(</span>fd<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="synchronous-fsync">Synchronous fsync</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">write</span><span class="token punctuation">(</span>fd<span class="token punctuation">,</span> buffer<span class="token punctuation">,</span> offset<span class="token punctuation">,</span> length<span class="token punctuation">,</span> position<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="write-buffer-to-the-file-specified-by-fd">Write buffer to the file specified by fd</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">writeSync</span><span class="token punctuation">(</span>fd<span class="token punctuation">,</span> buffer<span class="token punctuation">,</span> offset<span class="token punctuation">,</span> length<span class="token punctuation">,</span> position<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="synchronous-version-of-fswrite-returns-the-number-of-bytes-written">Synchronous version of fs.write(). Returns the number of bytes written</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">read</span><span class="token punctuation">(</span>fd<span class="token punctuation">,</span> buffer<span class="token punctuation">,</span> offset<span class="token punctuation">,</span> length<span class="token punctuation">,</span> position<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="read-data-from-the-file-specified-by-fd">Read data from the file specified by fd</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">readSync</span><span class="token punctuation">(</span>fd<span class="token punctuation">,</span> buffer<span class="token punctuation">,</span> offset<span class="token punctuation">,</span> length<span class="token punctuation">,</span> position<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="synchronous-version-of-fsread-returns-the-number-of-bytesread">Synchronous version of fs.read. Returns the number of bytesRead</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">readFile</span><span class="token punctuation">(</span>filename<span class="token punctuation">,</span> <span class="token punctuation">[</span>options<span class="token punctuation">]</span><span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="asynchronously-reads-the-entire-contents-of-a-file">Asynchronously reads the entire contents of a file</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">readFileSync</span><span class="token punctuation">(</span>filename<span class="token punctuation">,</span> <span class="token punctuation">[</span>options<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="synchronous-version-of-fsreadfile-returns-the-contents-of-the-filename-if-the-encoding-option-is-specified-then-this-function-returns-a-string-otherwise-it-returns-a-buffer">Synchronous version of fs.readFile. Returns the contents of the filename. If the encoding option is specified then this function returns a string. Otherwise it returns a buffer</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">writeFile</span><span class="token punctuation">(</span>filename<span class="token punctuation">,</span> data<span class="token punctuation">,</span> <span class="token punctuation">[</span>options<span class="token punctuation">]</span><span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="asynchronously-writes-data-to-a-file-replacing-the-file-if-it-already-exists-data-can-be-a-string-or-a-buffer">Asynchronously writes data to a file, replacing the file if it already exists. data can be a string or a buffer</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">writeFileSync</span><span class="token punctuation">(</span>filename<span class="token punctuation">,</span> data<span class="token punctuation">,</span> <span class="token punctuation">[</span>options<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="the-synchronous-version-of-fswritefile">The synchronous version of fs.writeFile</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">appendFile</span><span class="token punctuation">(</span>filename<span class="token punctuation">,</span> data<span class="token punctuation">,</span> <span class="token punctuation">[</span>options<span class="token punctuation">]</span><span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="asynchronously-append-data-to-a-file-creating-the-file-if-it-not-yet-exists-data-can-be-a-string-or-a-buffer">Asynchronously append data to a file, creating the file if it not yet exists. data can be a string or a buffer</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">appendFileSync</span><span class="token punctuation">(</span>filename<span class="token punctuation">,</span> data<span class="token punctuation">,</span> <span class="token punctuation">[</span>options<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="the-synchronous-version-of-fsappendfile">The synchronous version of fs.appendFile</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">watch</span><span class="token punctuation">(</span>filename<span class="token punctuation">,</span> <span class="token punctuation">[</span>options<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>listener<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="watch-for-changes-on-filename-where-filename-is-either-a-file-or-a-directory-the-returned-object-is-a-fsfswatcher-the-listener-callback-gets-two-arguments-event-filename-event-is-either-rename-or-change-and-filename-is-the-name-of-the-file-which-triggered-the-event">Watch for changes on filename, where filename is either a file or a directory. The returned object is a fs.FSWatcher. The listener callback gets two arguments (event, filename). event is either &apos;rename&apos; or &apos;change&apos;, and filename is the name of the file which triggered the event</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">exists</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="test-whether-or-not-the-given-path-exists-by-checking-with-the-file-system-then-call-the-callback-argument-with-either-true-or-false-should-not-be-used">Test whether or not the given path exists by checking with the file system. Then call the callback argument with either true or false. (should not be used)</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token operator">&gt;</span> fs<span class="token punctuation">.</span><span class="token method function property-access">existsSync</span><span class="token punctuation">(</span>path<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><blockquote>
<p>Synchronous version of fs.exists. (should not be used)<br>
fs.Stats: objects returned from fs.stat(), fs.lstat() and fs.fstat() and their synchronous counterparts are of this type.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">stats<span class="token punctuation">.</span><span class="token method function property-access">isFile</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
stats<span class="token punctuation">.</span><span class="token method function property-access">isDirectory</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
stats<span class="token punctuation">.</span><span class="token method function property-access">isBlockDevice</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
stats<span class="token punctuation">.</span><span class="token method function property-access">isCharacterDevice</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
stats<span class="token punctuation">.</span><span class="token method function property-access">isSymbolicLink</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
<span class="token operator">&gt;</span> <span class="token punctuation">(</span>only valid <span class="token keyword keyword-with">with</span> fs<span class="token punctuation">.</span><span class="token method function property-access">lstat</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">)</span>
stats<span class="token punctuation">.</span><span class="token method function property-access">isFIFO</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
stats<span class="token punctuation">.</span><span class="token method function property-access">isSocket</span><span class="token punctuation">(</span><span class="token punctuation">)</span>
fs<span class="token punctuation">.</span><span class="token method function property-access">createReadStream</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> <span class="token punctuation">[</span>options<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-a-new-readstream-object">Returns a new ReadStream object</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">fs<span class="token punctuation">.</span><span class="token method function property-access">createWriteStream</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> <span class="token punctuation">[</span>options<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="returns-a-new-writestream-object">Returns a new WriteStream object</h3>
<blockquote>
<p>Use require(&apos;path&apos;) to use this module.</p>
</blockquote>
<blockquote>
<p>This module contains utilities for handling and transforming file paths.</p>
</blockquote>
<blockquote>
<p>Almost all these methods perform only string transformations.</p>
</blockquote>
<blockquote>
<p>The file system is not consulted to check whether paths are valid.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">path<span class="token punctuation">.</span><span class="token method function property-access">normalize</span><span class="token punctuation">(</span>p<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="normalize-a-string-path-taking-care-of-and-parts">Normalize a string path, taking care of &apos;..&apos; and &apos;.&apos; parts</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">path<span class="token punctuation">.</span><span class="token method function property-access">join</span><span class="token punctuation">(</span><span class="token punctuation">[</span>path1<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>path2<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token spread operator">...</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="join-all-arguments-together-and-normalize-the-resulting-path">Join all arguments together and normalize the resulting path</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">path<span class="token punctuation">.</span><span class="token method function property-access">resolve</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token keyword module keyword-from">from</span> <span class="token spread operator">...</span><span class="token punctuation">]</span><span class="token punctuation">,</span> to<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="resolves-to-to-an-absolute-path">Resolves &apos;to&apos; to an absolute path</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">path<span class="token punctuation">.</span><span class="token method function property-access">relative</span><span class="token punctuation">(</span><span class="token keyword module keyword-from">from</span><span class="token punctuation">,</span> to<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="solve-the-relative-path-from-from-to-to">Solve the relative path from &apos;from&apos; to &apos;to&apos;</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">path<span class="token punctuation">.</span><span class="token method function property-access">dirname</span><span class="token punctuation">(</span>p<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="return-the-directory-name-of-a-path-similar-to-the-unix-dirname-command">Return the directory name of a path. Similar to the Unix dirname command</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">path<span class="token punctuation">.</span><span class="token method function property-access">basename</span><span class="token punctuation">(</span>p<span class="token punctuation">,</span> <span class="token punctuation">[</span>ext<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><blockquote>
<p>Return the last portion of a path. Similar to the Unix basename command.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">path<span class="token punctuation">.</span><span class="token method function property-access">extname</span><span class="token punctuation">(</span>p<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="return-the-extension-of-the-path-from-the-last-to-end-of-string-in-the-last-portion-of-the-path">Return the extension of the path, from the last &apos;.&apos; to end of string in the last portion of the path</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">path<span class="token punctuation">.</span><span class="token property-access">sep</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="the-platform-specific-file-separator-or">The platform-specific file separator. &apos;\&apos; or &apos;/&apos;</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">path<span class="token punctuation">.</span><span class="token property-access">delimiter</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="the-platform-specific-path-delimiter-or">The platform-specific path delimiter, &apos;;&apos; or &apos;:&apos;</h3>
<blockquote>
<p>To use the HTTP server and client one must require(&apos;http&apos;).</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">http<span class="token punctuation">.</span><span class="token constant">STATUS_CODES</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="a-collection-of-all-the-standard-http-response-status-codes-and-the-short-description-of-each">A collection of all the standard HTTP response status codes, and the short description of each</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">http<span class="token punctuation">.</span><span class="token method function property-access">request</span><span class="token punctuation">(</span>options<span class="token punctuation">,</span> <span class="token punctuation">[</span>callback<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<blockquote>
<p>This function allows one to transparently issue requests.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">http<span class="token punctuation">.</span><span class="token method function property-access">get</span><span class="token punctuation">(</span>options<span class="token punctuation">,</span> <span class="token punctuation">[</span>callback<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="set-the-method-to-get-and-calls-reqend-automatically">Set the method to GET and calls req.end() automatically</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">server <span class="token operator">=</span> http<span class="token punctuation">.</span><span class="token method function property-access">createServer</span><span class="token punctuation">(</span><span class="token punctuation">[</span>requestListener<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="returns-a-new-web-server-object-the-requestlistener-is-a-function-which-is-automatically-added-to-the-request-event">Returns a new web server object. The requestListener is a function which is automatically added to the &apos;request&apos; event</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">server<span class="token punctuation">.</span><span class="token method function property-access">listen</span><span class="token punctuation">(</span>port<span class="token punctuation">,</span> <span class="token punctuation">[</span>hostname<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>backlog<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>callback<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="begin-accepting-connections-on-the-specified-port-and-hostname">Begin accepting connections on the specified port and hostname</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">server<span class="token punctuation">.</span><span class="token method function property-access">listen</span><span class="token punctuation">(</span>path<span class="token punctuation">,</span> <span class="token punctuation">[</span>callback<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="start-a-unix-socket-server-listening-for-connections-on-the-given-path">Start a UNIX socket server listening for connections on the given path</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">server<span class="token punctuation">.</span><span class="token method function property-access">listen</span><span class="token punctuation">(</span>handle<span class="token punctuation">,</span> <span class="token punctuation">[</span>callback<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="the-handle-object-can-be-set-to-either-a-server-or-socket-anything-with-an-underlying-_handle-member-or-a-fd-n-object">The handle object can be set to either a server or socket (anything with an underlying _handle member), or a {fd: <n>} object</n></h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">server<span class="token punctuation">.</span><span class="token method function property-access">close</span><span class="token punctuation">(</span><span class="token punctuation">[</span>callback<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="stops-the-server-from-accepting-new-connections">Stops the server from accepting new connections</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">server<span class="token punctuation">.</span><span class="token method function property-access">setTimeout</span><span class="token punctuation">(</span>msecs<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="sets-the-timeout-value-for-sockets-and-emits-a-timeout-event-on-the-server-object-passing-the-socket-as-an-argument-if-a-timeout-occurs">Sets the timeout value for sockets, and emits a &apos;timeout&apos; event on the Server object, passing the socket as an argument, if a timeout occurs</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">server<span class="token punctuation">.</span><span class="token property-access">maxHeadersCount</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="limits-maximum-incoming-headers-count-equal-to-1000-by-default-if-set-to-0-no-limit-will-be-applied">Limits maximum incoming headers count, equal to 1000 by default. If set to 0 - no limit will be applied</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">server<span class="token punctuation">.</span><span class="token property-access">timeout</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="the-number-of-milliseconds-of-inactivity-before-a-socket-is-presumed-to-have-timed-out">The number of milliseconds of inactivity before a socket is presumed to have timed out</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">server<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">&quot;request&quot;</span><span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token parameter">request<span class="token punctuation">,</span> response</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="emitted-each-time-there-is-a-request">Emitted each time there is a request</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">server<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">&quot;connection&quot;</span><span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token parameter">socket</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="when-a-new-tcp-stream-is-established">When a new TCP stream is established</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">server<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">&quot;close&quot;</span><span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="emitted-when-the-server-closes">Emitted when the server closes</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">server<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">&quot;checkContinue&quot;</span><span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token parameter">request<span class="token punctuation">,</span> response</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="emitted-each-time-a-request-with-an-http-expect-100-continue-is-received">Emitted each time a request with an http Expect: 100-continue is received</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">server<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">&quot;connect&quot;</span><span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token parameter">request<span class="token punctuation">,</span> socket<span class="token punctuation">,</span> head</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="emitted-each-time-a-client-requests-a-http-connect-method">Emitted each time a client requests a http CONNECT method</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">server<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">&quot;upgrade&quot;</span><span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token parameter">request<span class="token punctuation">,</span> socket<span class="token punctuation">,</span> head</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="emitted-each-time-a-client-requests-a-http-upgrade">Emitted each time a client requests a http upgrade</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">server<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">&quot;clientError&quot;</span><span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token parameter">exception<span class="token punctuation">,</span> socket</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="if-a-client-connection-emits-an-error-event-it-will-forwarded-here">If a client connection emits an &apos;error&apos; event - it will forwarded here</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">request<span class="token punctuation">.</span><span class="token method function property-access">write</span><span class="token punctuation">(</span>chunk<span class="token punctuation">,</span> <span class="token punctuation">[</span>encoding<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="sends-a-chunk-of-the-body">Sends a chunk of the body</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">request<span class="token punctuation">.</span><span class="token method function property-access">end</span><span class="token punctuation">(</span><span class="token punctuation">[</span>data<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>encoding<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="finishes-sending-the-request-if-any-parts-of-the-body-are-unsent-it-will-flush-them-to-the-stream">Finishes sending the request. If any parts of the body are unsent, it will flush them to the stream</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">request<span class="token punctuation">.</span><span class="token method function property-access">abort</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="aborts-a-request">Aborts a request</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">request<span class="token punctuation">.</span><span class="token method function property-access">setTimeout</span><span class="token punctuation">(</span>timeout<span class="token punctuation">,</span> <span class="token punctuation">[</span>callback<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="once-a-socket-is-assigned-to-this-request-and-is-connected-socketsettimeout-will-be-called">Once a socket is assigned to this request and is connected socket.setTimeout() will be called</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">request<span class="token punctuation">.</span><span class="token method function property-access">setNoDelay</span><span class="token punctuation">(</span><span class="token punctuation">[</span>noDelay<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="once-a-socket-is-assigned-to-this-request-and-is-connected-socketsetnodelay-will-be-called">Once a socket is assigned to this request and is connected socket.setNoDelay() will be called</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">request<span class="token punctuation">.</span><span class="token method function property-access">setSocketKeepAlive</span><span class="token punctuation">(</span><span class="token punctuation">[</span>enable<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>initialDelay<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="once-a-socket-is-assigned-to-this-request-and-is-connected-socketsetkeepalive-will-be-called">Once a socket is assigned to this request and is connected socket.setKeepAlive() will be called</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">request<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">&quot;response&quot;</span><span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token parameter">response</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="emitted-when-a-response-is-received-to-this-request-this-event-is-emitted-only-once">Emitted when a response is received to this request. This event is emitted only once</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">request<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">&quot;socket&quot;</span><span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token parameter">socket</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="emitted-after-a-socket-is-assigned-to-this-request">Emitted after a socket is assigned to this request</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">request<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">&quot;connect&quot;</span><span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token parameter">response<span class="token punctuation">,</span> socket<span class="token punctuation">,</span> head</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="emitted-each-time-a-server-responds-to-a-request-with-a-connect-method-if-this-event-isnt-being-listened-for-clients-receiving-a-connect-method-will-have-their-connections-closed">Emitted each time a server responds to a request with a CONNECT method. If this event isn&apos;t being listened for, clients receiving a CONNECT method will have their connections closed</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">request<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">&quot;upgrade&quot;</span><span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token parameter">response<span class="token punctuation">,</span> socket<span class="token punctuation">,</span> head</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="emitted-each-time-a-server-responds-to-a-request-with-an-upgrade-if-this-event-isnt-being-listened-for-clients-receiving-an-upgrade-header-will-have-their-connections-closed">Emitted each time a server responds to a request with an upgrade. If this event isn&apos;t being listened for, clients receiving an upgrade header will have their connections closed</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">request<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">&quot;continue&quot;</span><span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="emitted-when-the-server-sends-a-100-continue-http-response-usually-because-the-request-contained-expect-100-continue-this-is-an-instruction-that-the-client-should-send-the-request-body">Emitted when the server sends a &apos;100 Continue&apos; HTTP response, usually because the request contained &apos;Expect: 100-continue&apos;. This is an instruction that the client should send the request body</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">response<span class="token punctuation">.</span><span class="token method function property-access">write</span><span class="token punctuation">(</span>chunk<span class="token punctuation">,</span> <span class="token punctuation">[</span>encoding<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="this-sends-a-chunk-of-the-response-body-if-this-merthod-is-called-and-responsewritehead-has-not-been-called-it-will-switch-to-implicit-header-mode-and-flush-the-implicit-headers">This sends a chunk of the response body. If this merthod is called and response.writeHead() has not been called, it will switch to implicit header mode and flush the implicit headers</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">response<span class="token punctuation">.</span><span class="token method function property-access">writeContinue</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="sends-a-http11-100-continue-message-to-the-client-indicating-that-the-request-body-should-be-sent">Sends a HTTP/1.1 100 Continue message to the client, indicating that the request body should be sent</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">response<span class="token punctuation">.</span><span class="token method function property-access">writeHead</span><span class="token punctuation">(</span>statusCode<span class="token punctuation">,</span> <span class="token punctuation">[</span>reasonPhrase<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>headers<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="sends-a-response-header-to-the-request">Sends a response header to the request</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">response<span class="token punctuation">.</span><span class="token method function property-access">setTimeout</span><span class="token punctuation">(</span>msecs<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="sets-the-sockets-timeout-value-to-msecs-if-a-callback-is-provided-then-it-is-added-as-a-listener-on-the-timeout-event-on-the-response-object">Sets the Socket&apos;s timeout value to msecs. If a callback is provided, then it is added as a listener on the &apos;timeout&apos; event on the response object</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">response<span class="token punctuation">.</span><span class="token method function property-access">setHeader</span><span class="token punctuation">(</span>name<span class="token punctuation">,</span> value<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="sets-a-single-header-value-for-implicit-headers-if-this-header-already-exists-in-the-to-be-sent-headers-its-value-will-be-replaced-use-an-array-of-strings-here-if-you-need-to-send-multiple-headers-with-the-same-name">Sets a single header value for implicit headers. If this header already exists in the to-be-sent headers, its value will be replaced. Use an array of strings here if you need to send multiple headers with the same name</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">response<span class="token punctuation">.</span><span class="token method function property-access">getHeader</span><span class="token punctuation">(</span>name<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="reads-out-a-header-thats-already-been-queued-but-not-sent-to-the-client-note-that-the-name-is-case-insensitive">Reads out a header that&apos;s already been queued but not sent to the client. Note that the name is case insensitive</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">response<span class="token punctuation">.</span><span class="token method function property-access">removeHeader</span><span class="token punctuation">(</span>name<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="removes-a-header-thats-queued-for-implicit-sending">Removes a header that&apos;s queued for implicit sending</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">response<span class="token punctuation">.</span><span class="token method function property-access">addTrailers</span><span class="token punctuation">(</span>headers<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="this-method-adds-http-trailing-headers-a-header-but-at-the-end-of-the-message-to-the-response">This method adds HTTP trailing headers (a header but at the end of the message) to the response</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">response<span class="token punctuation">.</span><span class="token method function property-access">end</span><span class="token punctuation">(</span><span class="token punctuation">[</span>data<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>encoding<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="this-method-signals-to-the-server-that-all-of-the-response-headers-and-body-have-been-sent-that-server-should-consider-this-message-complete-the-method-responseend-must-be-called-on-each-response">This method signals to the server that all of the response headers and body have been sent; that server should consider this message complete. The method, response.end(), MUST be called on each response</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">response<span class="token punctuation">.</span><span class="token property-access">statusCode</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="when-using-implicit-headers-not-calling-responsewritehead-explicitly-this-property-controls-the-status-code-that-will-be-sent-to-the-client-when-the-headers-get-flushed">When using implicit headers (not calling response.writeHead() explicitly), this property controls the status code that will be sent to the client when the headers get flushed</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">response<span class="token punctuation">.</span><span class="token property-access">headersSent</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="boolean-read-only-true-if-headers-were-sent-false-otherwise">Boolean (read-only). True if headers were sent, false otherwise</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">response<span class="token punctuation">.</span><span class="token property-access">sendDate</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="when-true-the-date-header-will-be-automatically-generated-and-sent-in-the-response-if-it-is-not-already-present-in-the-headers-defaults-to-true">When true, the Date header will be automatically generated and sent in the response if it is not already present in the headers. Defaults to true</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">response<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">&quot;close&quot;</span><span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="indicates-that-the-underlying-connection-was-terminated-before-responseend-was-called-or-able-to-flush">Indicates that the underlying connection was terminated before response.end() was called or able to flush</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">response<span class="token punctuation">.</span><span class="token method function property-access">on</span><span class="token punctuation">(</span><span class="token string">&quot;finish&quot;</span><span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span> <span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span><span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="emitted-when-the-response-has-been-sent">Emitted when the response has been sent</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">message<span class="token punctuation">.</span><span class="token property-access">httpVersion</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="in-case-of-server-request-the-http-version-sent-by-the-client-in-the-case-of-client-response-the-http-version-of-the-connected-to-server">In case of server request, the HTTP version sent by the client. In the case of client response, the HTTP version of the connected-to server</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">message<span class="token punctuation">.</span><span class="token property-access">headers</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="the-requestresponse-headers-object">The request/response headers object</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">message<span class="token punctuation">.</span><span class="token property-access">trailers</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="the-requestresponse-trailers-object-only-populated-after-the-end-event">The request/response trailers object. Only populated after the &apos;end&apos; event</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">message<span class="token punctuation">.</span><span class="token property-access">method</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="the-request-method-as-a-string-read-only-example-get-delete">The request method as a string. Read only. Example: &apos;GET&apos;, &apos;DELETE&apos;</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">message<span class="token punctuation">.</span><span class="token property-access">url</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="request-url-string-this-contains-only-the-url-that-is-present-in-the-actual-http-request">Request URL string. This contains only the URL that is present in the actual HTTP request</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">message<span class="token punctuation">.</span><span class="token property-access">statusCode</span><span class="token punctuation">;</span>
</pre><blockquote>
<p>The 3-digit HTTP response status code. E.G. 404.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">message<span class="token punctuation">.</span><span class="token property-access">socket</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="the-netsocket-object-associated-with-the-connection">The net.Socket object associated with the connection</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">message<span class="token punctuation">.</span><span class="token method function property-access">setTimeout</span><span class="token punctuation">(</span>msecs<span class="token punctuation">,</span> callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="calls-messageconnectionsettimeoutmsecs-callback">Calls message.connection.setTimeout(msecs, callback)</h3>
<blockquote>
<p>This module has utilities for URL resolution and parsing. Call require(&apos;url&apos;) to use it.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">url<span class="token punctuation">.</span><span class="token method function property-access">parse</span><span class="token punctuation">(</span>urlStr<span class="token punctuation">,</span> <span class="token punctuation">[</span>parseQueryString<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>slashesDenoteHost<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="take-a-url-string-and-return-an-object">Take a URL string, and return an object</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">url<span class="token punctuation">.</span><span class="token method function property-access">format</span><span class="token punctuation">(</span>urlObj<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="take-a-parsed-url-object-and-return-a-formatted-url-string">Take a parsed URL object, and return a formatted URL string</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">url<span class="token punctuation">.</span><span class="token method function property-access">resolve</span><span class="token punctuation">(</span><span class="token keyword module keyword-from">from</span><span class="token punctuation">,</span> to<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="take-a-base-url-and-a-href-url-and-resolve-them-as-a-browser-would-for-an-anchor-tag">Take a base URL, and a href URL, and resolve them as a browser would for an anchor tag</h3>
<hr>
<hr>
<hr>
<hr>
<h1 class="mume-header" id="this-module-provides-utilities-for-dealing-with-query-strings-call-requirequerystring-to-use-it">This module provides utilities for dealing with query strings. Call require(&apos;querystring&apos;) to use it</h1>
<pre data-role="codeBlock" data-info="js" class="language-javascript">querystring<span class="token punctuation">.</span><span class="token method function property-access">stringify</span><span class="token punctuation">(</span>obj<span class="token punctuation">,</span> <span class="token punctuation">[</span>sep<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>eq<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="serialize-an-object-to-a-query-string-optionally-override-the-default-separator-and-assignment-characters">Serialize an object to a query string. Optionally override the default separator (&apos;&amp;&apos;) and assignment (&apos;=&apos;) characters</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">querystring<span class="token punctuation">.</span><span class="token method function property-access">parse</span><span class="token punctuation">(</span>str<span class="token punctuation">,</span> <span class="token punctuation">[</span>sep<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>eq<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>options<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="deserialize-a-query-string-to-an-object-optionally-override-the-default-separator-and-assignment-characters">Deserialize a query string to an object. Optionally override the default separator (&apos;&amp;&apos;) and assignment (&apos;=&apos;) characters</h3>
<blockquote>
<p>This module is used for writing unit tests for your applications, you can access it with require(&apos;assert&apos;).</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">assert<span class="token punctuation">.</span><span class="token method function property-access">fail</span><span class="token punctuation">(</span>actual<span class="token punctuation">,</span> expected<span class="token punctuation">,</span> message<span class="token punctuation">,</span> operator<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="throws-an-exception-that-displays-the-values-for-actual-and-expected-separated-by-the-provided-operator">Throws an exception that displays the values for actual and expected separated by the provided operator</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">assert</span><span class="token punctuation">(</span>value<span class="token punctuation">,</span> message<span class="token punctuation">)</span><span class="token punctuation">;</span>
assert<span class="token punctuation">.</span><span class="token method function property-access">ok</span><span class="token punctuation">(</span>value<span class="token punctuation">,</span> <span class="token punctuation">[</span>message<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="tests-if-value-is-truthy-it-is-equivalent-to-assertequaltrue-value-message">Tests if value is truthy, it is equivalent to assert.equal(true, !!value, message)</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">assert<span class="token punctuation">.</span><span class="token method function property-access">equal</span><span class="token punctuation">(</span>actual<span class="token punctuation">,</span> expected<span class="token punctuation">,</span> <span class="token punctuation">[</span>message<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="tests-shallow-coercive-equality-with-the-equal-comparison-operator">Tests shallow, coercive equality with the equal comparison operator ( == )</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">assert<span class="token punctuation">.</span><span class="token method function property-access">notEqual</span><span class="token punctuation">(</span>actual<span class="token punctuation">,</span> expected<span class="token punctuation">,</span> <span class="token punctuation">[</span>message<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="tests-shallow-coercive-non-equality-with-the-not-equal-comparison-operator">Tests shallow, coercive non-equality with the not equal comparison operator ( != )</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">assert<span class="token punctuation">.</span><span class="token method function property-access">deepEqual</span><span class="token punctuation">(</span>actual<span class="token punctuation">,</span> expected<span class="token punctuation">,</span> <span class="token punctuation">[</span>message<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="tests-for-deep-equality">Tests for deep equality</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">assert<span class="token punctuation">.</span><span class="token method function property-access">notDeepEqual</span><span class="token punctuation">(</span>actual<span class="token punctuation">,</span> expected<span class="token punctuation">,</span> <span class="token punctuation">[</span>message<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="tests-for-any-deep-inequality">Tests for any deep inequality</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">assert<span class="token punctuation">.</span><span class="token method function property-access">strictEqual</span><span class="token punctuation">(</span>actual<span class="token punctuation">,</span> expected<span class="token punctuation">,</span> <span class="token punctuation">[</span>message<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="tests-strict-equality-as-determined-by-the-strict-equality-operator">Tests strict equality, as determined by the strict equality operator ( === )</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">assert<span class="token punctuation">.</span><span class="token method function property-access">notStrictEqual</span><span class="token punctuation">(</span>actual<span class="token punctuation">,</span> expected<span class="token punctuation">,</span> <span class="token punctuation">[</span>message<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="tests-strict-non-equality-as-determined-by-the-strict-not-equal-operator">Tests strict non-equality, as determined by the strict not equal operator ( !== )</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">assert<span class="token punctuation">.</span><span class="token method function property-access">throws</span><span class="token punctuation">(</span>block<span class="token punctuation">,</span> <span class="token punctuation">[</span>error<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>message<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="expects-block-to-throw-an-error-error-can-be-constructor-regexp-or-validation-function">Expects block to throw an error. error can be constructor, RegExp or validation function</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">assert<span class="token punctuation">.</span><span class="token method function property-access">doesNotThrow</span><span class="token punctuation">(</span>block<span class="token punctuation">,</span> <span class="token punctuation">[</span>message<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="expects-block-not-to-throw-an-error-see-assertthrows-for-details">Expects block not to throw an error, see assert.throws for details</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">assert<span class="token punctuation">.</span><span class="token method function property-access">ifError</span><span class="token punctuation">(</span>value<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="tests-if-value-is-not-a-false-value-throws-if-it-is-a-true-value-useful-when-testing-the-first-argument-error-in-callbacks">Tests if value is not a false value, throws if it is a true value. Useful when testing the first argument, error in callbacks</h3>
<blockquote>
<p>Provides a few basic operating-system related utility functions.</p>
</blockquote>
<blockquote>
<p>Use require(&apos;os&apos;) to access this module.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">os<span class="token punctuation">.</span><span class="token method function property-access">tmpdir</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-the-operating-systems-default-directory-for-temp-files">Returns the operating system&apos;s default directory for temp files</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">os<span class="token punctuation">.</span><span class="token method function property-access">endianness</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-the-endianness-of-the-cpu-possible-values-are-be-or-le">Returns the endianness of the CPU. Possible values are &quot;BE&quot; or &quot;LE&quot;</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">os<span class="token punctuation">.</span><span class="token method function property-access">hostname</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-the-hostname-of-the-operating-system">Returns the hostname of the operating system</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">os<span class="token punctuation">.</span><span class="token method function property-access">type</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-the-operating-system-name">Returns the operating system name</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">os<span class="token punctuation">.</span><span class="token method function property-access">platform</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-the-operating-system-platform">Returns the operating system platform</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">os<span class="token punctuation">.</span><span class="token method function property-access">arch</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-the-operating-system-cpu-architecture">Returns the operating system CPU architecture</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">os<span class="token punctuation">.</span><span class="token method function property-access">release</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="returns-the-operating-system-release">Returns the operating system release</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">os<span class="token punctuation">.</span><span class="token method function property-access">uptime</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-the-system-uptime-in-seconds">Returns the system uptime in seconds</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">os<span class="token punctuation">.</span><span class="token method function property-access">loadavg</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="returns-an-array-containing-the-1-5-and-15-minute-load-averages">Returns an array containing the 1, 5, and 15 minute load averages</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">os<span class="token punctuation">.</span><span class="token method function property-access">totalmem</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-the-total-amount-of-system-memory-in-bytes">Returns the total amount of system memory in bytes</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">os<span class="token punctuation">.</span><span class="token method function property-access">freemem</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="returns-the-amount-of-free-system-memory-in-bytes">Returns the amount of free system memory in bytes</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">os<span class="token punctuation">.</span><span class="token method function property-access">cpus</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-an-array-of-objects-containing-information-about-each-cpucore-installed-model-speed-in-mhz-and-times-an-object-containing-the-number-of-milliseconds-the-cpucore-spent-in-user-nice-sys-idle-and-irq">Returns an array of objects containing information about each CPU/core installed: model, speed (in MHz), and times (an object containing the number of milliseconds the CPU/core spent in: user, nice, sys, idle, and irq)</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">os<span class="token punctuation">.</span><span class="token method function property-access">networkInterfaces</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="get-a-list-of-network-interfaces">Get a list of network interfaces</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">os<span class="token punctuation">.</span><span class="token constant">EOL</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="a-constant-defining-the-appropriate-end-of-line-marker-for-the-operating-system">A constant defining the appropriate End-of-line marker for the operating system</h3>
<blockquote>
<p>Buffer is used to dealing with binary data<br>
Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap</p>
</blockquote>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">Buffer</span><span class="token punctuation">.</span><span class="token keyword module keyword-from">from</span><span class="token punctuation">(</span>size<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="allocates-a-new-buffer-of-size-octets">Allocates a new buffer of size octets</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">Buffer</span><span class="token punctuation">.</span><span class="token keyword module keyword-from">from</span><span class="token punctuation">(</span>array<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="allocates-a-new-buffer-using-an-array-of-octets">Allocates a new buffer using an array of octets</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">Buffer</span><span class="token punctuation">.</span><span class="token keyword module keyword-from">from</span><span class="token punctuation">(</span>str<span class="token punctuation">,</span> <span class="token punctuation">[</span>encoding<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="allocates-a-new-buffer-containing-the-given-str-encoding-defaults-to-utf8">Allocates a new buffer containing the given str. encoding defaults to &apos;utf8&apos;</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">Buffer</span><span class="token punctuation">.</span><span class="token method function property-access">isEncoding</span><span class="token punctuation">(</span>encoding<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-true-if-the-encoding-is-a-valid-encoding-argument-or-false-otherwise">Returns true if the encoding is a valid encoding argument, or false otherwise</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">Buffer</span><span class="token punctuation">.</span><span class="token method function property-access">isBuffer</span><span class="token punctuation">(</span>obj<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="tests-if-obj-is-a-buffer">Tests if obj is a Buffer</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">Buffer</span><span class="token punctuation">.</span><span class="token method function property-access">concat</span><span class="token punctuation">(</span>list<span class="token punctuation">,</span> <span class="token punctuation">[</span>totalLength<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-a-buffer-which-is-the-result-of-concatenating-all-the-buffers-in-the-list-together">Returns a buffer which is the result of concatenating all the buffers in the list together</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">Buffer</span><span class="token punctuation">.</span><span class="token method function property-access">byteLength</span><span class="token punctuation">(</span>string<span class="token punctuation">,</span> <span class="token punctuation">[</span>encoding<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="gives-the-actual-byte-length-of-a-string">Gives the actual byte length of a string</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">buf<span class="token punctuation">.</span><span class="token method function property-access">write</span><span class="token punctuation">(</span>string<span class="token punctuation">,</span> <span class="token punctuation">[</span>offset<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>length<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>encoding<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="writes-string-to-the-buffer-at-offset-using-the-given-encoding">Writes string to the buffer at offset using the given encoding</h3>
<blockquote>
<p>buf.toString([encoding], [start], [end]);</p>
</blockquote>
<hr>
<blockquote>
<p>Decodes and returns a string from buffer data encoded with encoding (defaults to &apos;utf8&apos;) beginning at start (defaults to 0) and ending at end (defaults to buffer.length).</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">buf<span class="token punctuation">.</span><span class="token method function property-access">toJSON</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-a-json-representation-of-the-buffer-instance-which-is-identical-to-the-output-for-json-arrays">Returns a JSON-representation of the Buffer instance, which is identical to the output for JSON Arrays</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">buf<span class="token punctuation">.</span><span class="token method function property-access">copy</span><span class="token punctuation">(</span>targetBuffer<span class="token punctuation">,</span> <span class="token punctuation">[</span>targetStart<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>sourceStart<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>sourceEnd<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<h3 class="mume-header" id="does-copy-between-buffers-the-source-and-target-regions-can-be-overlapped">Does copy between buffers. The source and target regions can be overlapped</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">buf<span class="token punctuation">.</span><span class="token method function property-access">slice</span><span class="token punctuation">(</span><span class="token punctuation">[</span>start<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>end<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-a-new-buffer-which-references-the-same-memory-as-the-old-but-offset-and-cropped-by-the-start-defaults-to-0-and-end-defaults-to-bufferlength-indexes-negative-indexes-start-from-the-end-of-the-buffer">Returns a new buffer which references the same memory as the old, but offset and cropped by the start (defaults to 0) and end (defaults to buffer.length) indexes. Negative indexes start from the end of the buffer</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">buf<span class="token punctuation">.</span><span class="token method function property-access">fill</span><span class="token punctuation">(</span>value<span class="token punctuation">,</span> <span class="token punctuation">[</span>offset<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span>end<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="fills-the-buffer-with-the-specified-value">Fills the buffer with the specified value</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">buf<span class="token punctuation">[</span>index<span class="token punctuation">]</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="get-and-set-the-octet-at-index">Get and set the octet at index</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">buf<span class="token punctuation">.</span><span class="token property-access">length</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="the-size-of-the-buffer-in-bytes-note-that-this-is-not-necessarily-the-size-of-the-contents">The size of the buffer in bytes, Note that this is not necessarily the size of the contents</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript">buffer<span class="token punctuation">.</span><span class="token constant">INSPECT_MAX_BYTES</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="how-many-bytes-will-be-returned-when-bufferinspect-is-called-this-can-be-overridden-by-user-modules">How many bytes will be returned when buffer.inspect() is called. This can be overridden by user modules</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"></pre><hr>
<hr>
<hr>
<hr>
<h1 class="mume-header" id="reactjs">ReactJS</h1>
<hr>
<pre data-role="codeBlock" data-info="bash" class="language-bash"><span class="token function">npm</span> <span class="token function">install</span> --save react
<span class="token comment">#// declarative and flexible JavaScript library for building UI</span>
<span class="token function">npm</span> <span class="token function">install</span> --save react-dom
---
---
---
---
<span class="token comment">#&gt; serves as the entry point of the DOM-related rendering paths</span>
<span class="token function">npm</span> <span class="token function">install</span> --save prop-types
<span class="token comment">#// runtime type checking for React props and similar objects</span>
</pre><h2 class="mume-header" id="notes-dont-forget-the-command-lines">notes: don&apos;t forget the command lines</h2>
<blockquote>
<p>Create and return a new React element of the given type.</p>
</blockquote>
<blockquote>
<p>Code written with JSX will be converted to use React.createElement().</p>
</blockquote>
<hr>
<h4 class="mume-header" id="you-will-not-typically-invoke-reactcreateelement-directly-if-you-are-using-jsx">You will not typically invoke React.createElement() directly if you are using JSX</h4>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">React</span><span class="token punctuation">.</span><span class="token method function property-access">createElement</span><span class="token punctuation">(</span>type<span class="token punctuation">,</span> <span class="token punctuation">[</span>props<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token spread operator">...</span>children<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="clone-and-return-a-new-react-element-using-element-as-the-starting-point">Clone and return a new React element using element as the starting point</h3>
<blockquote>
<p>The resulting element will have the original element&apos;s props with the new props merged in shallowly.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">React</span><span class="token punctuation">.</span><span class="token method function property-access">cloneElement</span><span class="token punctuation">(</span>element<span class="token punctuation">,</span> <span class="token punctuation">[</span>props<span class="token punctuation">]</span><span class="token punctuation">,</span> <span class="token punctuation">[</span><span class="token spread operator">...</span>children<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="verifies-the-object-is-a-react-element-returns-true-or-false">Verifies the object is a React element. Returns true or false</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">React</span><span class="token punctuation">.</span><span class="token method function property-access">isValidElement</span><span class="token punctuation">(</span>object<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="reactchildren-provides-utilities-for-dealing-with-the-thispropschildren-opaque-data-structure">React.Children&gt; provides utilities for dealing with the this.props.children opaque data structure</h3>
<blockquote>
<p>Invokes a function on every immediate child contained within children with this set to thisArg.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">React</span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">Children</span></span><span class="token punctuation">.</span><span class="token method function property-access">map</span><span class="token punctuation">(</span>children<span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span><span class="token punctuation">[</span><span class="token punctuation">(</span>thisArg<span class="token punctuation">)</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="like-reactchildrenmap-but-does-not-return-an-array">Like React.Children.map() but does not return an array</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">React</span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">Children</span></span><span class="token punctuation">.</span><span class="token method function property-access">forEach</span><span class="token punctuation">(</span>children<span class="token punctuation">,</span> <span class="token keyword keyword-function">function</span><span class="token punctuation">[</span><span class="token punctuation">(</span>thisArg<span class="token punctuation">)</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-the-total-number-of-components-in-children-equal-to-the-number-of-times-that-a-callback-passed-to-map-or-foreach-would-be-invoked">Returns the total number of components in children, equal to the number of times that a callback passed to map or forEach would be invoked</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">React</span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">Children</span></span><span class="token punctuation">.</span><span class="token method function property-access">count</span><span class="token punctuation">(</span>children<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="verifies-that-children-has-only-one-child-a-react-element-and-returns-it">Verifies that children has only one child (a React element) and returns it</h3>
<blockquote>
<p>Otherwise this method throws an error.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">React</span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">Children</span></span><span class="token punctuation">.</span><span class="token method function property-access">only</span><span class="token punctuation">(</span>children<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="returns-the-children-opaque-data-structure-as-a-flat-array-with-keys-assigned-to-each-child">Returns the children opaque data structure as a flat array with keys assigned to each child</h3>
<blockquote>
<p>Useful if you want to manipulate collections of children in your render methods, especially if you want to reorder or slice this.props.children before passing it down.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">React</span><span class="token punctuation">.</span><span class="token property-access"><span class="token maybe-class-name">Children</span></span><span class="token punctuation">.</span><span class="token method function property-access">toArray</span><span class="token punctuation">(</span>children<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="the-reactfragment-component-lets-you-return-multiple-elements-in-a-render-method-without-creating-an-additional-dom-element">The React.Fragment component lets you return multiple elements in a render() method without creating an additional DOM element</h3>
<hr>
<h4 class="mume-header" id="you-can-also-use-it-with-the-shorthand-syntax">You can also use it with the shorthand &lt;&gt;&lt;/&gt; syntax</h4>
<pre data-role="codeBlock" data-info="js" class="language-javascript">
<span class="token keyword keyword-class">class</span> <span class="token class-name">Component</span> <span class="token keyword keyword-extends">extends</span> <span class="token class-name">React<span class="token punctuation">.</span>Component</span> <span class="token punctuation">{</span>
</pre><blockquote>
<p>Will be called before it is mounted<br>
constructor(props) {<br>
Call this method before any other statement<br>
or this.props will be undefined in the constructor<br>
super(props);</p>
</blockquote>
<blockquote>
<p>The constructor is also often used to bind event handlers to the class instance.</p>
</blockquote>
<blockquote>
<p>Binding makes sure the method has access to component attributes like this.props and this.state</p>
</blockquote>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">method</span> <span class="token operator">=</span> <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token method function property-access">method</span><span class="token punctuation">.</span><span class="token method function property-access">bind</span><span class="token punctuation">(</span><span class="token keyword keyword-this">this</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="the-constructor-is-the-right-place-to-initialize-state">The constructor is the right place to initialize state</h3>
<pre data-role="codeBlock" data-info="js" class="language-javascript"> <span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">state</span> <span class="token operator">=</span> <span class="token punctuation">{</span>
active<span class="token operator">:</span> <span class="token boolean">true</span><span class="token punctuation">,</span>
</pre><hr>
<h3 class="mume-header" id="in-rare-cases-its-okay-to-initialize-state-based-on-props">In rare cases, it&apos;s okay to initialize state based on props</h3>
<blockquote>
<p>This effectively &quot;forks&quot; the props and sets the state with the initial props.</p>
</blockquote>
<blockquote>
<p>If you &quot;fork&quot; props by using them for state, you might also want to implement componentWillReceiveProps(nextProps)<br>
to keep the state up-to-date with them. But lifting state up is often easier and less bug-prone.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"> color<span class="token operator">:</span> props<span class="token punctuation">.</span><span class="token property-access">initialColor</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
</pre><blockquote>
<p>Enqueues changes to the component state and tells React that this component and its children need to be re-rendered with the updated state.</p>
</blockquote>
<blockquote>
<p>setState() does not always immediately update the component. It may batch or defer the update until later.</p>
</blockquote>
<blockquote>
<p>This makes reading this.state right after calling setState() a potential pitfall.</p>
</blockquote>
<blockquote>
<p>Instead, use componentDidUpdate or a setState callback.</p>
</blockquote>
<hr>
<h4 class="mume-header" id="you-may-optionally-pass-an-object-as-the-first-argument-to-setstate-instead-of-a-function">You may optionally pass an object as the first argument to setState() instead of a function</h4>
<pre data-role="codeBlock" data-info="jsx" class="language-jsx"><span class="token function">setState</span><span class="token punctuation">(</span><span class="token parameter">updater<span class="token punctuation">[</span><span class="token punctuation">,</span> callback<span class="token punctuation">]</span></span><span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token punctuation">}</span>
</pre><blockquote>
<p>Invoked just before mounting occurs (before render())</p>
</blockquote>
<blockquote>
<p>This is the only lifecycle hook called on server rendering.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">componentWillMount</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token punctuation">}</span>
</pre><blockquote>
<p>Invoked immediately after a component is mounted.</p>
</blockquote>
<blockquote>
<p>Initialization that requires DOM nodes should go here.</p>
</blockquote>
<blockquote>
<p>If you need to load data from a remote endpoint, this is a good place to instantiate the network request.</p>
</blockquote>
<blockquote>
<p>This method is a good place to set up any subscriptions. If you do that, don&apos;t forget to unsubscribe in componentWillUnmount().</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">componentDidMount</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token punctuation">}</span>
</pre><blockquote>
<p>Invoked before a mounted component receives new props.</p>
</blockquote>
<blockquote>
<p>If you need to update the state in response to prop changes (for example, to reset it), you may compare this.props and nextProps and perform state transitions using this.setState() in this method.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">componentWillReceiveProps</span><span class="token punctuation">(</span><span class="token parameter">nextProps</span><span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token punctuation">}</span>
</pre><hr>
<h3 class="mume-header" id="let-react-know-if-a-components-output-is-not-affected-by-the-current-change-in-state-or-props">^^^^ Let React know if a component&apos;s output is not affected by the current change in state or props</h3>
<blockquote>
<p>The default behavior is to re-render on every state change, and in the vast majority of cases you should rely on the default behavior.</p>
</blockquote>
<hr>
<h3 class="mume-header" id="shouldcomponentupdate-is-invoked-before-rendering-when-new-props-or-state-are-being-received-defaults-to-true">shouldComponentUpdate() is invoked before rendering when new props or state are being received. Defaults to true</h3>
<blockquote>
<p>This method is not called for the initial render or when forceUpdate() is used.</p>
</blockquote>
<blockquote>
<p>Returning false does not prevent child components from re-rendering when their state changes.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">shouldComponentUpdate</span><span class="token punctuation">(</span><span class="token parameter">nextProps<span class="token punctuation">,</span> nextState</span><span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token punctuation">}</span>
</pre><blockquote>
<p>Invoked just before rendering when new props or state are being received.</p>
</blockquote>
<blockquote>
<p>Use this as an opportunity to perform preparation before an update occurs. This method is not called for the initial render.</p>
</blockquote>
<blockquote>
<p>Note that you cannot call this.setState() here; nor should you do anything else</p>
</blockquote>
<blockquote>
<p>(e.g. dispatch a Redux action) that would trigger an update to a React component before componentWillUpdate() returns.</p>
</blockquote>
<blockquote>
<p>If you need to update state in response to props changes, use componentWillReceiveProps() instead.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">componentWillUpdate</span><span class="token punctuation">(</span><span class="token parameter">nextProps<span class="token punctuation">,</span> nextState</span><span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token punctuation">}</span>
</pre><blockquote>
<p>Invoked immediately after updating occurs. This method is not called for the initial render.</p>
</blockquote>
<blockquote>
<p>Use this as an opportunity to operate on the DOM when the component has been updated.</p>
</blockquote>
<blockquote>
<p>This is also a good place to do network requests as long as you compare the current props to previous props (e.g. a network request may not be necessary if the props have not changed).</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">componentDidUpdate</span><span class="token punctuation">(</span><span class="token parameter">prevProps<span class="token punctuation">,</span> prevState</span><span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token punctuation">}</span>
</pre><blockquote>
<p>Invoked immediately before a component is unmounted and destroyed.</p>
</blockquote>
<blockquote>
<p>Perform any necessary cleanup in this method, such as invalidating timers, canceling network requests, or cleaning up any subscriptions that were created in componentDidMount().</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">componentWillUnmount</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token punctuation">}</span>
</pre><blockquote>
<p>Error boundaries are React components that catch JavaScript errors anywhere in their child component tree, log those errors, and display a fallback UI instead of the component tree that crashed.</p>
</blockquote>
<blockquote>
<p>Error boundaries catch errors during rendering, in lifecycle methods, and in constructors of the whole tree below them.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">componentDidCatch</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span> <span class="token punctuation">}</span>
</pre><blockquote>
<p>This method is required.</p>
</blockquote>
<blockquote>
<p>It should be pure, meaning that it does not modify component state, it returns the same result each time it&apos;s invoked, and</p>
</blockquote>
<blockquote>
<p>it does not directly interact with the browser (use lifecycle methods for this)</p>
</blockquote>
<blockquote>
<p>It must return one of the following types: react elements, string and numbers, portals, null or booleans.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function">render</span><span class="token punctuation">(</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
</pre><blockquote>
<p>Contains the props that were defined by the caller of this component.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">log</span><span class="token punctuation">(</span><span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">props</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="contains-data-specific-to-this-component-that-may-change-over-time">Contains data specific to this component that may change over time</h3>
<blockquote>
<p>The state is user-defined, and it should be a plain JavaScript object.</p>
</blockquote>
<blockquote>
<p>If you don&apos;t use it in render(), it shouldn&apos;t be in the state.</p>
</blockquote>
<blockquote>
<p>For example, you can put timer IDs directly on the instance.</p>
</blockquote>
<blockquote>
<p>Never mutate this.state directly, as calling setState() afterwards may replace the mutation you made.</p>
</blockquote>
<blockquote>
<p>Treat this.state as if it were immutable.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"> <span class="token console class-name">console</span><span class="token punctuation">.</span><span class="token method function property-access">log</span><span class="token punctuation">(</span><span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">state</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token keyword control-flow keyword-return">return</span> <span class="token punctuation">(</span>
<span class="token operator">&lt;</span>div<span class="token operator">&gt;</span>
<span class="token punctuation">{</span><span class="token comment">/* Comment goes here */</span><span class="token punctuation">}</span>
<span class="token maybe-class-name">Hello</span><span class="token punctuation">,</span> <span class="token punctuation">{</span><span class="token keyword keyword-this">this</span><span class="token punctuation">.</span><span class="token property-access">props</span><span class="token punctuation">.</span><span class="token property-access">name</span><span class="token punctuation">}</span><span class="token operator">!</span>
<span class="token operator">&lt;</span><span class="token operator">/</span>div<span class="token operator">&gt;</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span>
</pre><hr>
<blockquote>
<p>Can be defined as a property on the component class itself, to set the default props for the class.</p>
</blockquote>
<blockquote>
<p>This is used for undefined props, but not for null props.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">Component</span><span class="token punctuation">.</span><span class="token property-access">defaultProps</span> <span class="token operator">=</span> <span class="token punctuation">{</span>
color<span class="token operator">:</span> <span class="token string">&quot;blue&quot;</span><span class="token punctuation">,</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
component <span class="token operator">=</span> <span class="token keyword keyword-new">new</span> <span class="token class-name">Component</span><span class="token punctuation">(</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="by-default-when-your-components-state-or-props-change-your-component-will-re-render">By default, when your component&apos;s state or props change, your component will re-render</h3>
<blockquote>
<p>If your render() method depends on some other data, you can tell React that the component needs re-rendering by calling forceUpdate().</p>
</blockquote>
<blockquote>
<p>Normally you should try to avoid all uses of forceUpdate() and only read from this.props and this.state in render().</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">component<span class="token punctuation">.</span><span class="token method function property-access">forceUpdate</span><span class="token punctuation">(</span>callback<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<hr>
<hr>
<h1 class="mume-header" id="reactdom">REACT.DOM</h1>
<ul>
<li>
<p>The react-dom package provides DOM-specific methods that can be used at the top level of</p>
</li>
<li>
<p>your app and as an escape hatch to get outside of the React model if you need to.</p>
</li>
<li>
<p>Most of your components should not need to use this module.</p>
</li>
</ul>
<blockquote>
<p>Render a React element into the DOM in the supplied container and return a reference</p>
</blockquote>
<blockquote>
<p>to the component (or returns null for stateless components).</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">render</span><span class="token punctuation">(</span>element<span class="token punctuation">,</span> container<span class="token punctuation">[</span><span class="token punctuation">,</span> callback<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="same-as-render-but-is-used-to-hydrate-a-container-whose-html-contents-were-rendered">Same as render(), but is used to hydrate a container whose HTML contents were rendered</h3>
<blockquote>
<p>by ReactDOMServer. React will attempt to attach event listeners to the existing markup.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">hydrate</span><span class="token punctuation">(</span>element<span class="token punctuation">,</span> container<span class="token punctuation">[</span><span class="token punctuation">,</span> callback<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="remove-a-mounted-react-component-from-the-dom-and-clean-up-its-event-handlers-and-state">Remove a mounted React component from the DOM and clean up its event handlers and state</h3>
<blockquote>
<p>If no component was mounted in the container, calling this function does nothing.</p>
</blockquote>
<blockquote>
<p>Returns true if a component was unmounted and false if there was no component to unmount.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">unmountComponentAtNode</span><span class="token punctuation">(</span>container<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="if-this-component-has-been-mounted-into-the-dom-this-returns-the-corresponding-native-browser">If this component has been mounted into the DOM, this returns the corresponding native browser</h3>
<blockquote>
<p>DOM element. This method is useful for reading values out of the DOM, such as form field values</p>
</blockquote>
<blockquote>
<p>and performing DOM measurements. In most cases, you can attach a ref to the DOM node and avoid</p>
</blockquote>
<blockquote>
<p>using findDOMNode at all.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">findDOMNode</span><span class="token punctuation">(</span>component<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="creates-a-portal-portals-provide-a-way-to-render-children-into-a-dom-node-that-exists-outside">Creates a portal. Portals provide a way to render children into a DOM node that exists outside</h3>
<blockquote>
<p>the hierarchy of the DOM component.</p>
</blockquote>
<hr>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">ReactDOM</span><span class="token punctuation">.</span><span class="token method function property-access">createPortal</span><span class="token punctuation">(</span>child<span class="token punctuation">,</span> container<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<hr>
<hr>
<hr>
<h1 class="mume-header" id="reactdomserver">REACTDOMSERVER</h1>
<ul>
<li>The ReactDOMServer object enables you to render components to static markup.</li>
</ul>
<blockquote>
<p>Render a React element to its initial HTML. React will return an HTML string.</p>
</blockquote>
<hr>
<h4 class="mume-header" id="you-can-use-this-method-to-generate-html-on-the-server-and-send-the-markup-down-on-the-initial">You can use this method to generate HTML on the server and send the markup down on the initial</h4>
<blockquote>
<p>request for faster page loads and to allow search engines to crawl your pages for SEO purposes.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">ReactDOMServer</span><span class="token punctuation">.</span><span class="token method function property-access">renderToString</span><span class="token punctuation">(</span>element<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="similar-to-rendertostring-except-this-doesnt-create-extra-dom-attributes-that-react-uses">Similar to renderToString, except this doesn&apos;t create extra DOM attributes that React uses</h3>
<blockquote>
<p>internally, such as data-reactroot. This is useful if you want to use React as a simple static</p>
</blockquote>
<blockquote>
<p>page generator, as stripping away the extra attributes can save some bytes.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">ReactDOMServer</span><span class="token punctuation">.</span><span class="token method function property-access">renderToStaticMarkup</span><span class="token punctuation">(</span>element<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="render-a-react-element-to-its-initial-html-returns-a-readable-stream-that-outputs-an-html-string">Render a React element to its initial HTML. Returns a Readable stream that outputs an HTML string</h3>
<blockquote>
<p>The HTML output by this stream is exactly equal to what ReactDOMServer.renderToString would return.</p>
</blockquote>
<hr>
<h4 class="mume-header" id="you-can-use-this-method-to-generate-html-on-the-server-and-send-the-markup-down-on-the-initial-1">You can use this method to generate HTML on the server and send the markup down on the initial</h4>
<blockquote>
<p>request for faster page loads and to allow search engines to crawl your pages for SEO purposes.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">ReactDOMServer</span><span class="token punctuation">.</span><span class="token method function property-access">renderToNodeStream</span><span class="token punctuation">(</span>element<span class="token punctuation">)</span><span class="token punctuation">;</span>
</pre><hr>
<h3 class="mume-header" id="similar-to-rendertonodestream-except-this-doesnt-create-extra-dom-attributes-that-react-uses">Similar to renderToNodeStream, except this doesn&apos;t create extra DOM attributes that React uses</h3>
<blockquote>
<p>internally, such as data-reactroot. This is useful if you want to use React as a simple static</p>
</blockquote>
<blockquote>
<p>page generator, as stripping away the extra attributes can save some bytes.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token maybe-class-name">ReactDOMServer</span><span class="token punctuation">.</span><span class="token method function property-access">renderToStaticNodeStream</span><span class="token punctuation">(</span>element<span class="token punctuation">)</span>
<span class="token keyword module keyword-import">import</span> <span class="token imports"><span class="token maybe-class-name">PropTypes</span></span> <span class="token keyword module keyword-from">from</span> <span class="token string">&apos;prop-types&apos;</span><span class="token punctuation">;</span>
<span class="token maybe-class-name">MyComponent</span><span class="token punctuation">.</span><span class="token property-access">propTypes</span> <span class="token operator">=</span> <span class="token punctuation">{</span>
</pre><hr>
<h4 class="mume-header" id="you-can-declare-that-a-prop-is-a-specific-js-type-by-default-these-are-all-optional">You can declare that a prop is a specific JS type. By default, these are all optional</h4>
<pre data-role="codeBlock" data-info="js" class="language-javascript">optionalArray<span class="token operator">:</span> <span class="token maybe-class-name">PropTypes</span><span class="token punctuation">.</span><span class="token property-access">array</span><span class="token punctuation">,</span>
optionalBool<span class="token operator">:</span> <span class="token maybe-class-name">PropTypes</span><span class="token punctuation">.</span><span class="token property-access">bool</span><span class="token punctuation">,</span>
optionalFunc<span class="token operator">:</span> <span class="token maybe-class-name">PropTypes</span><span class="token punctuation">.</span><span class="token property-access">func</span><span class="token punctuation">,</span>
optionalNumber<span class="token operator">:</span> <span class="token maybe-class-name">PropTypes</span><span class="token punctuation">.</span><span class="token property-access">number</span><span class="token punctuation">,</span>
optionalObject<span class="token operator">:</span> <span class="token maybe-class-name">PropTypes</span><span class="token punctuation">.</span><span class="token property-access">object</span><span class="token punctuation">,</span>
optionalString<span class="token operator">:</span> <span class="token maybe-class-name">PropTypes</span><span class="token punctuation">.</span><span class="token property-access">string</span><span class="token punctuation">,</span>
optionalSymbol<span class="token operator">:</span> <span class="token maybe-class-name">PropTypes</span><span class="token punctuation">.</span><span class="token property-access">symbol</span><span class="token punctuation">,</span> <span class="token maybe-class-name">Anything</span> that can be rendered<span class="token operator">:</span> numbers<span class="token punctuation">,</span> strings<span class="token punctuation">,</span> elements or an array
</pre><hr>
<h3 class="mume-header" id="or-fragment-containing-these-types">(or fragment) containing these types</h3>
<p>optionalNode: PropTypes.node, A React element.</p>
<hr>
<h3 class="mume-header" id="optionalelement-proptypeselement-you-can-also-declare-that-a-prop-is-an-instance-of-a-class-this-uses">optionalElement: PropTypes.element, You can also declare that a prop is an instance of a class. This uses</h3>
<blockquote>
<p>JS&apos;s instanceof operator.</p>
</blockquote>
<p>optionalMessage: PropTypes.instanceOf(Message), You can ensure that your prop is limited to specific values by treating</p>
<blockquote>
<p>it as an enum.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">optionalEnum<span class="token operator">:</span> <span class="token maybe-class-name">PropTypes</span><span class="token punctuation">.</span><span class="token method function property-access">oneOf</span><span class="token punctuation">(</span><span class="token punctuation">[</span><span class="token string">&apos;News&apos;</span><span class="token punctuation">,</span> <span class="token string">&apos;Photos&apos;</span><span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token maybe-class-name">An</span> object that could be one <span class="token keyword keyword-of">of</span> many types
optionalUnion<span class="token operator">:</span> <span class="token maybe-class-name">PropTypes</span><span class="token punctuation">.</span><span class="token method function property-access">oneOfType</span><span class="token punctuation">(</span><span class="token punctuation">[</span>
<span class="token maybe-class-name">PropTypes</span><span class="token punctuation">.</span><span class="token property-access">string</span><span class="token punctuation">,</span>
<span class="token maybe-class-name">PropTypes</span><span class="token punctuation">.</span><span class="token property-access">number</span><span class="token punctuation">,</span>
<span class="token maybe-class-name">PropTypes</span><span class="token punctuation">.</span><span class="token method function property-access">instanceOf</span><span class="token punctuation">(</span><span class="token maybe-class-name">Message</span><span class="token punctuation">)</span>
<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token maybe-class-name">An</span> array <span class="token keyword keyword-of">of</span> a certain type
optionalArrayOf<span class="token operator">:</span> <span class="token maybe-class-name">PropTypes</span><span class="token punctuation">.</span><span class="token method function property-access">arrayOf</span><span class="token punctuation">(</span><span class="token maybe-class-name">PropTypes</span><span class="token punctuation">.</span><span class="token property-access">number</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token maybe-class-name">An</span> object <span class="token keyword keyword-with">with</span> property values <span class="token keyword keyword-of">of</span> a certain type
optionalObjectOf<span class="token operator">:</span> <span class="token maybe-class-name">PropTypes</span><span class="token punctuation">.</span><span class="token method function property-access">objectOf</span><span class="token punctuation">(</span><span class="token maybe-class-name">PropTypes</span><span class="token punctuation">.</span><span class="token property-access">number</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token maybe-class-name">An</span> object taking on a particular shape
optionalObjectWithShape<span class="token operator">:</span> <span class="token maybe-class-name">PropTypes</span><span class="token punctuation">.</span><span class="token method function property-access">shape</span><span class="token punctuation">(</span><span class="token punctuation">{</span>
color<span class="token operator">:</span> <span class="token maybe-class-name">PropTypes</span><span class="token punctuation">.</span><span class="token property-access">string</span><span class="token punctuation">,</span>
fontSize<span class="token operator">:</span> <span class="token maybe-class-name">PropTypes</span><span class="token punctuation">.</span><span class="token property-access">number</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span><span class="token punctuation">,</span> <span class="token maybe-class-name">You</span> can chain any <span class="token keyword keyword-of">of</span> the above <span class="token keyword keyword-with">with</span> <span class="token template-string"><span class="token template-punctuation string">`</span><span class="token string">isRequired</span><span class="token template-punctuation string">`</span></span> to make sure a warning
</pre><hr>
<h3 class="mume-header" id="is-shown-if-the-prop-isnt-provided">is shown if the prop isn&apos;t provided</h3>
<ul>
<li>requiredFunc: PropTypes.func.isRequired, A value of any data type</li>
<li>requiredAny: PropTypes.any.isRequired, You can also specify a custom validator. It should return an Error</li>
</ul>
<blockquote>
<p>object if the validation fails. Don&apos;t <code>console.warn</code> or throw, as this</p>
</blockquote>
<blockquote>
<p>won&apos;t work inside <code>oneOfType</code>.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript"><span class="token function-variable function">customProp</span><span class="token operator">:</span> <span class="token keyword keyword-function">function</span><span class="token punctuation">(</span><span class="token parameter">props<span class="token punctuation">,</span> propName<span class="token punctuation">,</span> componentName</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
<span class="token keyword control-flow keyword-if">if</span> <span class="token punctuation">(</span><span class="token operator">!</span><span class="token regex"><span class="token regex-delimiter">/</span><span class="token regex-source language-regex">matchme</span><span class="token regex-delimiter">/</span></span><span class="token punctuation">.</span><span class="token method function property-access">test</span><span class="token punctuation">(</span>props<span class="token punctuation">[</span>propName<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
<span class="token keyword control-flow keyword-return">return</span> <span class="token keyword keyword-new">new</span> <span class="token class-name">Error</span><span class="token punctuation">(</span>
<span class="token string">&apos;Invalid prop `&apos;</span> <span class="token operator">+</span> propName <span class="token operator">+</span> <span class="token string">&apos;` supplied to&apos;</span> <span class="token operator">+</span>
<span class="token string">&apos; `&apos;</span> <span class="token operator">+</span> componentName <span class="token operator">+</span> <span class="token string">&apos;`. Validation failed.&apos;</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">,</span>
</pre><hr>
<h3 class="mume-header" id="you-can-also-supply-a-custom-validator-to-arrayof-and-objectof">You can also supply a custom validator to <code>arrayOf</code> and <code>objectOf</code></h3>
<blockquote>
<p>It should return an Error object if the validation fails. The validator</p>
</blockquote>
<blockquote>
<p>will be called for each key in the array or object. The first two</p>
</blockquote>
<blockquote>
<p>arguments of the validator are the array or object itself, and the</p>
</blockquote>
<blockquote>
<p>current item&apos;s key.</p>
</blockquote>
<hr>
<pre data-role="codeBlock" data-info="js" class="language-javascript">customArrayProp<span class="token operator">:</span> <span class="token maybe-class-name">PropTypes</span><span class="token punctuation">.</span><span class="token method function property-access">arrayOf</span><span class="token punctuation">(</span><span class="token keyword keyword-function">function</span><span class="token punctuation">(</span><span class="token parameter">propValue<span class="token punctuation">,</span> key<span class="token punctuation">,</span> componentName<span class="token punctuation">,</span> <span class="token dom variable">location</span><span class="token punctuation">,</span> propFullName</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
<span class="token keyword control-flow keyword-if">if</span> <span class="token punctuation">(</span><span class="token operator">!</span><span class="token regex"><span class="token regex-delimiter">/</span><span class="token regex-source language-regex">matchme</span><span class="token regex-delimiter">/</span></span><span class="token punctuation">.</span><span class="token method function property-access">test</span><span class="token punctuation">(</span>propValue<span class="token punctuation">[</span>key<span class="token punctuation">]</span><span class="token punctuation">)</span><span class="token punctuation">)</span> <span class="token punctuation">{</span>
<span class="token keyword control-flow keyword-return">return</span> <span class="token keyword keyword-new">new</span> <span class="token class-name">Error</span><span class="token punctuation">(</span>
<span class="token string">&apos;Invalid prop `&apos;</span> <span class="token operator">+</span> propFullName <span class="token operator">+</span> <span class="token string">&apos;` supplied to&apos;</span> <span class="token operator">+</span>
<span class="token string">&apos; `&apos;</span> <span class="token operator">+</span> componentName <span class="token operator">+</span> <span class="token string">&apos;`. Validation failed.&apos;</span>
<span class="token punctuation">)</span><span class="token punctuation">;</span>
<span class="token punctuation">}</span>
<span class="token punctuation">}</span><span class="token punctuation">)</span>
<span class="token punctuation">}</span><span class="token punctuation">;</span>
</pre>
</div>
<div class="md-sidebar-toc"><ul>
<li><a href="#vanilla-js">Vanilla JS</a>
<ul>
<li><a href="#length-is-a-property-of-a-function-object-and-indicates-how-many-arguments-the-function-expects-ie-the-number-of-formal-parameters-this-number-does-not-include-the-rest-parameter-has-a-value-of-1">length is a property of a function object, and indicates how many arguments the function expects, i.e. the number of formal parameters. This number does not include the rest parameter. Has a value of 1</a></li>
<li><a href="#represents-the-object-prototype-object-and-allows-to-add-new-properties-and-methods-to-all-objects-of-type-object">Represents the Object prototype object and allows to add new properties and methods to all objects of type Object</a></li>
<li><a href="#copies-the-values-of-all-enumerable-own-properties-from-one-or-more-source-objects-to-a-target-object-method-is-used-to-copy-the-values-of-all-enumerable-own-properties-from-one-or-more-source-objects-to-a-target-object-it-will-return-the-target-object">Copies the values of all enumerable own properties from one or more source objects to a target object. method is used to copy the values of all enumerable own properties from one or more source objects to a target object. It will return the target object</a></li>
<li><a href="#creates-a-new-object-with-the-specified-prototype-object-and-properties-the-object-which-should-be-the-prototype-of-the-newly-created-object">Creates a new object with the specified prototype object and properties. The object which should be the prototype of the newly-created object</a></li>
<li><a href="#adds-the-named-property-described-by-a-given-descriptor-to-an-object">Adds the named property described by a given descriptor to an object</a></li>
<li><a href="#adds-the-named-properties-described-by-the-given-descriptors-to-an-object">Adds the named properties described by the given descriptors to an object</a></li>
<li><a href="#returns-an-array-containing-all-of-the-key-value-pairs-of-a-given-objects-own-enumerable-string-properties">Returns an array containing all of the [key, value] pairs of a given object&apos;s own enumerable string properties</a></li>
<li><a href="#freezes-an-object-other-code-cant-delete-or-change-any-properties">Freezes an object: other code can&apos;t delete or change any properties</a></li>
<li><a href="#returns-a-property-descriptor-for-a-named-property-on-an-object">Returns a property descriptor for a named property on an object</a></li>
<li><a href="#returns-an-object-containing-all-own-property-descriptors-for-an-object">Returns an object containing all own property descriptors for an object</a></li>
<li><a href="#returns-an-array-containing-the-names-of-all-of-the-given-objects-own-enumerable-and-non-enumerable-properties">Returns an array containing the names of all of the given object&apos;s own enumerable and non-enumerable properties</a></li>
<li><a href="#returns-an-array-of-all-symbol-properties-found-directly-upon-a-given-object">Returns an array of all symbol properties found directly upon a given object</a></li>
<li><a href="#returns-the-prototype-of-the-specified-object">Returns the prototype of the specified object</a></li>
<li><a href="#compares-if-two-values-are-the-same-value-equates-all-nan-values-which-differs-from-both-abstract-equality-comparison-and-strict-equality-comparison">Compares if two values are the same value. Equates all NaN values (which differs from both Abstract Equality Comparison and Strict Equality Comparison)</a></li>
<li><a href="#determines-if-extending-of-an-object-is-allowed">Determines if extending of an object is allowed</a></li>
<li><a href="#determines-if-an-object-was-frozen">Determines if an object was frozen</a></li>
<li><a href="#determines-if-an-object-is-sealed">Determines if an object is sealed</a></li>
<li><a href="#returns-an-array-containing-the-names-of-all-of-the-given-objects-own-enumerable-string-properties">Returns an array containing the names of all of the given object&apos;s own enumerable string properties</a></li>
<li><a href="#prevents-any-extensions-of-an-object">Prevents any extensions of an object</a></li>
<li><a href="#prevents-other-code-from-deleting-properties-of-an-object">Prevents other code from deleting properties of an object</a></li>
<li><a href="#sets-the-prototype-ie-the-internal-prototype-property">Sets the prototype (i.e., the internal </a><a href="Prototype.md">Prototype</a> property)</li>
<li><a href="#returns-an-array-containing-the-values-that-correspond-to-all-of-a-given-objects-own-enumerable-string-properties">Returns an array containing the values that correspond to all of a given object&apos;s own enumerable string properties</a></li>
<li><a href="#specifies-the-function-that-creates-an-objects-prototype">Specifies the function that creates an object&apos;s prototype</a></li>
<li><a href="#points-to-the-object-which-was-used-as-prototype-when-the-object-was-instantiated">Points to the object which was used as prototype when the object was instantiated</a></li>
<li><a href="#returns-a-boolean-indicating-whether-an-object-contains-the-specified-property-as-a-direct-property-of-that-object-and-not-inherited-through-the-prototype-chain">Returns a boolean indicating whether an object contains the specified property as a direct property of that object and not inherited through the prototype chain</a></li>
<li><a href="#returns-a-boolean-indicating-whether-the-object-this-method-is-called-upon-is-in-the-prototype-chain-of-the-specified-object">Returns a boolean indicating whether the object this method is called upon is in the prototype chain of the specified object</a></li>
<li><a href="#returns-a-boolean-indicating-if-the-internal-ecmascript-enumerable-attribute-is-set">Returns a boolean indicating if the internal ECMAScript </a><a href="Enumerable.md">Enumerable</a> attribute is set</li>
<li><a href="#calls-tostring">Calls toString()</a></li>
<li><a href="#returns-a-string-representation-of-the-object">Returns a string representation of the object</a></li>
<li><a href="#returns-the-primitive-value-of-the-specified-object">Returns the primitive value of the specified object</a></li>
<li><a href="#global-object-properties">Global object: properties</a>
<ul>
<li><a href="#reflects-the-number-of-elements-in-an-array">Reflects the number of elements in an array</a></li>
<li><a href="#represents-the-prototype-for-the-array-constructor-and-allows-to-add-new-properties-and-methods-to-all-array-objects">Represents the prototype for the Array constructor and allows to add new properties and methods to all Array objects</a></li>
</ul>
</li>
<li><a href="#global-object-methods">Global object: methods</a>
<ul>
<li><a href="#creates-a-new-array-instance-from-an-array-like-or-iterable-object">Creates a new Array instance from an array-like or iterable object</a></li>
<li><a href="#returns-true-if-a-variable-is-an-array-if-not-false">Returns true if a variable is an array, if not false</a></li>
<li><a href="#creates-a-new-array-instance-with-a-variable-number-of-arguments-regardless-of-number-or-type-of-the-arguments">Creates a new Array instance with a variable number of arguments, regardless of number or type of the arguments</a></li>
<li><a href="#reflects-the-number-of-elements-in-an-array-1">Reflects the number of elements in an array</a></li>
<li><a href="#copies-a-sequence-of-array-elements-within-the-array">Copies a sequence of array elements within the array</a></li>
<li><a href="#fills-all-the-elements-of-an-array-from-a-start-index-to-an-end-index-with-a-static-value">Fills all the elements of an array from a start index to an end index with a static value</a></li>
<li><a href="#removes-the-last-element-from-an-array-and-returns-that-element">Removes the last element from an array and returns that element</a></li>
<li><a href="#adds-one-or-more-elements-to-the-end-of-an-array-and-returns-the-new-length-of-the-array">Adds one or more elements to the end of an array and returns the new length of the array</a></li>
<li><a href="#reverses-the-order-of-the-elements-of-an-array-in-place-the-first-becomes-the-last-and-the-last-becomes-the-first">Reverses the order of the elements of an array in place &#x2014; the first becomes the last, and the last becomes the first</a></li>
<li><a href="#removes-the-first-element-from-an-array-and-returns-that-element">Removes the first element from an array and returns that element</a></li>
<li><a href="#sorts-the-elements-of-an-array-in-place-and-returns-the-array">Sorts the elements of an array in place and returns the array</a></li>
<li><a href="#adds-one-or-more-elements-to-the-front-of-an-array-and-returns-the-new-length-of-the-array">Adds one or more elements to the front of an array and returns the new length of the array</a></li>
<li><a href="#returns-a-new-array-comprised-of-this-array-joined-with-other-arrays-andor-values">Returns a new array comprised of this array joined with other array(s) and/or value(s)</a></li>
<li><a href="#determines-whether-an-array-contains-a-certain-element-returning-true-or-false-as-appropriate">Determines whether an array contains a certain element, returning true or false as appropriate</a></li>
<li><a href="#returns-the-first-least-index-of-an-element-within-the-array-equal-to-the-specified-value-or-1-if-none-is-found">Returns the first (least) index of an element within the array equal to the specified value, or -1 if none is found</a></li>
<li><a href="#joins-all-elements-of-an-array-into-a-string">Joins all elements of an array into a string</a></li>
<li><a href="#returns-the-last-greatest-index-of-an-element-within-the-array-equal-to-the-specified-value-or-1-if-none-is-found">Returns the last (greatest) index of an element within the array equal to the specified value, or -1 if none is found</a></li>
<li><a href="#extracts-a-section-of-an-array-and-returns-a-new-array">Extracts a section of an array and returns a new array</a></li>
<li><a href="#returns-a-string-representing-the-array-and-its-elements-overrides-the-objectprototypetostring-method">Returns a string representing the array and its elements. Overrides the Object.prototype.toString() method</a></li>
<li><a href="#returns-a-localized-string-representing-the-array-and-its-elements-overrides-the-objectprototypetolocalestring-method">Returns a localized string representing the array and its elements. Overrides the Object.prototype.toLocaleString() method</a></li>
<li><a href="#returns-a-new-array-iterator-object-that-contains-the-keyvalue-pairs-for-each-index-in-the-array">Returns a new Array Iterator object that contains the key/value pairs for each index in the array</a></li>
<li><a href="#returns-true-if-every-element-in-this-array-satisfies-the-provided-testing-function">Returns true if every element in this array satisfies the provided testing function</a></li>
<li><a href="#creates-a-new-array-with-all-of-the-elements-of-this-array-for-which-the-provided-filtering-function-returns-true">Creates a new array with all of the elements of this array for which the provided filtering function returns true</a></li>
<li><a href="#returns-the-found-value-in-the-array-if-an-element-in-the-array-satisfies-the-provided-testing-function-or-undefined-if-not-found">Returns the found value in the array, if an element in the array satisfies the provided testing function or undefined if not found</a></li>
<li><a href="#returns-the-found-index-in-the-array-if-an-element-in-the-array-satisfies-the-provided-testing-function-or-1-if-not-found">Returns the found index in the array, if an element in the array satisfies the provided testing function or -1 if not found</a></li>
<li><a href="#calls-a-function-for-each-element-in-the-array">Calls a function for each element in the array</a></li>
<li><a href="#returns-a-new-array-iterator-that-contains-the-keys-for-each-index-in-the-array">Returns a new Array Iterator that contains the keys for each index in the array</a></li>
<li><a href="#creates-a-new-array-with-the-results-of-calling-a-provided-function-on-every-element-in-this-array">Creates a new array with the results of calling a provided function on every element in this array</a></li>
<li><a href="#apply-a-function-against-an-accumulator-and-each-value-of-the-array-from-left-to-right-as-to-reduce-it-to-a-single-value">Apply a function against an accumulator and each value of the array (from left-to-right) as to reduce it to a single value</a></li>
<li><a href="#apply-a-function-against-an-accumulator-and-each-value-of-the-array-from-right-to-left-as-to-reduce-it-to-a-single-value">Apply a function against an accumulator and each value of the array (from right-to-left) as to reduce it to a single value</a></li>
<li><a href="#returns-true-if-at-least-one-element-in-this-array-satisfies-the-provided-testing-function">Returns true if at least one element in this array satisfies the provided testing function</a></li>
<li><a href="#returns-a-new-array-iterator-object-that-contains-the-values-for-each-index-in-the-array">Returns a new Array Iterator object that contains the values for each index in the array</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#nodejs">NodeJS</a>
<ul>
<li><a href="#an-example-of-a-web-server-written-with-node-which-responds-with-hello-world">An example of a web server written with Node which responds with &apos;Hello World&apos;</a></li>
<li><a href="#global-objects">GLOBAL OBJECTS</a>
<ul>
<li><a href="#in-browsers-the-top-level-scope-is-the-global-scope">In browsers, the top-level scope is the global scope</a></li>
<li><a href="#the-filename-of-the-code-being-executed-absolute-path">The filename of the code being executed. (absolute path)</a></li>
<li><a href="#a-reference-to-the-current-module-in-particular-moduleexports-is-used-for-defining-what-a-module-exports-and-makes-available-through-require">A reference to the current module. In particular module.exports is used for defining what a module exports and makes available through require()</a></li>
<li><a href="#a-reference-to-the-moduleexports-that-is-shorter-to-type">A reference to the module.exports that is shorter to type</a></li>
<li><a href="#the-process-object-is-a-global-object-and-can-be-accessed-from-anywhere-it-is-an-instance-of-eventemitter">The process object is a global object and can be accessed from anywhere. It is an instance of EventEmitter</a></li>
<li><a href="#the-buffer-class-is-a-global-type-for-dealing-with-binary-data-directly">The Buffer class is a global type for dealing with binary data directly</a></li>
<li><a href="#prints-to-stdout-with-newline">Prints to stdout with newline</a></li>
<li><a href="#same-as-consolelog-but-prints-to-stderr">Same as console.log but prints to stderr</a></li>
<li><a href="#same-as-consoleerror">Same as console.error</a></li>
<li><a href="#uses-utilinspect-on-obj-and-prints-resulting-string-to-stdout">Uses util.inspect on obj and prints resulting string to stdout</a></li>
<li><a href="#mark-a-time">Mark a time</a></li>
<li><a href="#finish-timer-record-output">Finish timer, record output</a></li>
<li><a href="#print-a-stack-trace-to-stderr-of-the-current-position">Print a stack trace to stderr of the current position</a></li>
<li><a href="#same-as-assertok-where-if-the-expression-evaluates-as-false-throw-an-assertionerror-with-message">Same as assert.ok() where if the expression evaluates as false throw an AssertionError with message</a></li>
<li><a href="#to-schedule-execution-of-a-one-time-callback-after-delay-milliseconds-optionally-you-can-also-pass-arguments-to-the-callback">To schedule execution of a one-time callback after delay milliseconds. Optionally you can also pass arguments to the callback</a></li>
<li><a href="#stop-a-timer-that-was-previously-created-with-settimeout">Stop a timer that was previously created with setTimeout()</a></li>
<li><a href="#to-schedule-the-repeated-execution-of-callback-every-delay-milliseconds-optionally-you-can-also-pass-arguments-to-the-callback">To schedule the repeated execution of callback every delay milliseconds. Optionally you can also pass arguments to the callback</a></li>
<li><a href="#stop-a-timer-that-was-previously-created-with-setinterval">Stop a timer that was previously created with setInterval()</a></li>
<li><a href="#to-schedule-the-immediate-execution-of-callback-after-io-events-callbacks-and-before-settimeout-and-setinterval">To schedule the &quot;immediate&quot; execution of callback after I/O events callbacks and before setTimeout and setInterval</a></li>
<li><a href="#stop-a-timer-that-was-previously-created-with-setimmediate">Stop a timer that was previously created with setImmediate()</a></li>
<li><a href="#allow-you-to-create-a-timer-that-is-active-but-if-it-is-the-only-item-left-in-the-event-loop-node-wont-keep-the-program-running">Allow you to create a timer that is active but if it is the only item left in the event loop, node won&apos;t keep the program running</a></li>
<li><a href="#if-you-had-previously-unrefd-a-timer-you-can-call-ref-to-explicitly-request-the-timer-hold-the-program-open">If you had previously unref()d a timer you can call ref() to explicitly request the timer hold the program open</a></li>
<li><a href="#load-another_module-as-if-require-was-called-from-the-module-itself">load another_module as if require() was called from the module itself</a></li>
<li><a href="#the-identifier-for-the-module-typically-this-is-the-fully-resolved-filename">The identifier for the module. Typically this is the fully resolved filename</a></li>
<li><a href="#the-fully-resolved-filename-to-the-module">The fully resolved filename to the module</a></li>
<li><a href="#whether-or-not-the-module-is-done-loading-or-is-in-the-process-of-loading">Whether or not the module is done loading, or is in the process of loading</a></li>
<li><a href="#the-module-that-required-this-one">The module that required this one</a></li>
<li><a href="#the-module-objects-required-by-this-one">The module objects required by this one</a></li>
<li><a href="#if-you-want-the-root-of-your-modules-export-to-be-a-function-such-as-a-constructor">If you want the root of your module&apos;s export to be a function (such as a constructor)</a></li>
<li><a href="#emitted-when-the-process-is-about-to-exit">Emitted when the process is about to exit</a></li>
<li><a href="#a-writable-stream-to-stdout">A writable stream to stdout</a></li>
<li><a href="#a-writable-stream-to-stderr">A writable stream to stderr</a></li>
<li><a href="#a-readable-stream-for-stdin">A readable stream for stdin</a></li>
<li><a href="#an-array-containing-the-command-line-arguments">An array containing the command line arguments</a></li>
<li><a href="#an-object-containing-the-user-environment">An object containing the user environment</a></li>
<li><a href="#this-is-the-absolute-pathname-of-the-executable-that-started-the-process">This is the absolute pathname of the executable that started the process</a></li>
<li><a href="#this-is-the-set-of-node-specific-command-line-options-from-the-executable-that-started-the-process">This is the set of node-specific command line options from the executable that started the process</a></li>
<li><a href="#what-processor-architecture-youre-running-on-arm-ia32-or-x64">What processor architecture you&apos;re running on: &apos;arm&apos;, &apos;ia32&apos;, or &apos;x64&apos;</a></li>
<li><a href="#an-object-containing-the-javascript-representation-of-the-configure-options-that-were-used-to-compile-the-current-node-executable">An Object containing the JavaScript representation of the configure options that were used to compile the current node executable</a></li>
<li><a href="#the-pid-of-the-process">The PID of the process</a></li>
<li><a href="#what-platform-youre-running-on-darwin-freebsd-linux-sunos-or-win32">What platform you&apos;re running on: &apos;darwin&apos;, &apos;freebsd&apos;, &apos;linux&apos;, &apos;sunos&apos; or &apos;win32&apos;</a></li>
<li><a href="#gettersetter-to-set-what-is-displayed-in-ps">Getter/setter to set what is displayed in &apos;ps&apos;</a></li>
<li><a href="#a-compiled-in-property-t">A compiled-in property t</a></li>
<li><a href="#a-property-exposing-version-strings-of-node-and-its-dependencies">A property exposing version strings of node and its dependencies</a></li>
<li><a href="#this-causes-node-to-emit-an-abort-this-will-cause-node-to-exit-and-generate-a-core-file">This causes node to emit an abort. This will cause node to exit and generate a core file</a></li>
<li><a href="#changes-the-current-working-directory-of-the-process-or-throws-an-exception-if-that-fails">Changes the current working directory of the process or throws an exception if that fails</a></li>
<li><a href="#returns-the-current-working-directory-of-the-process">Returns the current working directory of the process</a></li>
<li><a href="#gets-the-group-identity-of-the-process">Gets the group identity of the process</a></li>
<li><a href="#sets-the-group-identity-of-the-process">Sets the group identity of the process</a></li>
<li><a href="#gets-the-user-identity-of-the-process">Gets the user identity of the process</a></li>
<li><a href="#sets-the-user-identity-of-the-process">Sets the user identity of the process</a></li>
<li><a href="#returns-an-array-with-the-supplementary-group-ids">Returns an array with the supplementary group IDs</a></li>
<li><a href="#sets-the-supplementary-group-ids">Sets the supplementary group IDs</a></li>
<li><a href="#reads-etcgroup-and-initializes-the-group-access-list-using-all-groups-of-which-the-user-is-a-member">Reads /etc/group and initializes the group access list, using all groups of which the user is a member</a></li>
<li><a href="#send-a-signal-to-a-process-pid-is-the-process-id-and-signal-is-the-string-describing-the-signal-to-send">Send a signal to a process. pid is the process id and signal is the string describing the signal to send</a></li>
<li><a href="#returns-an-object-describing-the-memory-usage-of-the-node-process-measured-in-bytes">Returns an object describing the memory usage of the Node process measured in bytes</a></li>
<li><a href="#on-the-next-loop-around-the-event-loop-call-this-callback">On the next loop around the event loop call this callback</a></li>
<li><a href="#callbacks-passed-to-processnexttick-will-usually-be-called-at-the-end-of-the-current-flow-of-execution-and-are-thus-approximately-as-fast-as-calling-a-function-synchronously">Callbacks passed to process.nextTick will usually be called at the end of the current flow of execution, and are thus approximately as fast as calling a function synchronously</a></li>
<li><a href="#sets-or-reads-the-processs-file-mode-creation-mask">Sets or reads the process&apos;s file mode creation mask</a></li>
<li><a href="#number-of-seconds-node-has-been-running">Number of seconds Node has been running</a></li>
<li><a href="#returns-the-current-high-resolution-real-time-in-a-seconds-nanoseconds-tuple-array">Returns the current high-resolution real time in a [seconds, nanoseconds] tuple Array</a></li>
<li><a href="#class-childprocess-is-an-eventemitter">Class. ChildProcess is an EventEmitter</a></li>
<li><a href="#a-writable-stream-that-represents-the-child-processs-stdin">A Writable Stream that represents the child process&apos;s stdin</a></li>
<li><a href="#a-readable-stream-that-represents-the-child-processs-stderr">A Readable Stream that represents the child process&apos;s stderr</a></li>
<li><a href="#the-pid-of-the-child-process">The PID of the child process</a></li>
<li><a href="#send-a-signal-to-the-child-process">Send a signal to the child process</a></li>
<li><a href="#when-using-child_processfork-you-can-write-to-the-child-using-childsendmessage-sendhandle-and-messages-are-received-by-a-message-event-on-the-child">When using child_process.fork() you can write to the child using child.send(message, [sendHandle]) and messages are received by a &apos;message&apos; event on the child</a></li>
<li><a href="#close-the-ipc-channel-between-parent-and-child-allowing-the-child-to-exit-gracefully-once-there-are-no-other-connections-keeping-it-alive">Close the IPC channel between parent and child, allowing the child to exit gracefully once there are no other connections keeping it alive</a></li>
<li><a href="#launches-a-new-process-with-the-given-command-with-command-line-arguments-in-args-if-omitted-args-defaults-to-an-empty-array">Launches a new process with the given command, with command line arguments in args. If omitted, args defaults to an empty Array</a></li>
<li><a href="#runs-a-command-in-a-shell-and-buffers-the-output">Runs a command in a shell and buffers the output</a></li>
<li><a href="#runs-a-command-in-a-shell-and-buffers-the-output-1">Runs a command in a shell and buffers the output</a></li>
<li><a href="#this-is-a-special-case-of-the-spawn-functionality-for-spawning-node-processes-in-addition-to-having-all-the-methods-in-a-normal-childprocess-instance-the-returned-object-has-a-communication-channel-built-in">This is a special case of the spawn() functionality for spawning Node processes. In addition to having all the methods in a normal ChildProcess instance, the returned object has a communication channel built-in</a></li>
<li><a href="#returns-a-formatted-string-using-the-first-argument-as-a-printf-like-format-s-d-j">Returns a formatted string using the first argument as a printf-like format. (%s, %d, %j)</a></li>
<li><a href="#a-synchronous-output-function-will-block-the-process-and-output-string-immediately-to-stderr">A synchronous output function. Will block the process and output string immediately to stderr</a></li>
<li><a href="#same-as-utildebug-except-this-will-output-all-arguments-immediately-to-stderr">Same as util.debug() except this will output all arguments immediately to stderr</a></li>
<li><a href="#a-synchronous-output-function-will-block-the-process-and-output-all-arguments-to-stdout-with-newlines-after-each-argument">A synchronous output function. Will block the process and output all arguments to stdout with newlines after each argument</a></li>
<li><a href="#a-synchronous-output-function-will-block-the-process-cast-each-argument-to-a-string-then-output-to-stdout-no-newlines">A synchronous output function. Will block the process, cast each argument to a string then output to stdout. (no newlines)</a></li>
<li><a href="#return-a-string-representation-of-object-which-is-useful-for-debugging-options-showhidden-depth-colors-custominspect">Return a string representation of object, which is useful for debugging. (options: showHidden, depth, colors, customInspect)</a></li>
<li><a href="#returns-true-if-the-given-object-is-a-regexp-false-otherwise">Returns true if the given &quot;object&quot; is a RegExp. false otherwise</a></li>
<li><a href="#returns-true-if-the-given-object-is-a-date-false-otherwise">Returns true if the given &quot;object&quot; is a Date. false otherwise</a></li>
<li><a href="#returns-true-if-the-given-object-is-an-error-false-otherwise">Returns true if the given &quot;object&quot; is an Error. false otherwise</a></li>
<li><a href="#takes-a-function-whose-last-argument-is-a-callback-and-returns-a-version-that-returns-promises">Takes a function whose last argument is a callback and returns a version that returns promises</a></li>
<li><a href="#inherit-the-prototype-methods-from-one-constructor-into-another">Inherit the prototype methods from one constructor into another</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#events">EVENTS</a>
<ul>
<li><a href="#to-access-the-eventemitter-class-requireeventseventemitter">To access the EventEmitter class, require(&apos;events&apos;).EventEmitter</a></li>
<li><a href="#adds-a-listener-to-the-end-of-the-listeners-array-for-the-specified-event">Adds a listener to the end of the listeners array for the specified event</a></li>
<li><a href="#same-as-emitteraddlistener">Same as emitter.addListener()</a></li>
<li><a href="#remove-a-listener-from-the-listener-array-for-the-specified-event">Remove a listener from the listener array for the specified event</a></li>
<li><a href="#removes-all-listeners-or-those-of-the-specified-event">Removes all listeners, or those of the specified event</a></li>
<li><a href="#by-default-eventemitters-will-print-a-warning-if-more-than-10-listeners-are-added-for-a-particular-event">By default EventEmitters will print a warning if more than 10 listeners are added for a particular event</a></li>
<li><a href="#returns-an-array-of-listeners-for-the-specified-event">Returns an array of listeners for the specified event</a></li>
<li><a href="#execute-each-of-the-listeners-in-order-with-the-supplied-arguments-returns-true-if-event-had-listeners-false-otherwise">Execute each of the listeners in order with the supplied arguments. Returns true if event had listeners, false otherwise</a></li>
<li><a href="#return-the-number-of-listeners-for-a-given-event">Return the number of listeners for a given event</a></li>
<li><a href="#when-a-chunk-of-data-can-be-read-from-the-stream-it-will-emit-a-readable-event">When a chunk of data can be read from the stream, it will emit a &apos;readable&apos; event</a></li>
<li><a href="#if-you-attach-a-data-event-listener-then-it-will-switch-the-stream-into-flowing-mode-and-data-will-be-passed-to-your-handler-as-soon-as-it-is-available">If you attach a data event listener, then it will switch the stream into flowing mode, and data will be passed to your handler as soon as it is available</a></li>
<li><a href="#this-event-fires-when-there-will-be-no-more-data-to-read">This event fires when there will be no more data to read</a></li>
<li><a href="#emitted-when-the-underlying-resource-for-example-the-backing-file-descriptor-has-been-closed-not-all-streams-will-emit-this">Emitted when the underlying resource (for example, the backing file descriptor) has been closed. Not all streams will emit this</a></li>
<li><a href="#emitted-if-there-was-an-error-receiving-data">Emitted if there was an error receiving data</a></li>
<li><a href="#call-this-function-to-cause-the-stream-to-return-strings-of-the-specified-encoding-instead-of-buffer-objects">Call this function to cause the stream to return strings of the specified encoding instead of Buffer objects</a></li>
<li><a href="#this-method-will-cause-the-readable-stream-to-resume-emitting-data-events">This method will cause the readable stream to resume emitting data events</a></li>
<li><a href="#this-method-will-cause-a-stream-in-flowing-mode-to-stop-emitting-data-events">This method will cause a stream in flowing-mode to stop emitting data events</a></li>
<li><a href="#this-method-pulls-all-the-data-out-of-a-readable-stream-and-writes-it-to-the-supplied-destination-automatically-managing-the-flow-so-that-the-destination-is-not-overwhelmed-by-a-fast-readable-stream">This method pulls all the data out of a readable stream, and writes it to the supplied destination, automatically managing the flow so that the destination is not overwhelmed by a fast readable stream</a></li>
<li><a href="#this-method-will-remove-the-hooks-set-up-for-a-previous-pipe-call-if-the-destination-is-not-specified-then-all-pipes-are-removed">This method will remove the hooks set up for a previous pipe() call. If the destination is not specified, then all pipes are removed</a></li>
<li><a href="#this-is-useful-in-certain-cases-where-a-stream-is-being-consumed-by-a-parser-which-needs-to-un-consume-some-data-that-it-has-optimistically-pulled-out-of-the-source-so-that-the-stream-can-be-passed-on-to-some-other-party">This is useful in certain cases where a stream is being consumed by a parser, which needs to &quot;un-consume&quot; some data that it has optimistically pulled out of the source, so that the stream can be passed on to some other party</a></li>
<li><a href="#this-method-writes-some-data-to-the-underlying-system-and-calls-the-supplied-callback-once-the-data-has-been-fully-handled">This method writes some data to the underlying system, and calls the supplied callback once the data has been fully handled</a></li>
<li><a href="#if-a-writablewritechunk-call-returns-false-then-the-drain-event-will-indicate-when-it-is-appropriate-to-begin-writing-more-data-to-the-stream">If a writable.write(chunk) call returns false, then the drain event will indicate when it is appropriate to begin writing more data to the stream</a></li>
<li><a href="#call-this-method-when-no-more-data-will-be-written-to-the-stream">Call this method when no more data will be written to the stream</a></li>
<li><a href="#when-the-end-method-has-been-called-and-all-data-has-been-flushed-to-the-underlying-system-this-event-is-emitted">When the end() method has been called, and all data has been flushed to the underlying system, this event is emitted</a></li>
<li><a href="#this-is-emitted-whenever-the-pipe-method-is-called-on-a-readable-stream-adding-this-writable-to-its-set-of-destinations">This is emitted whenever the pipe() method is called on a readable stream, adding this writable to its set of destinations</a></li>
<li><a href="#this-is-emitted-whenever-the-unpipe-method-is-called-on-a-readable-stream-removing-this-writable-from-its-set-of-destinations">This is emitted whenever the unpipe() method is called on a readable stream, removing this writable from its set of destinations</a></li>
<li><a href="#emitted-if-there-was-an-error-when-writing-or-piping-data">Emitted if there was an error when writing or piping data</a></li>
</ul>
</li>
<li><a href="#to-use-this-module-do-requirefs">To use this module do require(&apos;fs&apos;)</a>
<ul>
<li><a href="#asynchronous-rename-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callbackasynchronous-ftruncate-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous rename. No arguments other than a possible exception are given to the completion callback.Asynchronous ftruncate. No arguments other than a possible exception are given to the completion callback</a></li>
<li><a href="#synchronous-rename">Synchronous rename</a></li>
<li><a href="#asynchronous-ftruncate-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous ftruncate. No arguments other than a possible exception are given to the completion callback</a></li>
<li><a href="#synchronous-ftruncate">Synchronous ftruncate</a></li>
<li><a href="#asynchronous-truncate-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous truncate. No arguments other than a possible exception are given to the completion callback</a></li>
<li><a href="#synchronous-truncate">Synchronous truncate</a></li>
<li><a href="#asynchronous-chown-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous chown. No arguments other than a possible exception are given to the completion callback</a></li>
<li><a href="#synchronous-chown">Synchronous chown</a></li>
<li><a href="#asynchronous-fchown-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous fchown. No arguments other than a possible exception are given to the completion callback</a></li>
<li><a href="#synchronous-fchown">Synchronous fchown</a></li>
<li><a href="#asynchronous-lchown-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous lchown. No arguments other than a possible exception are given to the completion callback</a></li>
<li><a href="#synchronous-lchown">Synchronous lchown</a></li>
<li><a href="#asynchronous-chmod-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous chmod. No arguments other than a possible exception are given to the completion callback</a></li>
<li><a href="#synchronous-chmod">Synchronous chmod</a></li>
<li><a href="#asynchronous-fchmod-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous fchmod. No arguments other than a possible exception are given to the completion callback</a></li>
<li><a href="#synchronous-fchmod">Synchronous fchmod</a></li>
<li><a href="#asynchronous-lchmod-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous lchmod. No arguments other than a possible exception are given to the completion callback</a></li>
<li><a href="#synchronous-lchmod">Synchronous lchmod</a></li>
<li><a href="#asynchronous-stat-the-callback-gets-two-arguments-err-stats-where-stats-is-a-fsstats-object">Asynchronous stat. The callback gets two arguments (err, stats) where stats is a fs.Stats object</a></li>
<li><a href="#synchronous-stat-returns-an-instance-of-fsstats">Synchronous stat. Returns an instance of fs.Stats</a></li>
<li><a href="#asynchronous-lstat-the-callback-gets-two-arguments-err-stats-where-stats-is-a-fsstats-object-lstat-is-identical-to-stat-except-that-if-path-is-a-symbolic-link-then-the-link-itself-is-stat-ed-not-the-file-that-it-refers-to">Asynchronous lstat. The callback gets two arguments (err, stats) where stats is a fs.Stats object. lstat() is identical to stat(), except that if path is a symbolic link, then the link itself is stat-ed, not the file that it refers to</a></li>
<li><a href="#synchronous-lstat-returns-an-instance-of-fsstats">Synchronous lstat. Returns an instance of fs.Stats</a></li>
<li><a href="#asynchronous-fstat-the-callback-gets-two-arguments-err-stats-where-stats-is-a-fsstats-object-fstat-is-identical-to-stat-except-that-the-file-to-be-stat-ed-is-specified-by-the-file-descriptor-fd">Asynchronous fstat. The callback gets two arguments (err, stats) where stats is a fs.Stats object. fstat() is identical to stat(), except that the file to be stat-ed is specified by the file descriptor fd</a></li>
<li><a href="#synchronous-fstat-returns-an-instance-of-fsstats">Synchronous fstat. Returns an instance of fs.Stats</a></li>
<li><a href="#asynchronous-link-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous link. No arguments other than a possible exception are given to the completion callback</a></li>
<li><a href="#synchronous-link">Synchronous link</a></li>
<li><a href="#asynchronous-symlink-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback-the-type-argument-can-be-set-to-dir-file-or-junction-default-is-file-and-is-only-available-on-windows-ignored-on-other-platforms">Asynchronous symlink. No arguments other than a possible exception are given to the completion callback. The type argument can be set to &apos;dir&apos;, &apos;file&apos;, or &apos;junction&apos; (default is &apos;file&apos;) and is only available on Windows (ignored on other platforms)</a></li>
<li><a href="#synchronous-symlink">Synchronous symlink</a></li>
<li><a href="#asynchronous-readlink-the-callback-gets-two-arguments-err-linkstring">Asynchronous readlink. The callback gets two arguments (err, linkString)</a></li>
<li><a href="#synchronous-readlink-returns-the-symbolic-links-string-value">Synchronous readlink. Returns the symbolic link&apos;s string value</a></li>
<li><a href="#asynchronous-unlink-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous unlink. No arguments other than a possible exception are given to the completion callback</a></li>
<li><a href="#synchronous-unlink">Synchronous unlink</a></li>
<li><a href="#asynchronous-realpath-the-callback-gets-two-arguments-err-resolvedpath">Asynchronous realpath. The callback gets two arguments (err, resolvedPath)</a></li>
</ul>
</li>
<li><a href="#synchronous-realpath-returns-the-resolved-path">Synchronous realpath. Returns the resolved path</a>
<ul>
<li><a href="#asynchronous-rmdir-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous rmdir. No arguments other than a possible exception are given to the completion callback</a></li>
<li><a href="#synchronous-rmdir">Synchronous rmdir</a></li>
<li><a href="#asynchronous-mkdir-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback-mode-defaults-to-0777">Asynchronous mkdir. No arguments other than a possible exception are given to the completion callback. mode defaults to 0777</a></li>
<li><a href="#synchronous-mkdir">Synchronous mkdir</a></li>
<li><a href="#asynchronous-readdir-reads-the-contents-of-a-directory-the-callback-gets-two-arguments-err-files-where-files-is-an-array-of-the-names-of-the-files-in-the-directory-excluding-and">Asynchronous readdir. Reads the contents of a directory. The callback gets two arguments (err, files) where files is an array of the names of the files in the directory excluding &apos;.&apos; and &apos;..&apos;</a></li>
<li><a href="#synchronous-readdir-returns-an-array-of-filenames-excluding-and">Synchronous readdir. Returns an array of filenames excluding &apos;.&apos; and &apos;..&apos;</a></li>
<li><a href="#asynchronous-close-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous close. No arguments other than a possible exception are given to the completion callback</a></li>
<li><a href="#synchronous-close">Synchronous close</a></li>
<li><a href="#asynchronous-file-open">Asynchronous file open</a></li>
<li><a href="#synchronous-version-of-fsopen">Synchronous version of fs.open()</a></li>
<li><a href="#change-file-timestamps-of-the-file-referenced-by-the-supplied-path">Change file timestamps of the file referenced by the supplied path</a></li>
<li><a href="#synchronous-version-of-fsutimes">Synchronous version of fs.utimes()</a></li>
<li><a href="#change-the-file-timestamps-of-a-file-referenced-by-the-supplied-file-descriptor">Change the file timestamps of a file referenced by the supplied file descriptor</a></li>
<li><a href="#synchronous-version-of-fsfutimes">Synchronous version of fs.futimes()</a></li>
<li><a href="#asynchronous-fsync-no-arguments-other-than-a-possible-exception-are-given-to-the-completion-callback">Asynchronous fsync. No arguments other than a possible exception are given to the completion callback</a></li>
<li><a href="#synchronous-fsync">Synchronous fsync</a></li>
<li><a href="#write-buffer-to-the-file-specified-by-fd">Write buffer to the file specified by fd</a></li>
<li><a href="#synchronous-version-of-fswrite-returns-the-number-of-bytes-written">Synchronous version of fs.write(). Returns the number of bytes written</a></li>
<li><a href="#read-data-from-the-file-specified-by-fd">Read data from the file specified by fd</a></li>
<li><a href="#synchronous-version-of-fsread-returns-the-number-of-bytesread">Synchronous version of fs.read. Returns the number of bytesRead</a></li>
<li><a href="#asynchronously-reads-the-entire-contents-of-a-file">Asynchronously reads the entire contents of a file</a></li>
<li><a href="#synchronous-version-of-fsreadfile-returns-the-contents-of-the-filename-if-the-encoding-option-is-specified-then-this-function-returns-a-string-otherwise-it-returns-a-buffer">Synchronous version of fs.readFile. Returns the contents of the filename. If the encoding option is specified then this function returns a string. Otherwise it returns a buffer</a></li>
<li><a href="#asynchronously-writes-data-to-a-file-replacing-the-file-if-it-already-exists-data-can-be-a-string-or-a-buffer">Asynchronously writes data to a file, replacing the file if it already exists. data can be a string or a buffer</a></li>
<li><a href="#the-synchronous-version-of-fswritefile">The synchronous version of fs.writeFile</a></li>
<li><a href="#asynchronously-append-data-to-a-file-creating-the-file-if-it-not-yet-exists-data-can-be-a-string-or-a-buffer">Asynchronously append data to a file, creating the file if it not yet exists. data can be a string or a buffer</a></li>
<li><a href="#the-synchronous-version-of-fsappendfile">The synchronous version of fs.appendFile</a></li>
<li><a href="#watch-for-changes-on-filename-where-filename-is-either-a-file-or-a-directory-the-returned-object-is-a-fsfswatcher-the-listener-callback-gets-two-arguments-event-filename-event-is-either-rename-or-change-and-filename-is-the-name-of-the-file-which-triggered-the-event">Watch for changes on filename, where filename is either a file or a directory. The returned object is a fs.FSWatcher. The listener callback gets two arguments (event, filename). event is either &apos;rename&apos; or &apos;change&apos;, and filename is the name of the file which triggered the event</a></li>
<li><a href="#test-whether-or-not-the-given-path-exists-by-checking-with-the-file-system-then-call-the-callback-argument-with-either-true-or-false-should-not-be-used">Test whether or not the given path exists by checking with the file system. Then call the callback argument with either true or false. (should not be used)</a></li>
<li><a href="#returns-a-new-readstream-object">Returns a new ReadStream object</a></li>
<li><a href="#returns-a-new-writestream-object">Returns a new WriteStream object</a></li>
<li><a href="#normalize-a-string-path-taking-care-of-and-parts">Normalize a string path, taking care of &apos;..&apos; and &apos;.&apos; parts</a></li>
<li><a href="#join-all-arguments-together-and-normalize-the-resulting-path">Join all arguments together and normalize the resulting path</a></li>
<li><a href="#resolves-to-to-an-absolute-path">Resolves &apos;to&apos; to an absolute path</a></li>
<li><a href="#solve-the-relative-path-from-from-to-to">Solve the relative path from &apos;from&apos; to &apos;to&apos;</a></li>
<li><a href="#return-the-directory-name-of-a-path-similar-to-the-unix-dirname-command">Return the directory name of a path. Similar to the Unix dirname command</a></li>
<li><a href="#return-the-extension-of-the-path-from-the-last-to-end-of-string-in-the-last-portion-of-the-path">Return the extension of the path, from the last &apos;.&apos; to end of string in the last portion of the path</a></li>
<li><a href="#the-platform-specific-file-separator-or">The platform-specific file separator. &apos;\&apos; or &apos;/&apos;</a></li>
<li><a href="#the-platform-specific-path-delimiter-or">The platform-specific path delimiter, &apos;;&apos; or &apos;:&apos;</a></li>
<li><a href="#a-collection-of-all-the-standard-http-response-status-codes-and-the-short-description-of-each">A collection of all the standard HTTP response status codes, and the short description of each</a></li>
<li><a href="#set-the-method-to-get-and-calls-reqend-automatically">Set the method to GET and calls req.end() automatically</a></li>
<li><a href="#returns-a-new-web-server-object-the-requestlistener-is-a-function-which-is-automatically-added-to-the-request-event">Returns a new web server object. The requestListener is a function which is automatically added to the &apos;request&apos; event</a></li>
<li><a href="#begin-accepting-connections-on-the-specified-port-and-hostname">Begin accepting connections on the specified port and hostname</a></li>
<li><a href="#start-a-unix-socket-server-listening-for-connections-on-the-given-path">Start a UNIX socket server listening for connections on the given path</a></li>
<li><a href="#the-handle-object-can-be-set-to-either-a-server-or-socket-anything-with-an-underlying-_handle-member-or-a-fd-n-object">The handle object can be set to either a server or socket (anything with an underlying _handle member), or a {fd: <n>} object</n></a></li>
<li><a href="#stops-the-server-from-accepting-new-connections">Stops the server from accepting new connections</a></li>
<li><a href="#sets-the-timeout-value-for-sockets-and-emits-a-timeout-event-on-the-server-object-passing-the-socket-as-an-argument-if-a-timeout-occurs">Sets the timeout value for sockets, and emits a &apos;timeout&apos; event on the Server object, passing the socket as an argument, if a timeout occurs</a></li>
<li><a href="#limits-maximum-incoming-headers-count-equal-to-1000-by-default-if-set-to-0-no-limit-will-be-applied">Limits maximum incoming headers count, equal to 1000 by default. If set to 0 - no limit will be applied</a></li>
<li><a href="#the-number-of-milliseconds-of-inactivity-before-a-socket-is-presumed-to-have-timed-out">The number of milliseconds of inactivity before a socket is presumed to have timed out</a></li>
<li><a href="#emitted-each-time-there-is-a-request">Emitted each time there is a request</a></li>
<li><a href="#when-a-new-tcp-stream-is-established">When a new TCP stream is established</a></li>
<li><a href="#emitted-when-the-server-closes">Emitted when the server closes</a></li>
<li><a href="#emitted-each-time-a-request-with-an-http-expect-100-continue-is-received">Emitted each time a request with an http Expect: 100-continue is received</a></li>
<li><a href="#emitted-each-time-a-client-requests-a-http-connect-method">Emitted each time a client requests a http CONNECT method</a></li>
<li><a href="#emitted-each-time-a-client-requests-a-http-upgrade">Emitted each time a client requests a http upgrade</a></li>
<li><a href="#if-a-client-connection-emits-an-error-event-it-will-forwarded-here">If a client connection emits an &apos;error&apos; event - it will forwarded here</a></li>
<li><a href="#sends-a-chunk-of-the-body">Sends a chunk of the body</a></li>
<li><a href="#finishes-sending-the-request-if-any-parts-of-the-body-are-unsent-it-will-flush-them-to-the-stream">Finishes sending the request. If any parts of the body are unsent, it will flush them to the stream</a></li>
<li><a href="#aborts-a-request">Aborts a request</a></li>
<li><a href="#once-a-socket-is-assigned-to-this-request-and-is-connected-socketsettimeout-will-be-called">Once a socket is assigned to this request and is connected socket.setTimeout() will be called</a></li>
<li><a href="#once-a-socket-is-assigned-to-this-request-and-is-connected-socketsetnodelay-will-be-called">Once a socket is assigned to this request and is connected socket.setNoDelay() will be called</a></li>
<li><a href="#once-a-socket-is-assigned-to-this-request-and-is-connected-socketsetkeepalive-will-be-called">Once a socket is assigned to this request and is connected socket.setKeepAlive() will be called</a></li>
<li><a href="#emitted-when-a-response-is-received-to-this-request-this-event-is-emitted-only-once">Emitted when a response is received to this request. This event is emitted only once</a></li>
<li><a href="#emitted-after-a-socket-is-assigned-to-this-request">Emitted after a socket is assigned to this request</a></li>
<li><a href="#emitted-each-time-a-server-responds-to-a-request-with-a-connect-method-if-this-event-isnt-being-listened-for-clients-receiving-a-connect-method-will-have-their-connections-closed">Emitted each time a server responds to a request with a CONNECT method. If this event isn&apos;t being listened for, clients receiving a CONNECT method will have their connections closed</a></li>
<li><a href="#emitted-each-time-a-server-responds-to-a-request-with-an-upgrade-if-this-event-isnt-being-listened-for-clients-receiving-an-upgrade-header-will-have-their-connections-closed">Emitted each time a server responds to a request with an upgrade. If this event isn&apos;t being listened for, clients receiving an upgrade header will have their connections closed</a></li>
<li><a href="#emitted-when-the-server-sends-a-100-continue-http-response-usually-because-the-request-contained-expect-100-continue-this-is-an-instruction-that-the-client-should-send-the-request-body">Emitted when the server sends a &apos;100 Continue&apos; HTTP response, usually because the request contained &apos;Expect: 100-continue&apos;. This is an instruction that the client should send the request body</a></li>
<li><a href="#this-sends-a-chunk-of-the-response-body-if-this-merthod-is-called-and-responsewritehead-has-not-been-called-it-will-switch-to-implicit-header-mode-and-flush-the-implicit-headers">This sends a chunk of the response body. If this merthod is called and response.writeHead() has not been called, it will switch to implicit header mode and flush the implicit headers</a></li>
<li><a href="#sends-a-http11-100-continue-message-to-the-client-indicating-that-the-request-body-should-be-sent">Sends a HTTP/1.1 100 Continue message to the client, indicating that the request body should be sent</a></li>
<li><a href="#sends-a-response-header-to-the-request">Sends a response header to the request</a></li>
<li><a href="#sets-the-sockets-timeout-value-to-msecs-if-a-callback-is-provided-then-it-is-added-as-a-listener-on-the-timeout-event-on-the-response-object">Sets the Socket&apos;s timeout value to msecs. If a callback is provided, then it is added as a listener on the &apos;timeout&apos; event on the response object</a></li>
<li><a href="#sets-a-single-header-value-for-implicit-headers-if-this-header-already-exists-in-the-to-be-sent-headers-its-value-will-be-replaced-use-an-array-of-strings-here-if-you-need-to-send-multiple-headers-with-the-same-name">Sets a single header value for implicit headers. If this header already exists in the to-be-sent headers, its value will be replaced. Use an array of strings here if you need to send multiple headers with the same name</a></li>
<li><a href="#reads-out-a-header-thats-already-been-queued-but-not-sent-to-the-client-note-that-the-name-is-case-insensitive">Reads out a header that&apos;s already been queued but not sent to the client. Note that the name is case insensitive</a></li>
<li><a href="#removes-a-header-thats-queued-for-implicit-sending">Removes a header that&apos;s queued for implicit sending</a></li>
<li><a href="#this-method-adds-http-trailing-headers-a-header-but-at-the-end-of-the-message-to-the-response">This method adds HTTP trailing headers (a header but at the end of the message) to the response</a></li>
<li><a href="#this-method-signals-to-the-server-that-all-of-the-response-headers-and-body-have-been-sent-that-server-should-consider-this-message-complete-the-method-responseend-must-be-called-on-each-response">This method signals to the server that all of the response headers and body have been sent; that server should consider this message complete. The method, response.end(), MUST be called on each response</a></li>
<li><a href="#when-using-implicit-headers-not-calling-responsewritehead-explicitly-this-property-controls-the-status-code-that-will-be-sent-to-the-client-when-the-headers-get-flushed">When using implicit headers (not calling response.writeHead() explicitly), this property controls the status code that will be sent to the client when the headers get flushed</a></li>
<li><a href="#boolean-read-only-true-if-headers-were-sent-false-otherwise">Boolean (read-only). True if headers were sent, false otherwise</a></li>
<li><a href="#when-true-the-date-header-will-be-automatically-generated-and-sent-in-the-response-if-it-is-not-already-present-in-the-headers-defaults-to-true">When true, the Date header will be automatically generated and sent in the response if it is not already present in the headers. Defaults to true</a></li>
<li><a href="#indicates-that-the-underlying-connection-was-terminated-before-responseend-was-called-or-able-to-flush">Indicates that the underlying connection was terminated before response.end() was called or able to flush</a></li>
<li><a href="#emitted-when-the-response-has-been-sent">Emitted when the response has been sent</a></li>
<li><a href="#in-case-of-server-request-the-http-version-sent-by-the-client-in-the-case-of-client-response-the-http-version-of-the-connected-to-server">In case of server request, the HTTP version sent by the client. In the case of client response, the HTTP version of the connected-to server</a></li>
<li><a href="#the-requestresponse-headers-object">The request/response headers object</a></li>
<li><a href="#the-requestresponse-trailers-object-only-populated-after-the-end-event">The request/response trailers object. Only populated after the &apos;end&apos; event</a></li>
<li><a href="#the-request-method-as-a-string-read-only-example-get-delete">The request method as a string. Read only. Example: &apos;GET&apos;, &apos;DELETE&apos;</a></li>
<li><a href="#request-url-string-this-contains-only-the-url-that-is-present-in-the-actual-http-request">Request URL string. This contains only the URL that is present in the actual HTTP request</a></li>
<li><a href="#the-netsocket-object-associated-with-the-connection">The net.Socket object associated with the connection</a></li>
<li><a href="#calls-messageconnectionsettimeoutmsecs-callback">Calls message.connection.setTimeout(msecs, callback)</a></li>
<li><a href="#take-a-url-string-and-return-an-object">Take a URL string, and return an object</a></li>
<li><a href="#take-a-parsed-url-object-and-return-a-formatted-url-string">Take a parsed URL object, and return a formatted URL string</a></li>
<li><a href="#take-a-base-url-and-a-href-url-and-resolve-them-as-a-browser-would-for-an-anchor-tag">Take a base URL, and a href URL, and resolve them as a browser would for an anchor tag</a></li>
</ul>
</li>
<li><a href="#this-module-provides-utilities-for-dealing-with-query-strings-call-requirequerystring-to-use-it">This module provides utilities for dealing with query strings. Call require(&apos;querystring&apos;) to use it</a>
<ul>
<li><a href="#serialize-an-object-to-a-query-string-optionally-override-the-default-separator-and-assignment-characters">Serialize an object to a query string. Optionally override the default separator (&apos;&amp;&apos;) and assignment (&apos;=&apos;) characters</a></li>
<li><a href="#deserialize-a-query-string-to-an-object-optionally-override-the-default-separator-and-assignment-characters">Deserialize a query string to an object. Optionally override the default separator (&apos;&amp;&apos;) and assignment (&apos;=&apos;) characters</a></li>
<li><a href="#throws-an-exception-that-displays-the-values-for-actual-and-expected-separated-by-the-provided-operator">Throws an exception that displays the values for actual and expected separated by the provided operator</a></li>
<li><a href="#tests-if-value-is-truthy-it-is-equivalent-to-assertequaltrue-value-message">Tests if value is truthy, it is equivalent to assert.equal(true, !!value, message)</a></li>
<li><a href="#tests-shallow-coercive-equality-with-the-equal-comparison-operator">Tests shallow, coercive equality with the equal comparison operator ( == )</a></li>
<li><a href="#tests-shallow-coercive-non-equality-with-the-not-equal-comparison-operator">Tests shallow, coercive non-equality with the not equal comparison operator ( != )</a></li>
<li><a href="#tests-for-deep-equality">Tests for deep equality</a></li>
<li><a href="#tests-for-any-deep-inequality">Tests for any deep inequality</a></li>
<li><a href="#tests-strict-equality-as-determined-by-the-strict-equality-operator">Tests strict equality, as determined by the strict equality operator ( === )</a></li>
<li><a href="#tests-strict-non-equality-as-determined-by-the-strict-not-equal-operator">Tests strict non-equality, as determined by the strict not equal operator ( !== )</a></li>
<li><a href="#expects-block-to-throw-an-error-error-can-be-constructor-regexp-or-validation-function">Expects block to throw an error. error can be constructor, RegExp or validation function</a></li>
<li><a href="#expects-block-not-to-throw-an-error-see-assertthrows-for-details">Expects block not to throw an error, see assert.throws for details</a></li>
<li><a href="#tests-if-value-is-not-a-false-value-throws-if-it-is-a-true-value-useful-when-testing-the-first-argument-error-in-callbacks">Tests if value is not a false value, throws if it is a true value. Useful when testing the first argument, error in callbacks</a></li>
<li><a href="#returns-the-operating-systems-default-directory-for-temp-files">Returns the operating system&apos;s default directory for temp files</a></li>
<li><a href="#returns-the-endianness-of-the-cpu-possible-values-are-be-or-le">Returns the endianness of the CPU. Possible values are &quot;BE&quot; or &quot;LE&quot;</a></li>
<li><a href="#returns-the-hostname-of-the-operating-system">Returns the hostname of the operating system</a></li>
<li><a href="#returns-the-operating-system-name">Returns the operating system name</a></li>
<li><a href="#returns-the-operating-system-platform">Returns the operating system platform</a></li>
<li><a href="#returns-the-operating-system-cpu-architecture">Returns the operating system CPU architecture</a></li>
<li><a href="#returns-the-operating-system-release">Returns the operating system release</a></li>
<li><a href="#returns-the-system-uptime-in-seconds">Returns the system uptime in seconds</a></li>
<li><a href="#returns-an-array-containing-the-1-5-and-15-minute-load-averages">Returns an array containing the 1, 5, and 15 minute load averages</a></li>
<li><a href="#returns-the-total-amount-of-system-memory-in-bytes">Returns the total amount of system memory in bytes</a></li>
<li><a href="#returns-the-amount-of-free-system-memory-in-bytes">Returns the amount of free system memory in bytes</a></li>
<li><a href="#returns-an-array-of-objects-containing-information-about-each-cpucore-installed-model-speed-in-mhz-and-times-an-object-containing-the-number-of-milliseconds-the-cpucore-spent-in-user-nice-sys-idle-and-irq">Returns an array of objects containing information about each CPU/core installed: model, speed (in MHz), and times (an object containing the number of milliseconds the CPU/core spent in: user, nice, sys, idle, and irq)</a></li>
<li><a href="#get-a-list-of-network-interfaces">Get a list of network interfaces</a></li>
<li><a href="#a-constant-defining-the-appropriate-end-of-line-marker-for-the-operating-system">A constant defining the appropriate End-of-line marker for the operating system</a></li>
<li><a href="#allocates-a-new-buffer-of-size-octets">Allocates a new buffer of size octets</a></li>
<li><a href="#allocates-a-new-buffer-using-an-array-of-octets">Allocates a new buffer using an array of octets</a></li>
<li><a href="#allocates-a-new-buffer-containing-the-given-str-encoding-defaults-to-utf8">Allocates a new buffer containing the given str. encoding defaults to &apos;utf8&apos;</a></li>
<li><a href="#returns-true-if-the-encoding-is-a-valid-encoding-argument-or-false-otherwise">Returns true if the encoding is a valid encoding argument, or false otherwise</a></li>
<li><a href="#tests-if-obj-is-a-buffer">Tests if obj is a Buffer</a></li>
<li><a href="#returns-a-buffer-which-is-the-result-of-concatenating-all-the-buffers-in-the-list-together">Returns a buffer which is the result of concatenating all the buffers in the list together</a></li>
<li><a href="#gives-the-actual-byte-length-of-a-string">Gives the actual byte length of a string</a></li>
<li><a href="#writes-string-to-the-buffer-at-offset-using-the-given-encoding">Writes string to the buffer at offset using the given encoding</a></li>
<li><a href="#returns-a-json-representation-of-the-buffer-instance-which-is-identical-to-the-output-for-json-arrays">Returns a JSON-representation of the Buffer instance, which is identical to the output for JSON Arrays</a></li>
<li><a href="#does-copy-between-buffers-the-source-and-target-regions-can-be-overlapped">Does copy between buffers. The source and target regions can be overlapped</a></li>
<li><a href="#returns-a-new-buffer-which-references-the-same-memory-as-the-old-but-offset-and-cropped-by-the-start-defaults-to-0-and-end-defaults-to-bufferlength-indexes-negative-indexes-start-from-the-end-of-the-buffer">Returns a new buffer which references the same memory as the old, but offset and cropped by the start (defaults to 0) and end (defaults to buffer.length) indexes. Negative indexes start from the end of the buffer</a></li>
<li><a href="#fills-the-buffer-with-the-specified-value">Fills the buffer with the specified value</a></li>
<li><a href="#get-and-set-the-octet-at-index">Get and set the octet at index</a></li>
<li><a href="#the-size-of-the-buffer-in-bytes-note-that-this-is-not-necessarily-the-size-of-the-contents">The size of the buffer in bytes, Note that this is not necessarily the size of the contents</a></li>
<li><a href="#how-many-bytes-will-be-returned-when-bufferinspect-is-called-this-can-be-overridden-by-user-modules">How many bytes will be returned when buffer.inspect() is called. This can be overridden by user modules</a></li>
</ul>
</li>
<li><a href="#reactjs">ReactJS</a>
<ul>
<li><a href="#notes-dont-forget-the-command-lines">notes: don&apos;t forget the command lines</a>
<ul>
<li><a href="#you-will-not-typically-invoke-reactcreateelement-directly-if-you-are-using-jsx">You will not typically invoke React.createElement() directly if you are using JSX</a></li>
<li><a href="#clone-and-return-a-new-react-element-using-element-as-the-starting-point">Clone and return a new React element using element as the starting point</a></li>
<li><a href="#verifies-the-object-is-a-react-element-returns-true-or-false">Verifies the object is a React element. Returns true or false</a></li>
<li><a href="#reactchildren-provides-utilities-for-dealing-with-the-thispropschildren-opaque-data-structure">React.Children&gt; provides utilities for dealing with the this.props.children opaque data structure</a></li>
<li><a href="#like-reactchildrenmap-but-does-not-return-an-array">Like React.Children.map() but does not return an array</a></li>
<li><a href="#returns-the-total-number-of-components-in-children-equal-to-the-number-of-times-that-a-callback-passed-to-map-or-foreach-would-be-invoked">Returns the total number of components in children, equal to the number of times that a callback passed to map or forEach would be invoked</a></li>
<li><a href="#verifies-that-children-has-only-one-child-a-react-element-and-returns-it">Verifies that children has only one child (a React element) and returns it</a></li>
<li><a href="#returns-the-children-opaque-data-structure-as-a-flat-array-with-keys-assigned-to-each-child">Returns the children opaque data structure as a flat array with keys assigned to each child</a></li>
<li><a href="#the-reactfragment-component-lets-you-return-multiple-elements-in-a-render-method-without-creating-an-additional-dom-element">The React.Fragment component lets you return multiple elements in a render() method without creating an additional DOM element</a>
<ul>
<li><a href="#you-can-also-use-it-with-the-shorthand-syntax">You can also use it with the shorthand syntax</a></li>
</ul>
</li>
<li><a href="#the-constructor-is-the-right-place-to-initialize-state">The constructor is the right place to initialize state</a></li>
<li><a href="#in-rare-cases-its-okay-to-initialize-state-based-on-props">In rare cases, it&apos;s okay to initialize state based on props</a>
<ul>
<li><a href="#you-may-optionally-pass-an-object-as-the-first-argument-to-setstate-instead-of-a-function">You may optionally pass an object as the first argument to setState() instead of a function</a></li>
</ul>
</li>
<li><a href="#let-react-know-if-a-components-output-is-not-affected-by-the-current-change-in-state-or-props">^^^^ Let React know if a component&apos;s output is not affected by the current change in state or props</a></li>
<li><a href="#shouldcomponentupdate-is-invoked-before-rendering-when-new-props-or-state-are-being-received-defaults-to-true">shouldComponentUpdate() is invoked before rendering when new props or state are being received. Defaults to true</a></li>
<li><a href="#contains-data-specific-to-this-component-that-may-change-over-time">Contains data specific to this component that may change over time</a></li>
<li><a href="#by-default-when-your-components-state-or-props-change-your-component-will-re-render">By default, when your component&apos;s state or props change, your component will re-render</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#reactdom">REACT.DOM</a>
<ul>
<li><a href="#same-as-render-but-is-used-to-hydrate-a-container-whose-html-contents-were-rendered">Same as render(), but is used to hydrate a container whose HTML contents were rendered</a></li>
<li><a href="#remove-a-mounted-react-component-from-the-dom-and-clean-up-its-event-handlers-and-state">Remove a mounted React component from the DOM and clean up its event handlers and state</a></li>
<li><a href="#if-this-component-has-been-mounted-into-the-dom-this-returns-the-corresponding-native-browser">If this component has been mounted into the DOM, this returns the corresponding native browser</a></li>
<li><a href="#creates-a-portal-portals-provide-a-way-to-render-children-into-a-dom-node-that-exists-outside">Creates a portal. Portals provide a way to render children into a DOM node that exists outside</a></li>
</ul>
</li>
<li><a href="#reactdomserver">REACTDOMSERVER</a><br>
- <a href="#you-can-use-this-method-to-generate-html-on-the-server-and-send-the-markup-down-on-the-initial">You can use this method to generate HTML on the server and send the markup down on the initial</a>
<ul>
<li><a href="#similar-to-rendertostring-except-this-doesnt-create-extra-dom-attributes-that-react-uses">Similar to renderToString, except this doesn&apos;t create extra DOM attributes that React uses</a></li>
<li><a href="#render-a-react-element-to-its-initial-html-returns-a-readable-stream-that-outputs-an-html-string">Render a React element to its initial HTML. Returns a Readable stream that outputs an HTML string</a>
<ul>
<li><a href="#you-can-use-this-method-to-generate-html-on-the-server-and-send-the-markup-down-on-the-initial-1">You can use this method to generate HTML on the server and send the markup down on the initial</a></li>
</ul>
</li>
<li><a href="#similar-to-rendertonodestream-except-this-doesnt-create-extra-dom-attributes-that-react-uses">Similar to renderToNodeStream, except this doesn&apos;t create extra DOM attributes that React uses</a>
<ul>
<li><a href="#you-can-declare-that-a-prop-is-a-specific-js-type-by-default-these-are-all-optional">You can declare that a prop is a specific JS type. By default, these are all optional</a></li>
</ul>
</li>
<li><a href="#or-fragment-containing-these-types">(or fragment) containing these types</a></li>
<li><a href="#optionalelement-proptypeselement-you-can-also-declare-that-a-prop-is-an-instance-of-a-class-this-uses">optionalElement: PropTypes.element, You can also declare that a prop is an instance of a class. This uses</a></li>
<li><a href="#is-shown-if-the-prop-isnt-provided">is shown if the prop isn&apos;t provided</a></li>
<li><a href="#you-can-also-supply-a-custom-validator-to-arrayof-and-objectof">You can also supply a custom validator to <code>arrayOf</code> and <code>objectOf</code></a></li>
</ul>
</li>
</ul>
</div>
<a id="sidebar-toc-btn">&#x2261;</a>
<script>
var sidebarTOCBtn = document.getElementById('sidebar-toc-btn')
sidebarTOCBtn.addEventListener('click', function(event) {
event.stopPropagation()
if (document.body.hasAttribute('html-show-sidebar-toc')) {
document.body.removeAttribute('html-show-sidebar-toc')
} else {
document.body.setAttribute('html-show-sidebar-toc', true)
}
})
</script>
</body></html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment