0% found this document useful (0 votes)
12 views15 pages

Comprehensive Node.js API Reference

Chee sheet

Uploaded by

sfayazmr
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views15 pages

Comprehensive Node.js API Reference

Chee sheet

Uploaded by

sfayazmr
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

OverAPI.

com

 Python

 jQuery

 NodeJS

 PHP

 Java

 Ruby

 Javascript

 ActionScript

 CSS

 Express

 More »

Resource
Online
 Official Website

Related
 JavaScript

Basic
Global Objects
 global
 process
 console
 Class: Buffer
 require()
 [Link]()
 [Link]
 [Link]
 __filename
 __dirname
 module
 exports
 setTimeout(cb, ms)
 clearTimeout(t)
 setInterval(cb, ms)
 clearInterval(t)
console
 [Link]([data], [...])
 [Link]([data], [...])
 [Link]([data], [...])
 [Link]([data], [...])
 [Link](obj)
 [Link](label)
 [Link](label)
 [Link](label)
 [Link](expression, [message])

Timers
 setTimeout(callback, delay, [arg], [...])
 clearTimeout(timeoutId)
 setInterval(callback, delay, [arg], [...])
 clearInterval(intervalId)

Util
 [Link](format, [...])
 [Link](string)
 [Link]([...])
 [Link]([...])
 [Link]([...])
 [Link](string)
 [Link](object, [showHidden], [depth], [colors])
 [Link](object)
 [Link](object)
 [Link](object)
 [Link](object)
 [Link](readableStream, writableStream, [callback])
 [Link](constructor, superConstructor)

Module
Modules
 Cycles
 Core Modules
 File Modules
 Loading from node_modules Folders
 Folders as Modules
 Caching
 Module Caching Caveats
 The module Object
 [Link]
 [Link](id)
 [Link]
 [Link]
 [Link]
 [Link]
 [Link]
 All Together...
 Loading from the global folders
 Accessing the main module
 Addenda: Package Manager Tips

Addons
 Addons
 Hello world
 Addon patterns
 Function arguments
 Callbacks
 Object factory
 Function factory
 Wrapping C++ objects
 Factory of wrapped objects
 Passing wrapped objects around

Buffer/Stream
Buffer
 Buffer
 Class: Buffer
 new Buffer(size)
 new Buffer(array)
 new Buffer(str, [encoding])
 [Link](string, [offset], [length], [encoding])
 [Link]([encoding], [start], [end])
 buf[index]
 Class Method: [Link](obj)
 Class Method: [Link](string, [encoding])
 Class Method: [Link](list, [totalLength])
 [Link]
 [Link](targetBuffer, [targetStart], [sourceStart], [sourceEnd])
 [Link]([start], [end])
 buf.readUInt8(offset, [noAssert])
 buf.readUInt16LE(offset, [noAssert])
 buf.readUInt16BE(offset, [noAssert])
 buf.readUInt32LE(offset, [noAssert])
 buf.readUInt32BE(offset, [noAssert])
 buf.readInt8(offset, [noAssert])
 buf.readInt16LE(offset, [noAssert])
 buf.readInt16BE(offset, [noAssert])
 buf.readInt32LE(offset, [noAssert])
 buf.readInt32BE(offset, [noAssert])
 [Link](offset, [noAssert])
 [Link](offset, [noAssert])
 [Link](offset, [noAssert])
 [Link](offset, [noAssert])
 buf.writeUInt8(value, offset, [noAssert])
 buf.writeUInt16LE(value, offset, [noAssert])
 buf.writeUInt16BE(value, offset, [noAssert])
 buf.writeUInt32LE(value, offset, [noAssert])
 buf.writeUInt32BE(value, offset, [noAssert])
 buf.writeInt8(value, offset, [noAssert])
 buf.writeInt16LE(value, offset, [noAssert])
 buf.writeInt16BE(value, offset, [noAssert])
 buf.writeInt32LE(value, offset, [noAssert])
 buf.writeInt32BE(value, offset, [noAssert])
 [Link](value, offset, [noAssert])
 [Link](value, offset, [noAssert])
 [Link](value, offset, [noAssert])
 [Link](value, offset, [noAssert])
 [Link](value, [offset], [end])
 buffer.INSPECT_MAX_BYTES
 Class: SlowBuffer

