Browse Source

Remove leading comma examples

v0.7.4-release
Ryan Dahl 14 years ago
parent
commit
bce092aeb8
  1. 2
      TODO
  2. 20
      doc/api/child_processes.markdown
  3. 43
      doc/api/fs.markdown
  4. 30
      doc/api/http.markdown
  5. 9
      doc/api/process.markdown
  6. 4
      doc/api/querystring.markdown

2
TODO

@ -25,8 +25,6 @@
EventEmitter.optHandlers.encoding() if it exists. EventEmitter.optHandlers.encoding() if it exists.
- DOCS - DOCS
- Fix examples using leading comma style. EG
http://nodejs.org/docs/v0.3.1/api/fs.html#fs.stat
- anchor links next to each function, for easy linking. - anchor links next to each function, for easy linking.
EG <a href="#fs.stat">#</a> EG <a href="#fs.stat">#</a>

20
doc/api/child_processes.markdown

@ -57,10 +57,9 @@ If omitted, `args` defaults to an empty Array.
The third argument is used to specify additional options, which defaults to: The third argument is used to specify additional options, which defaults to:
{ cwd: undefined { cwd: undefined,
, env: process.env, env: process.env,
, customFds: [-1, -1, -1] customFds: [-1, -1, -1] }
}
`cwd` allows you to specify the working directory from which the process is spawned. `cwd` allows you to specify the working directory from which the process is spawned.
Use `env` to specify environment variables that will be visible to the new process. Use `env` to specify environment variables that will be visible to the new process.
@ -162,13 +161,12 @@ signal that terminated the process.
There is a second optional argument to specify several options. The default options are There is a second optional argument to specify several options. The default options are
{ encoding: 'utf8' { encoding: 'utf8',
, timeout: 0 timeout: 0,
, maxBuffer: 200*1024 maxBuffer: 200*1024,
, killSignal: 'SIGTERM' killSignal: 'SIGTERM',
, cwd: null cwd: null,
, env: null env: null }
}
If `timeout` is greater than 0, then it will kill the child process If `timeout` is greater than 0, then it will kill the child process
if it runs longer than `timeout` milliseconds. The child process is killed with if it runs longer than `timeout` milliseconds. The child process is killed with

43
doc/api/fs.markdown

@ -84,20 +84,19 @@ Synchronous chmod(2).
Asynchronous stat(2). The callback gets two arguments `(err, stats)` where Asynchronous stat(2). The callback gets two arguments `(err, stats)` where
`stats` is a `fs.Stats` object. It looks like this: `stats` is a `fs.Stats` object. It looks like this:
{ dev: 2049 { dev: 2049,
, ino: 305352 ino: 305352,
, mode: 16877 mode: 16877,
, nlink: 12 nlink: 12,
, uid: 1000 uid: 1000,
, gid: 1000 gid: 1000,
, rdev: 0 rdev: 0,
, size: 4096 size: 4096,
, blksize: 4096 blksize: 4096,
, blocks: 8 blocks: 8,
, atime: '2009-06-29T11:11:55Z' atime: '2009-06-29T11:11:55Z',
, mtime: '2009-06-29T11:11:40Z' mtime: '2009-06-29T11:11:40Z',
, ctime: '2009-06-29T11:11:40Z' ctime: '2009-06-29T11:11:40Z' }
}
See the `fs.Stats` section below for more information. See the `fs.Stats` section below for more information.
@ -350,11 +349,10 @@ Returns a new ReadStream object (See `Readable Stream`).
`options` is an object with the following defaults: `options` is an object with the following defaults:
{ 'flags': 'r' { flags: 'r',
, 'encoding': null encoding: null,
, 'mode': 0666 mode: 0666,
, 'bufferSize': 4 * 1024 bufferSize: 4096 }
}
`options` can include `start` and `end` values to read a range of bytes from `options` can include `start` and `end` values to read a range of bytes from
the file instead of the entire file. Both `start` and `end` are inclusive and the file instead of the entire file. Both `start` and `end` are inclusive and
@ -381,7 +379,6 @@ Returns a new WriteStream object (See `Writable Stream`).
`options` is an object with the following defaults: `options` is an object with the following defaults:
{ 'flags': 'w' { flags: 'w',
, 'encoding': null encoding: null,
, 'mode': 0666 mode: 0666 }
}

30
doc/api/http.markdown

@ -10,11 +10,10 @@ user is able to stream data.
HTTP message headers are represented by an object like this: HTTP message headers are represented by an object like this:
{ 'content-length': '123' { 'content-length': '123',
, 'content-type': 'text/plain' 'content-type': 'text/plain',
, 'connection': 'keep-alive' 'connection': 'keep-alive',
, 'accept': '*/*' 'accept': '*/*' }
}
Keys are lowercased. Values are not modified. Keys are lowercased. Values are not modified.
@ -182,22 +181,20 @@ If you would like to parse the URL into its parts, you can use
`require('url').parse(request.url)`. Example: `require('url').parse(request.url)`. Example:
node> require('url').parse('/status?name=ryan') node> require('url').parse('/status?name=ryan')
{ href: '/status?name=ryan' { href: '/status?name=ryan',
, search: '?name=ryan' search: '?name=ryan',
, query: 'name=ryan' query: 'name=ryan',
, pathname: '/status' pathname: '/status' }
}
If you would like to extract the params from the query string, If you would like to extract the params from the query string,
you can use the `require('querystring').parse` function, or pass you can use the `require('querystring').parse` function, or pass
`true` as the second argument to `require('url').parse`. Example: `true` as the second argument to `require('url').parse`. Example:
node> require('url').parse('/status?name=ryan', true) node> require('url').parse('/status?name=ryan', true)
{ href: '/status?name=ryan' { href: '/status?name=ryan',
, search: '?name=ryan' search: '?name=ryan',
, query: { name: 'ryan' } query: { name: 'ryan' },
, pathname: '/status' pathname: '/status' }
}
@ -266,8 +263,7 @@ Example:
var body = 'hello world'; var body = 'hello world';
response.writeHead(200, { response.writeHead(200, {
'Content-Length': body.length, 'Content-Length': body.length,
'Content-Type': 'text/plain' 'Content-Type': 'text/plain' });
});
This method must only be called once on a message and it must This method must only be called once on a message and it must
be called before `response.end()` is called. be called before `response.end()` is called.

9
doc/api/process.markdown

@ -276,11 +276,10 @@ Returns an object describing the memory usage of the Node process.
This will generate: This will generate:
{ rss: 4935680 { rss: 4935680,
, vsize: 41893888 vsize: 41893888,
, heapTotal: 1826816 heapTotal: 1826816,
, heapUsed: 650472 heapUsed: 650472 }
}
`heapTotal` and `heapUsed` refer to V8's memory usage. `heapTotal` and `heapUsed` refer to V8's memory usage.

4
doc/api/querystring.markdown

@ -24,9 +24,7 @@ Example:
querystring.parse('a=b&b=c') querystring.parse('a=b&b=c')
// returns // returns
{ 'a': 'b' { a: 'b', b: 'c' }
, 'b': 'c'
}
### querystring.escape ### querystring.escape

Loading…
Cancel
Save