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.
- 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.
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:
{ cwd: undefined
, env: process.env,
, customFds: [-1, -1, -1]
}
{ cwd: undefined,
env: process.env,
customFds: [-1, -1, -1] }
`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.
@ -162,13 +161,12 @@ signal that terminated the process.
There is a second optional argument to specify several options. The default options are
{ encoding: 'utf8'
, timeout: 0
, maxBuffer: 200*1024
, killSignal: 'SIGTERM'
, cwd: null
, env: null
}
{ encoding: 'utf8',
timeout: 0,
maxBuffer: 200*1024,
killSignal: 'SIGTERM',
cwd: null,
env: null }
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

43
doc/api/fs.markdown

@ -84,20 +84,19 @@ Synchronous chmod(2).
Asynchronous stat(2). The callback gets two arguments `(err, stats)` where
`stats` is a `fs.Stats` object. It looks like this:
{ dev: 2049
, ino: 305352
, mode: 16877
, nlink: 12
, uid: 1000
, gid: 1000
, rdev: 0
, size: 4096
, blksize: 4096
, blocks: 8
, atime: '2009-06-29T11:11:55Z'
, mtime: '2009-06-29T11:11:40Z'
, ctime: '2009-06-29T11:11:40Z'
}
{ dev: 2049,
ino: 305352,
mode: 16877,
nlink: 12,
uid: 1000,
gid: 1000,
rdev: 0,
size: 4096,
blksize: 4096,
blocks: 8,
atime: '2009-06-29T11:11:55Z',
mtime: '2009-06-29T11:11:40Z',
ctime: '2009-06-29T11:11:40Z' }
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:
{ 'flags': 'r'
, 'encoding': null
, 'mode': 0666
, 'bufferSize': 4 * 1024
}
{ flags: 'r',
encoding: null,
mode: 0666,
bufferSize: 4096 }
`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
@ -381,7 +379,6 @@ Returns a new WriteStream object (See `Writable Stream`).
`options` is an object with the following defaults:
{ 'flags': 'w'
, 'encoding': null
, 'mode': 0666
}
{ flags: 'w',
encoding: null,
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:
{ 'content-length': '123'
, 'content-type': 'text/plain'
, 'connection': 'keep-alive'
, 'accept': '*/*'
}
{ 'content-length': '123',
'content-type': 'text/plain',
'connection': 'keep-alive',
'accept': '*/*' }
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:
node> require('url').parse('/status?name=ryan')
{ href: '/status?name=ryan'
, search: '?name=ryan'
, query: 'name=ryan'
, pathname: '/status'
}
{ href: '/status?name=ryan',
search: '?name=ryan',
query: 'name=ryan',
pathname: '/status' }
If you would like to extract the params from the query string,
you can use the `require('querystring').parse` function, or pass
`true` as the second argument to `require('url').parse`. Example:
node> require('url').parse('/status?name=ryan', true)
{ href: '/status?name=ryan'
, search: '?name=ryan'
, query: { name: 'ryan' }
, pathname: '/status'
}
{ href: '/status?name=ryan',
search: '?name=ryan',
query: { name: 'ryan' },
pathname: '/status' }
@ -266,8 +263,7 @@ Example:
var body = 'hello world';
response.writeHead(200, {
'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
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:
{ rss: 4935680
, vsize: 41893888
, heapTotal: 1826816
, heapUsed: 650472
}
{ rss: 4935680,
vsize: 41893888,
heapTotal: 1826816,
heapUsed: 650472 }
`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')
// returns
{ 'a': 'b'
, 'b': 'c'
}
{ a: 'b', b: 'c' }
### querystring.escape

Loading…
Cancel
Save