Stream
 Readable Stream
 Event: 'data'
 Event: 'end'
 Event: 'error'
 Event: 'close'
 [Link]
 [Link]([encoding])
 [Link]()
 [Link]()
 [Link]()
 [Link](destination, [options])
 Writable Stream
 Event: 'drain'
 Event: 'error'
 Event: 'close'
 Event: 'pipe'
 [Link]
 [Link](string, [encoding], [fd])
 [Link](buffer)
 [Link]()
 [Link](string, encoding)
 [Link](buffer)
 [Link]()
 [Link]()

TTY
 [Link](fd)
 [Link](mode)
 Class: ReadStream
 [Link]
 [Link](mode)
 Class WriteStream
 [Link]
 [Link]
 Event: 'resize'

Process/Events
Process
 Event: 'exit'
 Event: 'uncaughtException'
 Signal Events
 [Link]
 [Link]
 [Link]
 [Link]
 [Link]
 [Link]()
 [Link](directory)
 [Link]()
 [Link]
 [Link]([code])
 [Link]()
 [Link](id)
 [Link]()
 [Link](id)
 [Link]
 [Link]
 [Link]
 [Link](pid, [signal])
 [Link]
 [Link]
 [Link]
 [Link]
 [Link]()
 [Link](callback)
 [Link]([mask])
 [Link]()
 [Link]()

Events
 Class: [Link]
 [Link](event, listener)
 [Link](event, listener)
 [Link](event, listener)
 [Link](event, listener)
 [Link]([event])
 [Link](n)
 [Link](event)
 [Link](event, [arg1], [arg2], [...])
 Event: 'newListener'

Domain
Domain
 Additions to Error objects
 Implicit Binding
 Explicit Binding
 [Link]()
 Class: Domain
 [Link](fn)
 [Link]
 [Link](emitter)
 [Link](emitter)
 [Link](cb)
 Example
 [Link](cb)
 Example
 [Link]()

Crypto
 [Link](details)
 [Link](algorithm)
 Class: Hash
 [Link](data, [input_encoding])
 [Link]([encoding])
 [Link](algorithm, key)
 Class: Hmac
 [Link](data)
 [Link]([encoding])
 [Link](algorithm, password)
 [Link](algorithm, key, iv)
 Class: Cipher
 [Link](data, [input_encoding], [output_encoding])
 [Link]([output_encoding])
 [Link](auto_padding=true)
 [Link](algorithm, password)
 [Link](algorithm, key, iv)
 Class: Decipher
 [Link](data, [input_encoding], [output_encoding])
 [Link]([output_encoding])
 [Link](auto_padding=true)
 [Link](algorithm)
 Class: Signer
 [Link](data)
 [Link](private_key, [output_format])
 [Link](algorithm)
 Class: Verify
 [Link](data)
 [Link](object, signature, [signature_format])
 [Link](prime_length)
 [Link](prime, [encoding])
 Class: DiffieHellman
 [Link]([encoding])
 [Link](other_public_key, [input_encoding], [output_encoding])
 [Link]([encoding])
 [Link]([encoding])
 [Link]([encoding])
 [Link]([encoding])
 [Link](public_key, [encoding])
 [Link](public_key, [encoding])
 [Link](group_name)
 crypto.pbkdf2(password, salt, iterations, keylen, callback)
 [Link](size, [callback])

