Node.js Manual & DocumentationContents Synopsis 概要 Global Objects 全局对象 o global o process o require() o require.resolve() o require.paths o __filename o __dirname o module Timers 定时器 o setTimeout(callback . o Loading from the `require.paths` Folders 从`require.paths`目 录中加载 Note:** Please Avoid Modifying `require.paths` **注意:** 请不要修改`requires.paths` Setting `require.paths` to some other value value does nothing. 将`require.paths`设为其他值不会产生任何作用 Putting relative paths in `require.paths` is... weird. 不建议在`require.paths`中发入相对路径 Zero Isolation 零隔离 Addenda: Package Manager Tips 附录:包管理技巧0 码力 | 153 页 | 1.21 MB | 1 年前3
Node.js - the coreargument and is named err Some libraries require following these conventions ex. Async.js See example on next slide 10 Node.js Callback Example 11 var fs = require('fs'); function readObject(filePath (err, obj) { if (err) { console.error(err); } else { console.log(obj); } }); fs = require 'fs' readObject = (filePath, cb) -> fs.readFile filePath, (err, buf) -> if !err try https://github.com/caolan/async 12 Node.js Async Example 13 var async = require('async'); var fs = require('fs'); var rimraf = require('rimraf'); // Unix "rm -rf" for Node var dirPath = 'foo'; var fileName0 码力 | 124 页 | 7.87 MB | 1 年前3
The Node.js Handbook
js application The most common example Hello World of Node.js is a web server: 11 const http = require('http') const hostname = '127.0.0.1' const port = 3000 const server = http.createServer((req way to load modules across all JavaScript, frontend or backend, but Node.js still supports the require syntax. 6. The V8 JavaScript Engine V8 is the name of the JavaScript engine that powers Google is done. Many times with Node.js we start servers, like this HTTP server: 25 const express = require('express') const app = express() app.get('/', (req, res) => { res.send('Hi!') })0 码力 | 161 页 | 1.66 MB | 1 年前3
Back to Basics Testing"gtest/gtest.h" std::string left_pad(std::string const& str, size_t min_len, char pad_char=' '); REQUIRE(left_pad("", 0) == ""); ASSERT_EQ(left_pad("", 0), "");58 TEST_CASE("left_pad pads strings to a left_pad(std::string const& str, size_t min_len, char pad_char=' '); REQUIRE(left_pad("", 0) == ""); ASSERT_EQ(left_pad("", 0), ""); REQUIRE(left_pad("abc", 0) == "abc"); ASSERT_EQ(left_pad("abc", 0), "abc"); left_pad(std::string const& str, size_t min_len, char pad_char=' '); REQUIRE(left_pad("", 0) == ""); ASSERT_EQ(left_pad("", 0), ""); REQUIRE(left_pad("abc", 0) == "abc"); ASSERT_EQ(left_pad("abc", 0), "abc");0 码力 | 79 页 | 25.86 MB | 6 月前3
NodeJS 中文文档 V0.2.3Synopsis Synopsis Synopsis Synopsis 总述 总述 总述 总述 使用 node 实现的 web 服务器示例,它返回'Hello World': var http = require('http'); http.createServer(function (request, response) { response.writeHead(200, {'Content-Type': 标准模块 node 附带了一些模块,这些模板都被编译进了 node 二进制文件中,其中大部分将在下文介绍。 使用这些模块 最常见的方法是调用“require('name')”并将返回值赋给一个和模块同名的局部变量。 例如: var sys = require('sys'); 同样可以使用其他模块扩展 node。 详情参看"模块"章节。 Buffers Buffers Buffers Buffers 原始的数据保存在 Buffer 类的实例中。Buffer 类似于一个整数数组,不同之处在于它和在 V8内存堆之外分配的 一段内存数据相对应。Buffer 对象的大小不能调整。你可以通过"require('buffer').Buffer"来使用这个类。 Buffer 对象是全局对象。 Buffer 和 Javascirpt 中 string 对象之间的转换需要指定编码方式。如下是 node0 码力 | 62 页 | 542.14 KB | 1 年前3
Conan 2.0 Documentationlocking mechanism to avoid possible disruption from packages in ConanCenter that are updated and require latest Conan version. • Configuration and automatic tools detection, like the detection of the default all the artifacts, binaries, and build files that is completely independent of Conan and no longer require Conan at all to build. 10 Chapter 2. What’s new in Conan 2 Conan Documentation, Release 2.0.17 command. 2. Use a system installer, or create your own self-contained Conan executable, to not require Python in your system. 3. Running Conan from sources. 3.1 Install with pip (recommended) To install0 码力 | 652 页 | 4.00 MB | 1 年前3
Conan 2.1 Documentationlocking mechanism to avoid possible disruption from packages in ConanCenter that are updated and require latest Conan version. • Configuration and automatic tools detection, like the detection of the default all the artifacts, binaries, and build files that is completely independent of Conan and no longer require Conan at all to build. 10 Chapter 2. What’s new in Conan 2 Conan Documentation, Release 2.1.0 command. 2. Use a system installer, or create your own self-contained Conan executable, to not require Python in your system. 3. Running Conan from sources. 3.1 Install with pip (recommended) To install0 码力 | 694 页 | 4.13 MB | 1 年前3
Conan 2.5 Documentationlocking mechanism to avoid possible disruption from packages in ConanCenter that are updated and require latest Conan version. • Configuration and automatic tools detection, like the detection of the default all the artifacts, binaries, and build files that is completely independent of Conan and no longer require Conan at all to build. 10 Chapter 2. What’s new in Conan 2 Conan Documentation, Release 2.5.0 command. 2. Use a system installer, or create your own self-contained Conan executable, to not require Python in your system. 3. Running Conan from sources. 3.1 Install with pip (recommended) To install0 码力 | 769 页 | 4.70 MB | 1 年前3
Conan 2.4 Documentationlocking mechanism to avoid possible disruption from packages in ConanCenter that are updated and require latest Conan version. • Configuration and automatic tools detection, like the detection of the default all the artifacts, binaries, and build files that is completely independent of Conan and no longer require Conan at all to build. 10 Chapter 2. What’s new in Conan 2 Conan Documentation, Release 2.4.1 command. 2. Use a system installer, or create your own self-contained Conan executable, to not require Python in your system. 3. Running Conan from sources. 3.1 Install with pip (recommended) To install0 码力 | 769 页 | 4.69 MB | 1 年前3
Conan 2.3 Documentationlocking mechanism to avoid possible disruption from packages in ConanCenter that are updated and require latest Conan version. • Configuration and automatic tools detection, like the detection of the default all the artifacts, binaries, and build files that is completely independent of Conan and no longer require Conan at all to build. 10 Chapter 2. What’s new in Conan 2 Conan Documentation, Release 2.3.2 command. 2. Use a system installer, or create your own self-contained Conan executable, to not require Python in your system. 3. Running Conan from sources. 3.1 Install with pip (recommended) To install0 码力 | 748 页 | 4.65 MB | 1 年前3
共 1000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 100













