Nodejs 官方文档
Buffer/Stream
Buffer
- buf.copy(targetBuffer, [targetStart], [sourceStart], [sourceEnd])
- buf.fill(value, [offset], [end])
- buf.length
- buf.readDoubleBE(offset, [noAssert])
- buf.readDoubleLE(offset, [noAssert])
- buf.readFloatBE(offset, [noAssert])
- buf.readFloatLE(offset, [noAssert])
- buf.readInt16BE(offset, [noAssert])
- buf.readInt16LE(offset, [noAssert])
- buf.readInt32BE(offset, [noAssert])
- buf.readInt32LE(offset, [noAssert])
- buf.readInt8(offset, [noAssert])
- buf.readUInt16BE(offset, [noAssert])
- buf.readUInt16LE(offset, [noAssert])
- buf.readUInt32BE(offset, [noAssert])
- buf.readUInt32LE(offset, [noAssert])
- buf.readUInt8(offset, [noAssert])
- buf.slice([start], [end])
- buf.toString([encoding], [start], [end])
- buf.write(string, [offset], [length], [encoding])
- buf.writeDoubleBE(value, offset, [noAssert])
- buf.writeDoubleLE(value, offset, [noAssert])
- buf.writeFloatBE(value, offset, [noAssert])
- buf.writeFloatLE(value, offset, [noAssert])
- buf.writeInt16BE(value, offset, [noAssert])
- buf.writeInt16LE(value, offset, [noAssert])
- buf.writeInt32BE(value, offset, [noAssert])
- buf.writeInt32LE(value, offset, [noAssert])
- buf.writeInt8(value, offset, [noAssert])
- buf.writeUInt16BE(value, offset, [noAssert])
- buf.writeUInt16LE(value, offset, [noAssert])
- buf.writeUInt32BE(value, offset, [noAssert])
- buf.writeUInt32LE(value, offset, [noAssert])
- buf.writeUInt8(value, offset, [noAssert])
- buf[index]
- buffer.INSPECT_MAX_BYTES
- Class Method: Buffer.byteLength(string, [encoding])
- Class Method: Buffer.concat(list, [totalLength])
- Class Method: Buffer.isBuffer(obj)
- Class: SlowBuffer
- new Buffer(array)
- new Buffer(size)
- new Buffer(str, [encoding])
Domain
Crypto
- cipher.final([output_encoding])
- cipher.setAutoPadding(auto_padding=true)
- cipher.update(data, [input_encoding], [output_encoding])
- Class: Cipher
- Class: Decipher
- Class: DiffieHellman
- Class: Hash
- Class: Hmac
- Class: Signer
- Class: Verify
- crypto.createCipher(algorithm, password)
- crypto.createCipheriv(algorithm, key, iv)
- crypto.createCredentials(details)
- crypto.createDecipher(algorithm, password)
- crypto.createDecipheriv(algorithm, key, iv)
- crypto.createDiffieHellman(prime_length)
- crypto.createDiffieHellman(prime, [encoding])
- crypto.createHash(algorithm)
- crypto.createHmac(algorithm, key)
- crypto.createSign(algorithm)
- crypto.createVerify(algorithm)
- crypto.getDiffieHellman(group_name)
- crypto.pbkdf2(password, salt, iterations, keylen, callback)
- crypto.randomBytes(size, [callback])
- decipher.final([output_encoding])
- decipher.setAutoPadding(auto_padding=true)
- decipher.update(data, [input_encoding], [output_encoding])
- diffieHellman.computeSecret(other_public_key, [input_encoding], [output_encoding])
- diffieHellman.generateKeys([encoding])
- diffieHellman.getGenerator([encoding])
- diffieHellman.getPrime([encoding])
- diffieHellman.getPrivateKey([encoding])
- diffieHellman.getPublicKey([encoding])
- diffieHellman.setPrivateKey(public_key, [encoding])
- diffieHellman.setPublicKey(public_key, [encoding])
- hash.digest([encoding])
- hash.update(data, [input_encoding])
- hmac.digest([encoding])
- hmac.update(data)
- signer.sign(private_key, [output_format])
- signer.update(data)
- verifier.update(data)
- verifier.verify(object, signature, [signature_format])
TSL(SSL)
- Class: SecurePair
- Class: tls.CleartextStream
- Class: tls.Server
- cleartextStream.address()
- cleartextStream.authorizationError
- cleartextStream.authorized
- cleartextStream.getCipher()
- cleartextStream.getPeerCertificate()
- cleartextStream.remoteAddress
- cleartextStream.remotePort
- Client-initiated renegotiation attack mitigation
- Event: 'clientError'
- Event: 'secure'
- Event: 'secureConnect'
- Event: 'secureConnection'
- NPN and SNI
- server.addContext(hostname, credentials)
- server.address()
- server.close()
- server.connections
- server.listen(port, [host], [callback])
- server.maxConnections
- tls.connect(options, [secureConnectListener])
- tls.connect(port, [host], [options], [secureConnectListener])
- tls.createSecurePair([credentials], [isServer], [requestCert], [rejectUnauthorized])
- tls.createServer(options, [secureConnectionListener])
File
File System
- Availability
- Caveats
- Class: fs.FSWatcher
- Class: fs.ReadStream
- Class: fs.Stats
- Event: 'change'
- Event: 'open'
- file.bytesWritten
- Filename Argument
- fs.appendFile(filename, data, encoding='utf8', [callback])
- fs.appendFileSync(filename, data, encoding='utf8')
- fs.chmod(path, mode, [callback])
- fs.chmodSync(path, mode)
- fs.chown(path, uid, gid, [callback])
- fs.chownSync(path, uid, gid)
- fs.close(fd, [callback])
- fs.closeSync(fd)
- fs.createReadStream(path, [options])
- fs.createWriteStream(path, [options])
- fs.exists(path, [callback])
- fs.existsSync(path)
- fs.fchmod(fd, mode, [callback])
- fs.fchmodSync(fd, mode)
- fs.fchown(fd, uid, gid, [callback])
- fs.fchownSync(fd, uid, gid)
- fs.fstat(fd, [callback])
- fs.fstatSync(fd)
- fs.fsync(fd, [callback])
- fs.fsyncSync(fd)
- fs.futimes(fd, atime, mtime, [callback])
- fs.futimesSync(fd, atime, mtime)
- fs.lchmod(path, mode, [callback])
- fs.lchmodSync(path, mode)
- fs.lchown(path, uid, gid, [callback])
- fs.lchownSync(path, uid, gid)
- fs.link(srcpath, dstpath, [callback])
- fs.linkSync(srcpath, dstpath)
- fs.lstat(path, [callback])
- fs.lstatSync(path)
- fs.mkdir(path, [mode], [callback])
- fs.mkdirSync(path, [mode])
- fs.open(path, flags, [mode], [callback])
- fs.openSync(path, flags, [mode])
- fs.read(fd, buffer, offset, length, position, [callback])
- fs.readdir(path, [callback])
- fs.readdirSync(path)
- fs.readFile(filename, [encoding], [callback])
- fs.readFileSync(filename, [encoding])
- fs.readlink(path, [callback])
- fs.readlinkSync(path)
- fs.readSync(fd, buffer, offset, length, position)
- fs.realpath(path, [cache], callback)
- fs.realpathSync(path, [cache])
- fs.rename(oldPath, newPath, [callback])
- fs.renameSync(oldPath, newPath)
- fs.rmdir(path, [callback])
- fs.rmdirSync(path)
- fs.stat(path, [callback])
- fs.statSync(path)
- fs.symlink(destination, path, [type], [callback])
- fs.symlinkSync(destination, path, [type])
- fs.truncate(fd, len, [callback])
- fs.truncateSync(fd, len)
- fs.unlink(path, [callback])
- fs.unlinkSync(path)
- fs.unwatchFile(filename)
- fs.utimes(path, atime, mtime, [callback])
- fs.utimesSync(path, atime, mtime)
- fs.watch(filename, [options], [listener])
- fs.watchFile(filename, [options], listener)
- fs.write(fd, buffer, offset, length, position, [callback])
- fs.writeFile(filename, data, [encoding], [callback])
- fs.writeFileSync(filename, data, [encoding])
- fs.WriteStream
- fs.writeSync(fd, buffer, offset, length, position)
- watcher.close()
Net
net
- Class: net.Server
- Class: net.Socket
- Event: 'connect'
- Event: 'connection'
- Event: 'listening'
- Event: 'timeout'
- net.connect(options, [connectionListener])
- net.connect(path, [connectListener])
- net.connect(port, [host], [connectListener])
- net.createConnection(options, [connectionListener])
- net.createConnection(path, [connectListener])
- net.createConnection(port, [host], [connectListener])
- net.createServer([options], [connectionListener])
- net.isIP(input)
- net.isIPv4(input)
- net.isIPv6(input)
- new net.Socket([options])
- server.close([cb])
- server.listen(handle, [listeningListener])
- server.listen(path, [listeningListener])
- server.listen(port, [host], [backlog], [listeningListener])
- socket.address()
- socket.bufferSize
- socket.bytesRead
- socket.bytesWritten
- socket.connect(path, [connectListener])
- socket.connect(port, [host], [connectListener])
- socket.destroy()
- socket.end([data], [encoding])
- socket.pause()
- socket.remoteAddress
- socket.remotePort
- socket.resume()
- socket.setEncoding([encoding])
- socket.setKeepAlive([enable], [initialDelay])
- socket.setNoDelay([noDelay])
- socket.setTimeout(timeout, [callback])
- socket.write(data, [encoding], [callback])
DNS
- dns.lookup(domain, [family], callback)
- dns.resolve(domain, [rrtype], callback)
- dns.resolve4(domain, callback)
- dns.resolve6(domain, callback)
- dns.resolveCname(domain, callback)
- dns.resolveMx(domain, callback)
- dns.resolveNs(domain, callback)
- dns.resolveSrv(domain, callback)
- dns.resolveTxt(domain, callback)
- dns.reverse(ip, callback)
- Error codes
HTTP
Class: http.ServerRequest
Class: http.ServerResponse
Class: http.ClientRequest
Code
Child Process
- child_process.exec(command, [options], callback)
- child_process.execFile(file, args, options, callback)
- child_process.fork(modulePath, [args], [options])
- child_process.spawn(command, [args], [options])
- child.disconnect()
- child.kill([signal])
- child.pid
- child.send(message, [sendHandle])
- child.stderr
- child.stdin
- child.stdout
- Class: ChildProcess
- Event: 'exit'
- Event: 'disconnect'
Assert
- assert.deepEqual(actual, expected, [message])
- assert.doesNotThrow(block, [error], [message])
- assert.equal(actual, expected, [message])
- assert.fail(actual, expected, message, operator)
- assert.ifError(value)
- assert.notDeepEqual(actual, expected, [message])
- assert.notEqual(actual, expected, [message])
- assert.notStrictEqual(actual, expected, [message])
- assert.strictEqual(actual, expected, [message])
- assert.throws(block, [error], [message])
- assert(value, message), assert.ok(value, [message])