TSL(SSL)
 Client-initiated renegotiation attack mitigation
 NPN and SNI
 [Link](options, [secureConnectionListener])
 [Link](options, [secureConnectListener])
 [Link](port, [host], [options], [secureConnectListener])
 [Link]([credentials], [isServer], [requestCert], [rejectUnauthorized])
 Class: SecurePair
 Event: 'secure'
 Class: [Link]
 Event: 'secureConnection'
 Event: 'clientError'
 [Link](port, [host], [callback])
 [Link]()
 [Link]()
 [Link](hostname, credentials)
 [Link]
 [Link]
 Class: [Link]
 Event: 'secureConnect'
 [Link]
 [Link]
 [Link]()
 [Link]()
 [Link]()
 [Link]
 [Link]

StringDecoder
 Class: StringDecoder

 [Link](buffer)

File
File System
 [Link](oldPath, newPath, [callback])
 [Link](oldPath, newPath)
 [Link](fd, len, [callback])
 [Link](fd, len)
 [Link](path, uid, gid, [callback])
 [Link](path, uid, gid)
 [Link](fd, uid, gid, [callback])
 [Link](fd, uid, gid)
 [Link](path, uid, gid, [callback])
 [Link](path, uid, gid)
 [Link](path, mode, [callback])
 [Link](path, mode)
 [Link](fd, mode, [callback])
 [Link](fd, mode)
 [Link](path, mode, [callback])
 [Link](path, mode)
 [Link](path, [callback])
 [Link](path, [callback])
 [Link](fd, [callback])
 [Link](path)
 [Link](path)
 [Link](fd)
 [Link](srcpath, dstpath, [callback])
 [Link](srcpath, dstpath)
 [Link](destination, path, [type], [callback])
 [Link](destination, path, [type])
 [Link](path, [callback])
 [Link](path)
 [Link](path, [cache], callback)
 [Link](path, [cache])
 [Link](path, [callback])
 [Link](path)
 [Link](path, [callback])
 [Link](path)
 [Link](path, [mode], [callback])
 [Link](path, [mode])
 [Link](path, [callback])
 [Link](path)
 [Link](fd, [callback])
 [Link](fd)
 [Link](path, flags, [mode], [callback])
 [Link](path, flags, [mode])
 [Link](path, atime, mtime, [callback])
 [Link](path, atime, mtime)
 [Link](fd, atime, mtime, [callback])
 [Link](fd, atime, mtime)
 [Link](fd, [callback])
 [Link](fd)
 [Link](fd, buffer, offset, length, position, [callback])
 [Link](fd, buffer, offset, length, position)
 [Link](fd, buffer, offset, length, position, [callback])
 [Link](fd, buffer, offset, length, position)
 [Link](filename, [encoding], [callback])
 [Link](filename, [encoding])
 [Link](filename, data, [encoding], [callback])
 [Link](filename, data, [encoding])
 [Link](filename, data, encoding='utf8', [callback])
 [Link](filename, data, encoding='utf8')
 [Link](filename, [options], listener)
 [Link](filename)
 [Link](filename, [options], [listener])
 Caveats
 Availability
 Filename Argument
 [Link](path, [callback])
 [Link](path)
 Class: [Link]
 [Link](path, [options])
 Class: [Link]
 Event: 'open'
 [Link](path, [options])
 [Link]
 Event: 'open'
 [Link]
 Class: [Link]
 [Link]()
 Event: 'change'
 Event: 'error'

Net
net
 [Link]([options], [connectionListener])
 [Link](options, [connectionListener])
 [Link](options, [connectionListener])
 [Link](port, [host], [connectListener])
 [Link](port, [host], [connectListener])
 [Link](path, [connectListener])
 [Link](path, [connectListener])
 Class: [Link]
 [Link](port, [host], [backlog], [listeningListener])
 [Link](path, [listeningListener])
 [Link](handle, [listeningListener])
 [Link]([cb])
 [Link]()
 [Link]
 [Link]
 Event: 'listening'
 Event: 'connection'
 Event: 'close'
 Event: 'error'
 Class: [Link]
 new [Link]([options])
 [Link](port, [host], [connectListener])
 [Link](path, [connectListener])
 [Link]
 [Link]([encoding])
 [Link](data, [encoding], [callback])
 [Link]([data], [encoding])
 [Link]()
 [Link]()
 [Link]()
 [Link](timeout, [callback])
 [Link]([noDelay])
 [Link]([enable], [initialDelay])
 [Link]()
 [Link]
 [Link]
 [Link]
 [Link]
 Event: 'connect'
 Event: 'data'
 Event: 'end'
 Event: 'timeout'
 Event: 'drain'
 Event: 'error'
 Event: 'close'
 [Link](input)
 net.isIPv4(input)
 net.isIPv6(input)

