55These objects are available in all modules. Some of these objects aren't
66actually in the global scope but in the module scope - this will be noted.
77
8- ## global
9-
10- <!-- type=global -->
11-
12- * {Object} The global namespace object.
13-
14- In browsers, the top-level scope is the global scope. That means that in
15- browsers if you're in the global scope ` var something ` will define a global
16- variable. In Node.js this is different. The top-level scope is not the global
17- scope; ` var something ` inside an Node.js module will be local to that module.
18-
19- ## process
20-
21- <!-- type=global -->
22-
23- * {Object}
24-
25- The process object. See the [ process object] [ ] section.
26-
27- ## console
28-
29- <!-- type=global -->
30-
31- * {Object}
32-
33- Used to print to stdout and stderr. See the [ console] [ ] section.
34-
358## Class: Buffer
369
3710<!-- type=global -->
@@ -40,48 +13,20 @@ Used to print to stdout and stderr. See the [console][] section.
4013
4114Used to handle binary data. See the [ buffer section] [ ]
4215
43- ## require()
16+ ## __ dirname
4417
4518<!-- type=var -->
4619
47- * {Function}
48-
49- To require modules. See the [ Modules] [ ] section. ` require ` isn't actually a
50- global but rather local to each module.
51-
52- ### require.resolve()
53-
54- Use the internal ` require() ` machinery to look up the location of a module,
55- but rather than loading the module, just return the resolved filename.
56-
57- ### require.cache
58-
59- * {Object}
60-
61- Modules are cached in this object when they are required. By deleting a key
62- value from this object, the next ` require ` will reload the module.
63-
64- ### require.extensions
65-
66- Stability: 0 - Deprecated
67-
68- * {Object}
69-
70- Instruct ` require ` on how to handle certain file extensions.
20+ * {String}
7121
72- Process files with the extension ` .sjs ` as ` .js ` :
22+ The name of the directory that the currently executing script resides in.
7323
74- require.extensions['.sjs'] = require.extensions['.js'];
24+ Example: running ` node example.js ` from ` /Users/mjr `
7525
76- ** Deprecated** In the past, this list has been used to load
77- non-JavaScript modules into Node.js by compiling them on-demand.
78- However, in practice, there are much better ways to do this, such as
79- loading modules via some other Node.js program, or compiling them to
80- JavaScript ahead of time.
26+ console.log(__dirname);
27+ // /Users/mjr
8128
82- Since the Module system is locked, this feature will probably never go
83- away. However, it may have subtle bugs and complexities that are best
84- left untouched.
29+ ` __dirname ` isn't actually a global but rather local to each module.
8530
8631## __ filename
8732
@@ -101,21 +46,57 @@ Example: running `node example.js` from `/Users/mjr`
10146
10247` __filename ` isn't actually a global but rather local to each module.
10348
104- ## __ dirname
49+ ## clearInterval(t)
50+
51+ Stop a timer that was previously created with ` setInterval() ` . The callback
52+ will not execute.
53+
54+ <!-- type=global-->
55+
56+ The timer functions are global variables. See the [ timers] [ ] section.
57+
58+ [ buffer section ] : buffer.html
59+ [ module system documentation ] : modules.html
60+ [ Modules ] : modules.html#modules_modules
61+ [ process object ] : process.html#process_process
62+ [ console ] : console.html
63+ [ timers ] : timers.html
64+
65+ ## clearTimeout(t)
66+
67+ Stop a timer that was previously created with ` setTimeout() ` . The callback will
68+ not execute.
69+
70+ ## console
71+
72+ <!-- type=global -->
73+
74+ * {Object}
75+
76+ Used to print to stdout and stderr. See the [ console] [ ] section.
77+
78+ ## exports
10579
10680<!-- type=var -->
10781
108- * {String}
82+ A reference to the ` module.exports ` that is shorter to type.
83+ See [ module system documentation] [ ] for details on when to use ` exports ` and
84+ when to use ` module.exports ` .
10985
110- The name of the directory that the currently executing script resides in .
86+ ` exports ` isn't actually a global but rather local to each module .
11187
112- Example: running ` node example.js ` from ` /Users/mjr `
88+ See the [ module system documentation ] [ ] for more information.
11389
114- console.log(__dirname);
115- // /Users/mjr
90+ ## global
11691
117- ` __dirname ` isn't actually a global but rather local to each module.
92+ <!-- type=global -->
93+
94+ * {Object} The global namespace object.
11895
96+ In browsers, the top-level scope is the global scope. That means that in
97+ browsers if you're in the global scope ` var something ` will define a global
98+ variable. In Node.js this is different. The top-level scope is not the global
99+ scope; ` var something ` inside an Node.js module will be local to that module.
119100
120101## module
121102
@@ -131,33 +112,56 @@ available through `require()`.
131112
132113See the [ module system documentation] [ ] for more information.
133114
134- ## exports
115+ ## process
116+
117+ <!-- type=global -->
118+
119+ * {Object}
120+
121+ The process object. See the [ process object] [ ] section.
122+
123+ ## require()
135124
136125<!-- type=var -->
137126
138- A reference to the ` module.exports ` that is shorter to type.
139- See [ module system documentation] [ ] for details on when to use ` exports ` and
140- when to use ` module.exports ` .
127+ * {Function}
141128
142- ` exports ` isn't actually a global but rather local to each module.
129+ To require modules. See the [ Modules] [ ] section. ` require ` isn't actually a
130+ global but rather local to each module.
143131
144- See the [ module system documentation ] [ ] for more information.
132+ ### require.cache
145133
146- ## setTimeout(cb, ms)
134+ * {Object}
147135
148- Run callback ` cb ` after * at least * ` ms ` milliseconds. The actual delay depends
149- on external factors like OS timer granularity and system load .
136+ Modules are cached in this object when they are required. By deleting a key
137+ value from this object, the next ` require ` will reload the module .
150138
151- The timeout must be in the range of 1-2,147,483,647 inclusive. If the value is
152- outside that range, it's changed to 1 millisecond. Broadly speaking, a timer
153- cannot span more than 24.8 days.
139+ ### require.extensions
154140
155- Returns an opaque value that represents the timer.
141+ Stability: 0 - Deprecated
156142
157- ## clearTimeout(t)
143+ * {Object}
158144
159- Stop a timer that was previously created with ` setTimeout() ` . The callback will
160- not execute.
145+ Instruct ` require ` on how to handle certain file extensions.
146+
147+ Process files with the extension ` .sjs ` as ` .js ` :
148+
149+ require.extensions['.sjs'] = require.extensions['.js'];
150+
151+ ** Deprecated** In the past, this list has been used to load
152+ non-JavaScript modules into Node.js by compiling them on-demand.
153+ However, in practice, there are much better ways to do this, such as
154+ loading modules via some other Node.js program, or compiling them to
155+ JavaScript ahead of time.
156+
157+ Since the Module system is locked, this feature will probably never go
158+ away. However, it may have subtle bugs and complexities that are best
159+ left untouched.
160+
161+ ### require.resolve()
162+
163+ Use the internal ` require() ` machinery to look up the location of a module,
164+ but rather than loading the module, just return the resolved filename.
161165
162166## setInterval(cb, ms)
163167
@@ -171,18 +175,13 @@ cannot span more than 24.8 days.
171175
172176Returns an opaque value that represents the timer.
173177
174- ## clearInterval(t)
175-
176- Stop a timer that was previously created with ` setInterval() ` . The callback
177- will not execute.
178+ ## setTimeout(cb, ms)
178179
179- <!-- type=global-->
180+ Run callback ` cb ` after * at least* ` ms ` milliseconds. The actual delay depends
181+ on external factors like OS timer granularity and system load.
180182
181- The timer functions are global variables. See the [ timers] [ ] section.
183+ The timeout must be in the range of 1-2,147,483,647 inclusive. If the value is
184+ outside that range, it's changed to 1 millisecond. Broadly speaking, a timer
185+ cannot span more than 24.8 days.
182186
183- [ buffer section ] : buffer.html
184- [ module system documentation ] : modules.html
185- [ Modules ] : modules.html#modules_modules
186- [ process object ] : process.html#process_process
187- [ console ] : console.html
188- [ timers ] : timers.html
187+ Returns an opaque value that represents the timer.
0 commit comments