1/30/13
Search
NodeJS Cheat Sheet | [Link]
Resource
Online
Official Website
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)
Module
Modules
Cycles Core Modules File Modules Loading from n o d e _ m o d u l e sF olders Folders as Modules Caching Module Caching Caveats The m o d u l eObject [Link] [Link](id) [Link] [Link] [Link] [Link] [Link] All Together... Loading from the global folders Accessing the main module Addenda: Package Manager Ti ps
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](o bj) Class Method: [Link] h(string, [encoding]) Class Method: [Link](list , [totalLength]) [Link] [Link](targetBuffer, [targetSt art], [sourceStart], [sourceEnd]) [Link]([start], [end]) buf.readUInt8(offset, [noAssert] ) buf.readUInt16LE(offset, [noAs sert]) buf.readUInt16BE(offset, [noAs sert]) buf.readUInt32LE(offset, [noAs sert]) buf.readUInt32BE(offset, [noAs sert]) buf.readInt8(offset, [noAssert]) buf.readInt16LE(offset, [noAsse rt]) buf.readInt16BE(offset, [noAss ert]) buf.readInt32LE(offset, [noAsse rt]) buf.readInt32BE(offset, [noAss ert]) [Link](offset, [noAss ert]) [Link](offset, [noAss ert]) [Link](offset, [noAs sert]) [Link](offset, [noAs sert]) buf.writeUInt8(value, offset, [no Assert]) buf.writeUInt16LE(value, offset, [noAssert]) buf.writeUInt16BE(value, offset, [noAssert]) buf.writeUInt32LE(value, offset, [noAssert]) buf.writeUInt32BE(value, offset, [noAssert]) buf.writeInt8(value, offset, [noA ssert]) 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
Process/Eve
Process
Related
JavaScript
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]()
console
[Link]([data], [...]) [Link]([data], [...]) [Link]([data], [...]) [Link]([data], [...]) [Link](obj) [Link](label) [Link](label) [Link](label) [Link](expression, [me ssage])
Addons
Addons Hello world Addon patterns Function arguments Callbacks Object factory Function factory Wrapping C++ objects Factory of wrapped objects Passing wrapped objects aroun d
Crypto
[Link](detail s) [Link](algorithm) Class: Hash [Link](data, [input_enco ding]) [Link]([encoding]) [Link](algorithm, k ey) Class: Hmac [Link](data) [Link]([encoding]) [Link](algorithm, password) [Link](algorithm , key, iv) Class: Cipher [Link](data, [input_enc oding], [output_encoding]) [Link]([output_encoding]) [Link](auto_pa dding=true) [Link](algorith m, password) [Link](algorit hm, key, iv) Class: Decipher [Link](data, [input_e ncoding], [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](prim e_length) [Link](prim e, [encoding]) Class: DiffieHellman [Link]([en coding]) [Link](ot her_public_key, [input_encodin g], [output_encoding]) [Link]([encodin g])
Timers
setTimeout(callback, delay, [ar g], [...]) clearTimeout(timeoutId) setInterval(callback, delay, [arg] , [...]) clearInterval(intervalId)
Event: 'exit' Event: 'uncaughtExceptio 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
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, writa bleStream, [callback]) [Link](constructor, superC onstructor)
File
File System
[Link](oldPath, newPath, [c allback]) [Link](oldPath, newPa th) [Link](fd, len, [callback]) [Link](fd, len) [Link](path, uid, gid, [callbac k]) [Link](path, uid, gid) [Link](fd, uid, gid, [callback] ) [Link](fd, uid, gid) [Link](path, uid, gid, [callba ck]) [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, [callbac k]) [Link](srcpath, dstpath) [Link](destination, path, [ty pe], [callback]) [Link](destination, pat h, [type]) [Link](path, [callback]) [Link](path) [Link](path, [cache], callba ck) [Link](path, [cache]) [Link](path, [callback])
Class: [Link] [Link](even ner) [Link](event, listener [Link](event, listen [Link](e stener) [Link] nt]) [Link](n [Link](event) [Link](event, [arg1] ], [...]) Event: 'newListener'
net
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)
Stream
Readable Stream Event: 'data' Event: 'end'
[Link]([options nectionListener]) [Link](options, [con nListener]) [Link](op connectionListener]) [Link](port, [host], [ ctListener]) [Link](po st], [connectListener]) [Link](path, [conne ner]) [Link](pa nnectListener]) Class: [Link] [Link](port, [host], og], [listeningListener]) [Link](path, [listeni ener]) [Link](handle, [liste stener]) [Link]([cb]) [Link]() [Link] [Link] Event: 'listening' Event: 'connection' Event: 'close' Event: 'error' Class: [Link]
[Link]/nodejs/
1/3
1/30/13
[Link]([en coding]) [Link]([enc oding]) [Link]([en coding]) [Link](publi c_key, [encoding]) [Link](pub lic_key, [encoding]) [Link](group_ name) crypto.pbkdf2(password, salt, it erations, keylen, callback) [Link](size, [callb ack])
NodeJS Cheat Sheet | [Link]
[Link](domain) punycode.ucs2 [Link](string) [Link](codePo ints) [Link] [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], [cal lback]) [Link](path, flags, [mode] ) [Link](path, atime, mtime, [c allback]) [Link](path, atime, mtim e) [Link](fd, atime, mtime, [call back]) [Link](fd, atime, mtime) [Link](fd, [callback]) [Link](fd) [Link](fd, buffer, offset, length, position, [callback]) [Link](fd, buffer, offset, le ngth, position) [Link](fd, buffer, offset, length, position, [callback]) [Link](fd, buffer, offset, le ngth, position) [Link](filename, [encoding] , [callback]) [Link](filename, [enco ding]) [Link](filename, data, [enc oding], [callback]) [Link](filename, data, [encoding]) [Link](filename, data, e ncoding='utf8', [callback]) [Link](filename, da ta, encoding='utf8') [Link](filename, [options], listener) [Link](filename) [Link](filename, [options], [list ener]) Caveats Availability Filename Argument [Link](path, [callback]) [Link](path) Class: [Link] [Link](path, [opt ions]) Class: [Link] Event: 'open' [Link](path, [opt ions]) [Link] Event: 'open' [Link] Class: [Link] [Link]() Event: 'change' Event: 'error' Event: 'error' Event: 'close' [Link] [Link]([encoding] ) [Link]() [Link]() [Link]() [Link](destination, [option s]) 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]()
Readline
[Link](option s) 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
TSL(SSL)
Client-initiated renegotiation att ack mitigation NPN and SNI [Link](options, [secur eConnectionListener]) [Link](options, [secureCon nectListener]) [Link](port, [host], [options ], [secureConnectListener]) [Link]([credential s], [isServer], [requestCert], [rej ectUnauthorized]) Class: SecurePair Event: 'secure' Class: [Link] Event: 'secureConnection' Event: 'clientError' [Link](port, [host], [callba ck]) [Link]() [Link]() [Link](hostname, c redentials) [Link] [Link] Class: [Link] Event: 'secureConnect' [Link] [Link] ror [Link] ate() [Link]() [Link]() [Link] [Link]
TTY
[Link](fd) [Link](mode) Class: ReadStream [Link] [Link](mode) Class WriteStream [Link] [Link] Event: 'resize'
REPL
[Link](options) Event: 'exit' REPL Features
new [Link]([options]) [Link](port, [hos nnectListener]) [Link](path, [con istener]) [Link] [Link]([enco [Link](data, [encod allback]) [Link]([data], [encod [Link]() [Link]() [Link]() [Link](timeou back]) [Link]([noDe [Link]([ena nitialDelay]) [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 Sock
HTTP
http
http.STATUS_CODES [Link]([requestListe ner]) [Link]([port], [host]) [Link](options, callback) [Link](options, callback) [Link]
Code
Executing JS
Caveats Sandboxes Globals [Link](code, [file name]) [Link](code, [san dbox], [filename]) [Link](code, context, [filename]) [Link]([initSandbox] ) [Link](code, [filename ]) Class: Script [Link]() [Link]([sandbo x])
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, [listeningLi stener]) [Link]([cb]) [Link]
StringDecoder
Class: StringDecoder [Link](buffer)
[Link](type ack]) Class: Socket Event: 'message' Event: 'listening' Event: 'close' Event: 'error' [Link](buf, offset, le port, address, [callback]) [Link](port, [addres [Link]() [Link]() [Link](flag) [Link](ttl) [Link](tt [Link] g) [Link](m stAddress, [multicastInter [Link](m stAddress, [multicastInter
DNS
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
Child Process
Class: ChildProcess Event: 'exit' Event: 'close' Event: 'disconnect' Event: 'message' [Link] [Link] [Link] [Link] [Link]([signal]) [Link](message, [sendHan dle]) [Link]() child_process.spawn(command , [args], [options]) child_process.exec(command, [ options], callback) child_process.execFile(file, arg s, options, callback) child_process.fork(modulePath, [args], [options])
Class: [Link] t
Event: 'data' Event: 'end' Event: 'close' [Link] [Link] [Link] [Link] [Link] [Link]([encoding ]) [Link]() [Link]() [Link]
3rd Party
Third Party Modules Module Installer:
npm
[Link](domain, [fami lback) [Link](domain, [rrty llback) dns.resolve4(domain, cal dns.resolve6(domain, cal [Link](domain, ca ) [Link](domain, c k) [Link](domain, c k) [Link](domain, ca ) [Link](doma back) [Link](ip, callback) Error codes
HTTP Middleware:
Connect
Web Framework:
Express
Class: [Link] se
Event: 'close' [Link]() [Link](statusCod e, [reasonPhrase], [headers]) [Link] [Link](name, val ue) [Link] [Link](name)
Web Sockets:
[Link]
Support U
HTML Parsing:
HTML5 mDNS/Zeroconf/Bonjour
Assert
[Link](actual, expected, me ssage, operator) assert(value, message), assert. ok(value, [message]) [Link](actual, expected, [ message]) [Link](actual, expecte
/li>
RabbitMQ, AMQP mysql
Serialization:
msgpack
[Link]/nodejs/
2/3
1/30/13
NodeJS Cheat Sheet | [Link]
[Link](name ) [Link](chunk, [encodin g]) [Link](headers) [Link]([data], [encoding ])
os
[Link]() [Link]() [Link]() [Link]() [Link]() [Link]() [Link]() [Link]() [Link]() [Link]() [Link]() [Link]() [Link]
Scraping:
Apricot
Debugger:
ndb
is a CLI debugger
inspector
is a web based tool.
pcap binding ncurses
Class: [Link]
[Link] [Link] [Link]
Testing/TDD/BDD:
vows
,
mocha
Class: [Link]
Event 'response' Event: 'socket' Event: 'connect' Event: 'upgrade' Event: 'continue' [Link](chunk, [encoding] ) [Link]([data], [encoding]) [Link]() [Link](timeout, [ca llback]) [Link]([noDelay]) [Link]([e nable], [initialDelay])
d, [message]) [Link](actual, expec ted, [message]) [Link](actual, ex pected, [message]) [Link](actual, expec ted, [message]) [Link](actual, ex pected, [message]) [Link](block, [error], [me ssage]) [Link](block, [er ror], [message]) [Link](value)
Debugger
Watchers Commands reference Stepping Breakpoints Info Execution control Various Advanced Usage
,
[Link]
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, [sendHa ndle]) [Link]() [Link]() Event: 'message' Event: 'online' Event: 'listening' Event: 'disconnect' Event: 'exit'
[Link]
Event: 'data' Event: 'end' Event: 'close' [Link] [Link] [Link] [Link] [Link]([encodin g]) [Link]() [Link]()
HTTPS
Class: [Link] [Link](options, [re questListener]) [Link](options, callback) [Link](options, callback) Class: [Link] [Link]
URL
[Link](urlStr, [parseQueryStr ing], [slashesDenoteHost]) [Link](urlObj) [Link](from, to)
[Link]/nodejs/
3/3