UDP / Datagram Sockets


 [Link](type, [callback])
 Class: Socket
 Event: 'message'
 Event: 'listening'
 Event: 'close'
 Event: 'error'
 [Link](buf, offset, length, port, address, [callback])
 [Link](port, [address])
 [Link]()
 [Link]()
 [Link](flag)
 [Link](ttl)
 [Link](ttl)
 [Link](flag)
 [Link](multicastAddress, [multicastInterface])
 [Link](multicastAddress, [multicastInterface])

DNS
 [Link](domain, [family], callback)
 [Link](domain, [rrtype], callback)
 dns.resolve4(domain, callback)
 dns.resolve6(domain, callback)
 [Link](domain, callback)
 [Link](domain, callback)
 [Link](domain, callback)
 [Link](domain, callback)
 [Link](domain, callback)
 [Link](ip, callback)
 Error codes

Text
Path
 [Link](p)
 [Link]([path1], [path2], [...])
 [Link]([from ...], to)
 [Link](from, to)
 [Link](p)
 [Link](p, [ext])
 [Link](p)
 [Link]

Query String
 [Link](obj, [sep], [eq])
 [Link](str, [sep], [eq], [options])
 [Link]
 [Link]

punnycode
 [Link](string)
 [Link](string)
 [Link](domain)
 [Link](domain)
 punycode.ucs2
 [Link](string)
 [Link](codePoints)
 [Link]

Readline
 [Link](options)
 Class: Interface
 [Link](prompt, length)
 [Link]([preserveCursor])
 [Link](query, callback)
 [Link]()
 [Link]()
 [Link]()
 [Link](data, [key])
 Events
 Event: 'line'
 Event: 'pause'
 Event: 'resume'
 Event: 'close'
 Event: 'SIGINT'
 Event: 'SIGTSTP'
 Event: 'SIGCONT'
 Example: Tiny CLI

REPL
 [Link](options)
 Event: 'exit'
 REPL Features

HTTP
http
 http.STATUS_CODES
 [Link]([requestListener])
 [Link]([port], [host])
 [Link](options, callback)
 [Link](options, callback)
 [Link]

Class: [Link]
 Event: 'request'
 Event: 'connection'
 Event: 'close'
 Event: 'checkContinue'
 Event: 'connect'
 Event: 'upgrade'
 Event: 'clientError'
 [Link](port, [hostname], [backlog], [callback])
 [Link](path, [callback])
 [Link](handle, [listeningListener])
 [Link]([cb])
 [Link]

Class: [Link]
 Event: 'data'
 Event: 'end'
 Event: 'close'
 [Link]
 [Link]
 [Link]
 [Link]
 [Link]
 [Link]([encoding])
 [Link]()
 [Link]()
 [Link]

Class: [Link]
 Event: 'close'
 [Link]()
 [Link](statusCode, [reasonPhrase], [headers])
 [Link]
 [Link](name, value)
 [Link]
 [Link](name)
 [Link](name)
 [Link](chunk, [encoding])
 [Link](headers)
 [Link]([data], [encoding])

Class: [Link]
 [Link]
 [Link]
 [Link]

Class: [Link]
 Event 'response'
 Event: 'socket'
 Event: 'connect'
 Event: 'upgrade'
 Event: 'continue'
 [Link](chunk, [encoding])
 [Link]([data], [encoding])
 [Link]()
 [Link](timeout, [callback])
 [Link]([noDelay])
 [Link]([enable], [initialDelay])

