nodeJS 中文API node.js 中文文檔__js

來源:互聯網
上載者:User
Node.js Manual & Documentation Table Of Contents Synopsis 概要 Global Objects 全域對象 global process require() require.resolve() require.paths __filename __dirname module Timers 定時器 setTimeout(callback, delay, [arg], [...]) clearTimeout(timeoutId) setInterval(callback, delay, [arg], [...]) clearInterval(intervalId) Modules 模組 Core Modules 核心模組 File Modules 檔案模組 Loading from `node_modules` Folders 從 `node_modules` 目錄中載入 Optimizations to the `node_modules` Lookup Process 最佳化 `node_modules` 的尋找過程 Folders as Modules 目錄作為模組 Caching 緩衝 All Together... 總結一下... Loading from the `require.paths` Folders 從`require.paths`目錄中載入 Note:** Please Avoid Modifying `require.paths` **注意:** 請不要修改`requires.paths` Setting `require.paths` to some other value does nothing. 將`require.paths`設為其他值不會產生任何作用 Putting relative paths in `require.paths` is... weird. 不建議在`require.paths`中發入相對路徑 Zero Isolation 零隔離 Addenda: Package Manager Tips 附錄:包管理技巧 Addons 擴充外掛程式 process 進程 Event: 'exit' 事件:'exit' Event: 'uncaughtException' 事件:'uncaughtException' Signal Events 訊號事件 process.stdout process.stderr process.stdin process.argv process.execPath process.chdir(directory) process.cwd() process.env process.exit(code=0) process.getgid() process.setgid(id) process.getuid() process.setuid(id) process.version process.installPrefix process.kill(pid, signal='SIGTERM') process.pid process.title process.platform process.memoryUsage() process.nextTick(callback) process.umask([mask]) util 工具模組 util.debug(string) util.log(string) util.inspect(object, showHidden=false, depth=2) util.pump(readableStream, writableStream, [callback]) util.inherits(constructor, superConstructor) Events 事件模組 events.EventEmitter emitter.addListener(event, listener) emitter.on(event, listener) emitter.once(event, listener) emitter.removeListener(event, listener) emitter.removeAllListeners(event) emitter.setMaxListeners(n) emitter.listeners(event) emitter.emit(event, [arg1], [arg2], [...]) Event: 'newListener' 事件:'newListener' Buffers 緩衝器 new Buffer(size) new Buffer(array) new Buffer(str, encoding='utf8') buffer.write(string, offset=0, encoding='utf8') buffer.toString(encoding, start=0, end=buffer.length) buffer[index] Buffer.isBuffer(obj) Buffer.byteLength(string, encoding='utf8') buffer.length buffer.copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) buffer.slice(start, end=buffer.length) Streams 流 Readable Stream 可讀流 Event: 'data' 事件:'data' Event: 'end' 事件:'end' Event: 'error' 事件:'error' Event: 'close' 事件:'close' Event: 'fd' 事件:'fd' stream.readable stream.setEncoding(encoding) stream.pause() stream.resume() stream.destroy() stream.destroySoon() stream.pipe(destination, [options]) Writable Stream 可寫流 Event: 'drain' 事件:'drain' Event: 'error' 事件:'error' Event: 'close' 事件:'close' Event: 'pipe' 事件:'pipe' stream.writable stream.write(string, encoding='utf8', [fd]) stream.write(buffer) stream.end() stream.end(string, encoding) stream.end(buffer) stream.destroy() Crypto 加密模組 crypto.createCredentials(details) crypto.createHash(algorithm) hash.update(data) hash.digest(encoding='binary') crypto.createHmac(algorithm, key) hmac.update(data) hmac.digest(encoding='binary') crypto.createCipher(algorithm, key) cipher.update(data, input_encoding='binary', output_encoding='binary') cipher.final(output_encoding='binary') crypto.createDecipher(algorithm, key) decipher.update(data, input_encoding='binary', output_encoding='binary') decipher.final(output_encoding='binary') crypto.createSign(algorithm) signer.update(data) signer.sign(private_key, output_format='binary') crypto.createVerify(algorithm) verifier.update(data) verifier.verify(cert, signature, signature_format='binary') TLS (SSL) TLS (SSL)模組 s = tls.connect(port, [host], [options], callback) tls.Server tls.createServer(options, secureConnectionListener) Event: 'secureConnection' 事件:'secureConnection' server.listen(port, [host], [callback]) server.close() server.maxConnections server.connections File System 檔案系統模組 fs.rename(path1, path2, [callback]) fs.renameSync(path1, path2) fs.truncate(fd, len, [callback]) fs.truncateSync(fd, len) fs.chmod(path, mode, [callback]) fs.chmodSync(path, mode) fs.stat(path, [callback]) fs.lstat(path, [callback]) fs.fstat(fd, [callback]) fs.statSync(path) fs.lstatSync(path) fs.fstatSync(fd) fs.link(srcpath, dstpath, [callback]) fs.linkSync(srcpath, dstpath) fs.symlink(linkdata, path, [callback]) fs.symlinkSync(linkdata, path) fs.readlink(path, [callback]) fs.readlinkSync(path) fs.realpath(path, [callback]) fs.realpathSync(path) fs.unlink(path, [callback]) fs.unlinkSync(path) fs.rmdir(path, [callback]) fs.rmdirSync(path) fs.mkdir(path, mode, [callback]) fs.mkdirSync(path, mode) fs.readdir(path, [callback]) fs.readdirSync(path) fs.close(fd, [callback]) fs.closeSync(fd) fs.open(path, flags, mode=0666, [callback]) fs.openSync(path, flags, mode=0666) fs.utimes(path, atime, mtime, callback) fs.utimesSync(path, atime, mtime) fs.futimes(path, atime, mtime, callback) fs.futimesSync(path, atime, mtime) fs.write(fd, buffer, offset, length, position, [callback]) fs.writeSync(fd, buffer, offset, length, position) fs.writeSync(fd, str, position, encoding='utf8') fs.read(fd, buffer, offset, length, position, [callback])

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.