[Link]
 Event: 'data'
 Event: 'end'
 Event: 'close'
 [Link]
 [Link]
 [Link]
 [Link]
 [Link]([encoding])
 [Link]()
 [Link]()

HTTPS
 Class: [Link]
 [Link](options, [requestListener])
 [Link](options, callback)
 [Link](options, callback)
 Class: [Link]
 [Link]

URL
 [Link](urlStr, [parseQueryString], [slashesDenoteHost])
 [Link](urlObj)
 [Link](from, to)

Code
Executing JS
 Caveats
 Sandboxes
 Globals
 [Link](code, [filename])
 [Link](code, [sandbox], [filename])
 [Link](code, context, [filename])
 [Link]([initSandbox])
 [Link](code, [filename])
 Class: Script
 [Link]()
 [Link]([sandbox])

Child Process
 Class: ChildProcess
 Event: 'exit'
 Event: 'close'
 Event: 'disconnect'
 Event: 'message'
 [Link]
 [Link]
 [Link]
 [Link]
 [Link]([signal])
 [Link](message, [sendHandle])
 [Link]()
 child_process.spawn(command, [args], [options])
 child_process.exec(command, [options], callback)
 child_process.execFile(file, args, options, callback)
 child_process.fork(modulePath, [args], [options])

Assert
 [Link](actual, expected, message, operator)
 assert(value, message), [Link](value, [message])
 [Link](actual, expected, [message])
 [Link](actual, expected, [message])
 [Link](actual, expected, [message])
 [Link](actual, expected, [message])
 [Link](actual, expected, [message])
 [Link](actual, expected, [message])
 [Link](block, [error], [message])
 [Link](block, [error], [message])
 [Link](value)

System
Zlib
 Examples
 [Link]([options])
 [Link]([options])
 [Link]([options])
 [Link]([options])
 [Link]([options])
 [Link]([options])
 [Link]([options])
 Class: [Link]
 Class: [Link]
 Class: [Link]
 Class: [Link]
 Class: [Link]
 Class: [Link]
 Class: [Link]
 Convenience Methods
 [Link](buf, callback)
 [Link](buf, callback)
 [Link](buf, callback)
 [Link](buf, callback)
 [Link](buf, callback)
 [Link](buf, callback)
 [Link](buf, callback)
 Options
 Memory Usage Tuning
 Constants

os
 [Link]()
 [Link]()
 [Link]()
 [Link]()
 [Link]()
 [Link]()
 [Link]()
 [Link]()
 [Link]()
 [Link]()
 [Link]()
 [Link]()
 [Link]

Debugger
 Watchers
 Commands reference
 Stepping
 Breakpoints
 Info
 Execution control
 Various
 Advanced Usage

Cluster
 How It Works
 [Link]
 [Link]
 [Link]
 Event: 'fork'
 Event: 'online'
 Event: 'listening'
 Event: 'disconnect'
 Event: 'exit'
 Event: 'setup'
 [Link]([settings])
 [Link]([env])
 [Link]
 [Link]([callback])
 [Link]
 Class: Worker
 [Link]
 [Link]
 [Link]
 [Link](message, [sendHandle])
 [Link]()
 [Link]()
 Event: 'message'
 Event: 'online'
 Event: 'listening'
 Event: 'disconnect'
 Event: 'exit'

3rd Party
Third Party Modules
 Module Installer:npm
 HTTP Middleware:Connect
 Web Framework:Express
 Web Sockets:[Link]
 HTML Parsing:HTML5
 mDNS/Zeroconf/Bonjour/li>
 RabbitMQ, AMQP
 mysql
 Serialization:msgpack
 Scraping:Apricot
 Debugger:ndbis a CLI debuggerinspectoris a web based tool.
 pcap binding
 ncurses
 Testing/TDD/BDD:vows,mocha,[Link]

You might also like