docs: fix docs to not suggest variable leaks
authorkoichik <koichik@improvement.jp>
Tue, 27 Dec 2011 08:43:58 +0000 (17:43 +0900)
committerkoichik <koichik@improvement.jp>
Tue, 27 Dec 2011 08:43:58 +0000 (17:43 +0900)
Fixes #2106.

13 files changed:
doc/api/buffers.markdown
doc/api/child_processes.markdown
doc/api/crypto.markdown
doc/api/dns.markdown
doc/api/fs.markdown
doc/api/http.markdown
doc/api/net.markdown
doc/api/process.markdown
doc/api/querystring.markdown
doc/api/repl.markdown
doc/api/streams.markdown
doc/api/url.markdown
doc/api/util.markdown

index 0ac7eb0..3bc9559 100644 (file)
@@ -43,18 +43,19 @@ Allocates a new buffer of `size` octets.
 
 Allocates a new buffer using an `array` of octets.
 
-### new Buffer(str, encoding='utf8')
+### new Buffer(str, [encoding])
 
 Allocates a new buffer containing the given `str`.
+`encoding` defaults to `'utf8'`.
 
-### buffer.write(string, offset=0, length=buffer.length-offset, encoding='utf8')
+### buffer.write(string, [offset], [length], [encoding])
 
-Writes `string` to the buffer at `offset` using the given encoding. `length` is
+Writes `string` to the buffer at `offset` using the given encoding.
+`offset` defaults to `0`, `encoding` defaults to `'utf8'`. `length` is
 the number of bytes to write. Returns number of octets written. If `buffer` did
 not contain enough space to fit the entire string, it will write a partial
-amount of the string. The method will not write partial characters.
-
-Example: write a utf8 string into a buffer, then print it
+amount of the string. `length` defaults to `buffer.length - offset`.
+The method will not write partial characters.
 
     buf = new Buffer(256);
     len = buf.write('\u00bd + \u00bc = \u00be', 0);
@@ -65,10 +66,11 @@ bytes written) is set in `Buffer._charsWritten` and will be overwritten the
 next time `buf.write()` is called.
 
 
-### buffer.toString(encoding, start=0, end=buffer.length)
+### buffer.toString(encoding, [start], [end])
 
 Decodes and returns a string from buffer data encoded with `encoding`
-beginning at `start` and ending at `end`.
+(defaults to `'utf8'`) beginning at `start` (defaults to `0`) and ending at
+`end` (defaults to `buffer.length`).
 
 See `buffer.write()` example, above.
 
@@ -95,11 +97,11 @@ Example: copy an ASCII string into a buffer, one byte at a time:
 
 Tests if `obj` is a `Buffer`.
 
-### Buffer.byteLength(string, encoding='utf8')
+### Buffer.byteLength(string, [encoding])
 
-Gives the actual byte length of a string.  This is not the same as
-`String.prototype.length` since that returns the number of *characters* in a
-string.
+Gives the actual byte length of a string. `encoding` defaults to `'utf8'`.
+This is not the same as `String.prototype.length` since that returns the
+number of *characters* in a string.
 
 Example:
 
@@ -126,9 +128,11 @@ buffer object.  It does not change when the contents of the buffer are changed.
     // 1234
     // 1234
 
-### buffer.copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length)
+### buffer.copy(targetBuffer, [targetStart], [sourceStart], [sourceEnd])
 
 Does copy between buffers. The source and target regions can be overlapped.
+`targetStart` and `sourceStart` default to `0`.
+`sourceEnd` defaults to `buffer.length`.
 
 Example: build two Buffers, then copy `buf1` from byte 16 through byte 19
 into `buf2`, starting at the 8th byte in `buf2`.
@@ -147,11 +151,11 @@ into `buf2`, starting at the 8th byte in `buf2`.
     // !!!!!!!!qrst!!!!!!!!!!!!!
 
 
-### buffer.slice(start, end=buffer.length)
+### buffer.slice([start], [end])
 
-Returns a new buffer which references the
-same memory as the old, but offset and cropped by the `start` and `end`
-indexes.
+Returns a new buffer which references the same memory as the old, but offset
+and cropped by the `start` (defaults to `0`) and `end` (defaults to
+`buffer.length`) indexes.
 
 **Modifying the new buffer slice will modify memory in the original buffer!**
 
@@ -172,12 +176,12 @@ byte from the original Buffer.
     // abc
     // !bc
 
-### buffer.readUInt8(offset, noAssert=false)
+### buffer.readUInt8(offset, [noAssert])
 
 Reads an unsigned 8 bit integer from the buffer at the specified offset.
 
 Set `noAssert` to true to skip validation of `offset`. This means that `offset`
-may be beyond the end of the buffer.
+may be beyond the end of the buffer. Defaults to `false`.
 
 Example:
 
@@ -197,14 +201,14 @@ Example:
     // 0x23
     // 0x42
 
-### buffer.readUInt16LE(offset, noAssert=false)
-### buffer.readUInt16BE(offset, noAssert=false)
+### buffer.readUInt16LE(offset, [noAssert])
+### buffer.readUInt16BE(offset, [noAssert])
 
 Reads an unsigned 16 bit integer from the buffer at the specified offset with
 specified endian format.
 
 Set `noAssert` to true to skip validation of `offset`. This means that `offset`
-may be beyond the end of the buffer.
+may be beyond the end of the buffer. Defaults to `false`.
 
 Example:
 
@@ -229,14 +233,14 @@ Example:
     // 0x2342
     // 0x4223
 
-### buffer.readUInt32LE(offset, noAssert=false)
-### buffer.readUInt32BE(offset, noAssert=false)
+### buffer.readUInt32LE(offset, [noAssert])
+### buffer.readUInt32BE(offset, [noAssert])
 
 Reads an unsigned 32 bit integer from the buffer at the specified offset with
 specified endian format.
 
 Set `noAssert` to true to skip validation of `offset`. This means that `offset`
-may be beyond the end of the buffer.
+may be beyond the end of the buffer. Defaults to `false`.
 
 Example:
 
@@ -253,48 +257,48 @@ Example:
     // 0x03042342
     // 0x42230403
 
-### buffer.readInt8(offset, noAssert=false)
+### buffer.readInt8(offset, [noAssert])
 
 Reads a signed 8 bit integer from the buffer at the specified offset.
 
 Set `noAssert` to true to skip validation of `offset`. This means that `offset`
-may be beyond the end of the buffer.
+may be beyond the end of the buffer. Defaults to `false`.
 
 Works as `buffer.readUInt8`, except buffer contents are treated as two's
 complement signed values.
 
-### buffer.readInt16LE(offset, noAssert=false)
-### buffer.readInt16BE(offset, noAssert=false)
+### buffer.readInt16LE(offset, [noAssert])
+### buffer.readInt16BE(offset, [noAssert])
 
 Reads a signed 16 bit integer from the buffer at the specified offset with
 specified endian format.
 
 Set `noAssert` to true to skip validation of `offset`. This means that `offset`
-may be beyond the end of the buffer.
+may be beyond the end of the buffer. Defaults to `false`.
 
 Works as `buffer.readUInt16*`, except buffer contents are treated as two's
 complement signed values.
 
-### buffer.readInt32LE(offset, noAssert=false)
-### buffer.readInt32BE(offset, noAssert=false)
+### buffer.readInt32LE(offset, [noAssert])
+### buffer.readInt32BE(offset, [noAssert])
 
 Reads a signed 32 bit integer from the buffer at the specified offset with
 specified endian format.
 
 Set `noAssert` to true to skip validation of `offset`. This means that `offset`
-may be beyond the end of the buffer.
+may be beyond the end of the buffer. Defaults to `false`.
 
 Works as `buffer.readUInt32*`, except buffer contents are treated as two's
 complement signed values.
 
-### buffer.readFloatLE(offset, noAssert=false)
-### buffer.readFloatBE(offset, noAssert=false)
+### buffer.readFloatLE(offset, [noAssert])
+### buffer.readFloatBE(offset, [noAssert])
 
 Reads a 32 bit float from the buffer at the specified offset with specified
 endian format.
 
 Set `noAssert` to true to skip validation of `offset`. This means that `offset`
-may be beyond the end of the buffer.
+may be beyond the end of the buffer. Defaults to `false`.
 
 Example:
 
@@ -309,14 +313,14 @@ Example:
 
     // 0x01
 
-### buffer.readDoubleLE(offset, noAssert=false)
-### buffer.readDoubleBE(offset, noAssert=false)
+### buffer.readDoubleLE(offset, [noAssert])
+### buffer.readDoubleBE(offset, [noAssert])
 
 Reads a 64 bit double from the buffer at the specified offset with specified
 endian format.
 
 Set `noAssert` to true to skip validation of `offset`. This means that `offset`
-may be beyond the end of the buffer.
+may be beyond the end of the buffer. Defaults to `false`.
 
 Example:
 
@@ -335,7 +339,7 @@ Example:
 
     // 0.3333333333333333
 
-### buffer.writeUInt8(value, offset, noAssert=false)
+### buffer.writeUInt8(value, offset, [noAssert])
 
 Writes `value` to the buffer at the specified offset. Note, `value` must be a
 valid unsigned 8 bit integer.
@@ -343,7 +347,7 @@ valid unsigned 8 bit integer.
 Set `noAssert` to true to skip validation of `value` and `offset`. This means
 that `value` may be too large for the specific function and `offset` may be
 beyond the end of the buffer leading to the values being silently dropped. This
-should not be used unless you are certain of correctness.
+should not be used unless you are certain of correctness. Defaults to `false`.
 
 Example:
 
@@ -357,8 +361,8 @@ Example:
 
     // <Buffer 03 04 23 42>
 
-### buffer.writeUInt16LE(value, offset, noAssert=false)
-### buffer.writeUInt16BE(value, offset, noAssert=false)
+### buffer.writeUInt16LE(value, offset, [noAssert])
+### buffer.writeUInt16BE(value, offset, [noAssert])
 
 Writes `value` to the buffer at the specified offset with specified endian
 format. Note, `value` must be a valid unsigned 16 bit integer.
@@ -366,7 +370,7 @@ format. Note, `value` must be a valid unsigned 16 bit integer.
 Set `noAssert` to true to skip validation of `value` and `offset`. This means
 that `value` may be too large for the specific function and `offset` may be
 beyond the end of the buffer leading to the values being silently dropped. This
-should not be used unless you are certain of correctness.
+should not be used unless you are certain of correctness. Defaults to `false`.
 
 Example:
 
@@ -384,8 +388,8 @@ Example:
     // <Buffer de ad be ef>
     // <Buffer ad de ef be>
 
-### buffer.writeUInt32LE(value, offset, noAssert=false)
-### buffer.writeUInt32BE(value, offset, noAssert=false)
+### buffer.writeUInt32LE(value, offset, [noAssert])
+### buffer.writeUInt32BE(value, offset, [noAssert])
 
 Writes `value` to the buffer at the specified offset with specified endian
 format. Note, `value` must be a valid unsigned 32 bit integer.
@@ -393,7 +397,7 @@ format. Note, `value` must be a valid unsigned 32 bit integer.
 Set `noAssert` to true to skip validation of `value` and `offset`. This means
 that `value` may be too large for the specific function and `offset` may be
 beyond the end of the buffer leading to the values being silently dropped. This
-should not be used unless you are certain of correctness.
+should not be used unless you are certain of correctness. Defaults to `false`.
 
 Example:
 
@@ -409,7 +413,7 @@ Example:
     // <Buffer fe ed fa ce>
     // <Buffer ce fa ed fe>
 
-### buffer.writeInt8(value, offset, noAssert=false)
+### buffer.writeInt8(value, offset, [noAssert])
 
 Writes `value` to the buffer at the specified offset. Note, `value` must be a
 valid signed 8 bit integer.
@@ -417,13 +421,13 @@ valid signed 8 bit integer.
 Set `noAssert` to true to skip validation of `value` and `offset`. This means
 that `value` may be too large for the specific function and `offset` may be
 beyond the end of the buffer leading to the values being silently dropped. This
-should not be used unless you are certain of correctness.
+should not be used unless you are certain of correctness. Defaults to `false`.
 
 Works as `buffer.writeUInt8`, except value is written out as a two's complement
 signed integer into `buffer`.
 
-### buffer.writeInt16LE(value, offset, noAssert=false)
-### buffer.writeInt16BE(value, offset, noAssert=false)
+### buffer.writeInt16LE(value, offset, [noAssert])
+### buffer.writeInt16BE(value, offset, [noAssert])
 
 Writes `value` to the buffer at the specified offset with specified endian
 format. Note, `value` must be a valid signed 16 bit integer.
@@ -431,13 +435,13 @@ format. Note, `value` must be a valid signed 16 bit integer.
 Set `noAssert` to true to skip validation of `value` and `offset`. This means
 that `value` may be too large for the specific function and `offset` may be
 beyond the end of the buffer leading to the values being silently dropped. This
-should not be used unless you are certain of correctness.
+should not be used unless you are certain of correctness. Defaults to `false`.
 
 Works as `buffer.writeUInt16*`, except value is written out as a two's
 complement signed integer into `buffer`.
 
-### buffer.writeInt32LE(value, offset, noAssert=false)
-### buffer.writeInt32BE(value, offset, noAssert=false)
+### buffer.writeInt32LE(value, offset, [noAssert])
+### buffer.writeInt32BE(value, offset, [noAssert])
 
 Writes `value` to the buffer at the specified offset with specified endian
 format. Note, `value` must be a valid signed 32 bit integer.
@@ -445,13 +449,13 @@ format. Note, `value` must be a valid signed 32 bit integer.
 Set `noAssert` to true to skip validation of `value` and `offset`. This means
 that `value` may be too large for the specific function and `offset` may be
 beyond the end of the buffer leading to the values being silently dropped. This
-should not be used unless you are certain of correctness.
+should not be used unless you are certain of correctness. Defaults to `false`.
 
 Works as `buffer.writeUInt32*`, except value is written out as a two's
 complement signed integer into `buffer`.
 
-### buffer.writeFloatLE(value, offset, noAssert=false)
-### buffer.writeFloatBE(value, offset, noAssert=false)
+### buffer.writeFloatLE(value, offset, [noAssert])
+### buffer.writeFloatBE(value, offset, [noAssert])
 
 Writes `value` to the buffer at the specified offset with specified endian
 format. Note, `value` must be a valid 32 bit float.
@@ -459,7 +463,7 @@ format. Note, `value` must be a valid 32 bit float.
 Set `noAssert` to true to skip validation of `value` and `offset`. This means
 that `value` may be too large for the specific function and `offset` may be
 beyond the end of the buffer leading to the values being silently dropped. This
-should not be used unless you are certain of correctness.
+should not be used unless you are certain of correctness. Defaults to `false`.
 
 Example:
 
@@ -475,8 +479,8 @@ Example:
     // <Buffer 4f 4a fe bb>
     // <Buffer bb fe 4a 4f>
 
-### buffer.writeDoubleLE(value, offset, noAssert=false)
-### buffer.writeDoubleBE(value, offset, noAssert=false)
+### buffer.writeDoubleLE(value, offset, [noAssert])
+### buffer.writeDoubleBE(value, offset, [noAssert])
 
 Writes `value` to the buffer at the specified offset with specified endian
 format. Note, `value` must be a valid 64 bit double.
@@ -484,7 +488,7 @@ format. Note, `value` must be a valid 64 bit double.
 Set `noAssert` to true to skip validation of `value` and `offset`. This means
 that `value` may be too large for the specific function and `offset` may be
 beyond the end of the buffer leading to the values being silently dropped. This
-should not be used unless you are certain of correctness.
+should not be used unless you are certain of correctness. Defaults to `false`.
 
 Example:
 
@@ -500,10 +504,11 @@ Example:
     // <Buffer 43 eb d5 b7 dd f9 5f d7>
     // <Buffer d7 5f f9 dd b7 d5 eb 43>
 
-### buffer.fill(value, offset=0, end=buffer.length)
+### buffer.fill(value, [offset], [end])
 
-Fills the buffer with the specified value. If the offset and end are not
-given it will fill the entire buffer.
+Fills the buffer with the specified value. If the `offset` (defaults to `0`)
+and `end` (defaults to `buffer.length`) are not given it will fill the entire
+buffer.
 
     var b = new Buffer(50);
     b.fill("h");
index 8efcede..d4c990e 100644 (file)
@@ -50,7 +50,7 @@ Example:
     grep.stdin.end();
 
 
-### child_process.spawn(command, args=[], [options])
+### child_process.spawn(command, [args], [options])
 
 Launches a new process with the given `command`, with  command line arguments in `args`.
 If omitted, `args` defaults to an empty Array.
@@ -259,7 +259,7 @@ processes:
 
 
 
-### child.kill(signal='SIGTERM')
+### child.kill([signal])
 
 Send a signal to the child process. If no argument is given, the process will
 be sent `'SIGTERM'`. See `signal(7)` for a list of available signals.
index 6ca68d5..930956f 100644 (file)
@@ -47,16 +47,18 @@ Example: this program that takes the sha1 sum of a file
       console.log(d + '  ' + filename);
     });
 
-### hash.update(data, input_encoding='binary')
+### hash.update(data, [input_encoding])
 
 Updates the hash content with the given `data`, the encoding of which is given
 in `input_encoding` and can be `'utf8'`, `'ascii'` or `'binary'`.
+Defaults to `'binary'`.
 This can be called many times with new data as it is streamed.
 
-### hash.digest(encoding='binary')
+### hash.digest([encoding])
 
 Calculates the digest of all of the passed data to be hashed.
 The `encoding` can be `'hex'`, `'binary'` or `'base64'`.
+Defaults to `'binary'`.
 
 Note: `hash` object can not be used after `digest()` method been called.
 
@@ -73,10 +75,11 @@ Creates and returns a hmac object, a cryptographic hmac with the given algorithm
 Update the hmac content with the given `data`.
 This can be called many times with new data as it is streamed.
 
-### hmac.digest(encoding='binary')
+### hmac.digest([encoding])
 
 Calculates the digest of all of the passed data to the hmac.
 The `encoding` can be `'hex'`, `'binary'` or `'base64'`.
+Defaults to `'binary'`.
 
 Note: `hmac` object can not be used after `digest()` method been called.
 
@@ -99,17 +102,21 @@ Creates and returns a cipher object, with the given algorithm, key and iv.
 algorithm. `iv` is an Initialization vector. `key` and `iv` must be `'binary'`
 encoded string (See the [Buffers](buffers.html) for more information).
 
-### cipher.update(data, input_encoding='binary', output_encoding='binary')
+### cipher.update(data, [input_encoding], [output_encoding])
 
-Updates the cipher with `data`, the encoding of which is given in `input_encoding`
-and can be `'utf8'`, `'ascii'` or `'binary'`. The `output_encoding` specifies
-the output format of the enciphered data, and can be `'binary'`, `'base64'` or `'hex'`.
+Updates the cipher with `data`, the encoding of which is given in
+`input_encoding` and can be `'utf8'`, `'ascii'` or `'binary'`.
+Defaults to `'binary'`.
+
+The `output_encoding` specifies the output format of the enciphered data,
+and can be `'binary'`, `'base64'` or `'hex'`. Defaults to `'binary'`.
 
 Returns the enciphered contents, and can be called many times with new data as it is streamed.
 
-### cipher.final(output_encoding='binary')
+### cipher.final([output_encoding])
 
-Returns any remaining enciphered contents, with `output_encoding` being one of: `'binary'`, `'base64'` or `'hex'`.
+Returns any remaining enciphered contents, with `output_encoding` being one of:
+`'binary'`, `'base64'` or `'hex'`. Defaults to `'binary'`.
 
 Note: `cipher` object can not be used after `final()` method been called.
 
@@ -124,15 +131,19 @@ This is the mirror of the [createCipher()](#crypto.createCipher) above.
 Creates and returns a decipher object, with the given algorithm, key and iv.
 This is the mirror of the [createCipheriv()](#crypto.createCipheriv) above.
 
-### decipher.update(data, input_encoding='binary', output_encoding='binary')
+### decipher.update(data, [input_encoding], [output_encoding])
+
+Updates the decipher with `data`, which is encoded in `'binary'`, `'base64'`
+or `'hex'`. Defaults to `'binary'`.
 
-Updates the decipher with `data`, which is encoded in `'binary'`, `'base64'` or `'hex'`.
-The `output_decoding` specifies in what format to return the deciphered plaintext: `'binary'`, `'ascii'` or `'utf8'`.
+The `output_decoding` specifies in what format to return the deciphered
+plaintext: `'binary'`, `'ascii'` or `'utf8'`. Defaults to `'binary'`.
 
-### decipher.final(output_encoding='binary')
+### decipher.final([output_encoding])
 
 Returns any remaining plaintext which is deciphered,
 with `output_encoding` being one of: `'binary'`, `'ascii'` or `'utf8'`.
+Defaults to `'binary'`.
 
 Note: `decipher` object can not be used after `final()` method been called.
 
@@ -148,12 +159,13 @@ the available signing algorithms. Examples are `'RSA-SHA256'`.
 Updates the signer object with data.
 This can be called many times with new data as it is streamed.
 
-### signer.sign(private_key, output_format='binary')
+### signer.sign(private_key, [output_format])
 
 Calculates the signature on all the updated data passed through the signer.
 `private_key` is a string containing the PEM encoded private key for signing.
 
-Returns the signature in `output_format` which can be `'binary'`, `'hex'` or `'base64'`.
+Returns the signature in `output_format` which can be `'binary'`, `'hex'` or
+`'base64'`. Defaults to `'binary'`.
 
 Note: `signer` object can not be used after `sign()` method been called.
 
@@ -168,13 +180,13 @@ This is the mirror of the signing object above.
 Updates the verifier object with data.
 This can be called many times with new data as it is streamed.
 
-### verifier.verify(object, signature, signature_format='binary')
+### verifier.verify(object, signature, [signature_format])
 
 Verifies the signed data by using the `object` and `signature`. `object` is  a
 string containing a PEM encoded object, which can be one of RSA public key,
 DSA public key, or X.509 certificate. `signature` is the previously calculated
 signature for the data, in the `signature_format` which can be `'binary'`,
-`'hex'` or `'base64'`.
+`'hex'` or `'base64'`. Defaults to `'binary'`.
 
 Returns true or false depending on the validity of the signature for the data and public key.
 
@@ -185,54 +197,57 @@ Note: `verifier` object can not be used after `verify()` method been called.
 Creates a Diffie-Hellman key exchange object and generates a prime of the
 given bit length. The generator used is `2`.
 
-### crypto.createDiffieHellman(prime, encoding='binary')
+### crypto.createDiffieHellman(prime, [encoding])
 
 Creates a Diffie-Hellman key exchange object using the supplied prime. The
 generator used is `2`. Encoding can be `'binary'`, `'hex'`, or `'base64'`.
+Defaults to `'binary'`.
 
-### diffieHellman.generateKeys(encoding='binary')
+### diffieHellman.generateKeys([encoding])
 
 Generates private and public Diffie-Hellman key values, and returns the
 public key in the specified encoding. This key should be transferred to the
 other party. Encoding can be `'binary'`, `'hex'`, or `'base64'`.
+Defaults to `'binary'`.
 
-### diffieHellman.computeSecret(other_public_key, input_encoding='binary', output_encoding=input_encoding)
+### diffieHellman.computeSecret(other_public_key, [input_encoding], [output_encoding])
 
 Computes the shared secret using `other_public_key` as the other party's
 public key and returns the computed shared secret. Supplied key is
 interpreted using specified `input_encoding`, and secret is encoded using
 specified `output_encoding`. Encodings can be `'binary'`, `'hex'`, or
-`'base64'`. If no output encoding is given, the input encoding is used as
-output encoding.
+`'base64'`. The input encoding defaults to `'binary'`.
+If no output encoding is given, the input encoding is used as output encoding.
 
-### diffieHellman.getPrime(encoding='binary')
+### diffieHellman.getPrime([encoding])
 
 Returns the Diffie-Hellman prime in the specified encoding, which can be
-`'binary'`, `'hex'`, or `'base64'`.
+`'binary'`, `'hex'`, or `'base64'`. Defaults to `'binary'`.
 
-### diffieHellman.getGenerator(encoding='binary')
+### diffieHellman.getGenerator([encoding])
 
 Returns the Diffie-Hellman prime in the specified encoding, which can be
-`'binary'`, `'hex'`, or `'base64'`.
+`'binary'`, `'hex'`, or `'base64'`. Defaults to `'binary'`.
 
-### diffieHellman.getPublicKey(encoding='binary')
+### diffieHellman.getPublicKey([encoding])
 
 Returns the Diffie-Hellman public key in the specified encoding, which can
-be `'binary'`, `'hex'`, or `'base64'`.
+be `'binary'`, `'hex'`, or `'base64'`. Defaults to `'binary'`.
 
-### diffieHellman.getPrivateKey(encoding='binary')
+### diffieHellman.getPrivateKey([encoding])
 
 Returns the Diffie-Hellman private key in the specified encoding, which can
-be `'binary'`, `'hex'`, or `'base64'`.
+be `'binary'`, `'hex'`, or `'base64'`. Defaults to `'binary'`.
 
-### diffieHellman.setPublicKey(public_key, encoding='binary')
+### diffieHellman.setPublicKey(public_key, [encoding])
 
 Sets the Diffie-Hellman public key. Key encoding can be `'binary'`, `'hex'`,
-or `'base64'`.
+or `'base64'`. Defaults to `'binary'`.
 
-### diffieHellman.setPrivateKey(public_key, encoding='binary')
+### diffieHellman.setPrivateKey(public_key, [encoding])
 
-Sets the Diffie-Hellman private key. Key encoding can be `'binary'`, `'hex'`, or `'base64'`.
+Sets the Diffie-Hellman private key. Key encoding can be `'binary'`, `'hex'`,
+or `'base64'`. Defaults to `'binary'`.
 
 ### pbkdf2(password, salt, iterations, keylen, callback)
 
index caca9e4..1f54e2d 100644 (file)
@@ -31,10 +31,12 @@ resolves the IP addresses which are returned.
       });
     });
 
-### dns.lookup(domain, family=null, callback)
+### dns.lookup(domain, [family], callback)
 
 Resolves a domain (e.g. `'google.com'`) into the first found A (IPv4) or
 AAAA (IPv6) record.
+The `family` can be the integer `4` or `6`. Defaults to `null` that indicates
+both Ip v4 and v6 address family.
 
 The callback has arguments `(err, address, family)`.  The `address` argument
 is a string representation of a IP v4 or v6 address. The `family` argument
@@ -42,13 +44,13 @@ is either the integer 4 or 6 and denotes the family of `address` (not
 necessarily the value initially passed to `lookup`).
 
 
-### dns.resolve(domain, rrtype='A', callback)
+### dns.resolve(domain, [rrtype], callback)
 
 Resolves a domain (e.g. `'google.com'`) into an array of the record types
-specified by rrtype. Valid rrtypes are `A` (IPV4 addresses), `AAAA` (IPV6
-addresses), `MX` (mail exchange records), `TXT` (text records), `SRV` (SRV
-records), `PTR` (used for reverse IP lookups), `NS` (name server records)
-and `CNAME` (canonical name records).
+specified by rrtype. Valid rrtypes are `'A'` (IPV4 addresses, default),
+`'AAAA'` (IPV6 addresses), `'MX'` (mail exchange records), `'TXT'` (text
+records), `'SRV'` (SRV records), `'PTR'` (used for reverse IP lookups),
+`'NS'` (name server records) and `'CNAME'` (canonical name records).
 
 The callback has arguments `(err, addresses)`.  The type of each item
 in `addresses` is determined by the record type, and described in the
index 445fd59..88d4c28 100644 (file)
@@ -317,10 +317,10 @@ without waiting for the callback. For this scenario,
 Synchronous version of buffer-based `fs.write()`. Returns the number of bytes
 written.
 
-### fs.writeSync(fd, str, position, encoding='utf8')
+### fs.writeSync(fd, str, position, [encoding])
 
-Synchronous version of string-based `fs.write()`. Returns the number of _bytes_
-written.
+Synchronous version of string-based `fs.write()`. `encoding` defaults to
+`'utf8'`. Returns the number of _bytes_ written.
 
 ### fs.read(fd, buffer, offset, length, position, [callback])
 
@@ -370,11 +370,11 @@ If `encoding` is specified then this function returns a string. Otherwise it
 returns a buffer.
 
 
-### fs.writeFile(filename, data, encoding='utf8', [callback])
+### fs.writeFile(filename, data, [encoding], [callback])
 
 Asynchronously writes data to a file, replacing the file if it already exists.
 `data` can be a string or a buffer. The `encoding` argument is ignored if
-`data` is a buffer.
+`data` is a buffer. It defaults to `'utf8'`.
 
 Example:
 
@@ -383,7 +383,7 @@ Example:
       console.log('It\'s saved!');
     });
 
-### fs.writeFileSync(filename, data, encoding='utf8')
+### fs.writeFileSync(filename, data, [encoding])
 
 The synchronous version of `fs.writeFile`.
 
index 27bb398..8dd9935 100644 (file)
@@ -216,7 +216,7 @@ Also `request.httpVersionMajor` is the first integer and
 `request.httpVersionMinor` is the second.
 
 
-### request.setEncoding(encoding=null)
+### request.setEncoding([encoding])
 
 Set the encoding for the request body. Either `'utf8'` or `'binary'`. Defaults
 to `null`, which means that the `'data'` event will emit a `Buffer` object..
@@ -327,7 +327,7 @@ Example:
     response.removeHeader("Content-Encoding");
 
 
-### response.write(chunk, encoding='utf8')
+### response.write(chunk, [encoding])
 
 If this method is called and `response.writeHead()` has not been called, it will
 switch to implicit header mode and flush the implicit headers.
@@ -653,7 +653,7 @@ Emitted when the server sends a '100 Continue' HTTP response, usually because
 the request contained 'Expect: 100-continue'. This is an instruction that
 the client should send the request body.
 
-### request.write(chunk, encoding='utf8')
+### request.write(chunk, [encoding])
 
 Sends a chunk of the body.  By calling this method
 many times, the user can stream a request body to a
@@ -664,8 +664,8 @@ creating the request.
 The `chunk` argument should be an array of integers
 or a string.
 
-The `encoding` argument is optional and only
-applies when `chunk` is a string.
+The `encoding` argument is optional and only applies when `chunk` is a string.
+Defaults to `'utf8'`.
 
 
 ### request.end([data], [encoding])
@@ -674,8 +674,8 @@ Finishes sending the request. If any parts of the body are
 unsent, it will flush them to the stream. If the request is
 chunked, this will send the terminating `'0\r\n\r\n'`.
 
-If `data` is specified, it is equivalent to calling `request.write(data, encoding)`
-followed by `request.end()`.
+If `data` is specified, it is equivalent to calling
+`request.write(data, encoding)` followed by `request.end()`.
 
 ### request.abort()
 
@@ -687,13 +687,13 @@ Once a socket is assigned to this request and is connected
 [socket.setTimeout(timeout, [callback])](net.html#socket.setTimeout)
 will be called.
 
-### request.setNoDelay(noDelay=true)
+### request.setNoDelay([noDelay])
 
 Once a socket is assigned to this request and is connected 
 [socket.setNoDelay(noDelay)](net.html#socket.setNoDelay)
 will be called.
 
-### request.setSocketKeepAlive(enable=false, [initialDelay])
+### request.setSocketKeepAlive([enable], [initialDelay])
 
 Once a socket is assigned to this request and is connected 
 [socket.setKeepAlive(enable, [initialDelay])](net.html#socket.setKeepAlive)
@@ -748,10 +748,11 @@ The response headers object.
 
 The response trailers object. Only populated after the 'end' event.
 
-### response.setEncoding(encoding=null)
+### response.setEncoding([encoding])
 
-Set the encoding for the response body. Either `'utf8'`, `'ascii'`, or `'base64'`.
-Defaults to `null`, which means that the `'data'` event will emit a `Buffer` object..
+Set the encoding for the response body. Either `'utf8'`, `'ascii'`, or
+`'base64'`. Defaults to `null`, which means that the `'data'` event will emit
+a `Buffer` object..
 
 ### response.pause()
 
index 1eb02dd..1e3dfbd 100644 (file)
@@ -269,10 +269,10 @@ Users who experience large or growing `bufferSize` should attempt to
 "throttle" the data flows in their program with `pause()` and `resume()`.
 
 
-#### socket.setEncoding(encoding=null)
+#### socket.setEncoding([encoding])
 
 Sets the encoding (either `'ascii'`, `'utf8'`, or `'base64'`) for data that is
-received.
+received. Defaults to `null`.
 
 #### socket.setSecure()
 
@@ -333,20 +333,23 @@ If `timeout` is 0, then the existing idle timeout is disabled.
 The optional `callback` parameter will be added as a one time listener for the
 `'timeout'` event.
 
-#### socket.setNoDelay(noDelay=true)
+#### socket.setNoDelay([noDelay])
 
 Disables the Nagle algorithm. By default TCP connections use the Nagle
-algorithm, they buffer data before sending it off. Setting `noDelay` will
-immediately fire off data each time `socket.write()` is called.
+algorithm, they buffer data before sending it off. Setting `true` for
+`noDelay` will immediately fire off data each time `socket.write()` is called.
+`noDelay` defaults to `true`.
 
-#### socket.setKeepAlive(enable=false, [initialDelay])
+#### socket.setKeepAlive([enable], [initialDelay])
 
 Enable/disable keep-alive functionality, and optionally set the initial
 delay before the first keepalive probe is sent on an idle socket.
+`enable` defaults to `false`.
+
 Set `initialDelay` (in milliseconds) to set the delay between the last
 data packet received and the first keepalive probe. Setting 0 for
 initialDelay will leave the value unchanged from the default
-(or previous) setting.
+(or previous) setting. Defaults to `0`.
 
 #### socket.address()
 
index 365e975..57a139f 100644 (file)
@@ -172,7 +172,7 @@ Returns the current working directory of the process.
 An object containing the user environment. See environ(7).
 
 
-### process.exit(code=0)
+### process.exit([code])
 
 Ends the process with the specified `code`.  If omitted, exit uses the
 'success' code `0`.
@@ -260,7 +260,7 @@ A compiled-in property that exposes `NODE_PREFIX`.
     console.log('Prefix: ' + process.installPrefix);
 
 
-### process.kill(pid, signal='SIGTERM')
+### process.kill(pid, [signal])
 
 Send a signal to a process. `pid` is the process id and `signal` is the
 string describing the signal to send.  Signal names are strings like
index 81ba1a6..2574180 100644 (file)
@@ -3,10 +3,11 @@
 This module provides utilities for dealing with query strings.
 It provides the following methods:
 
-### querystring.stringify(obj, sep='&', eq='=')
+### querystring.stringify(obj, [sep], [eq])
 
 Serialize an object to a query string.
-Optionally override the default separator and assignment characters.
+Optionally override the default separator (`'&'`) and assignment (`'='`)
+characters.
 
 Example:
 
@@ -18,10 +19,11 @@ Example:
     // returns
     'foo:bar;baz:qux'
 
-### querystring.parse(str, sep='&', eq='=')
+### querystring.parse(str, [sep], [eq])
 
 Deserialize a query string to an object.
-Optionally override the default separator and assignment characters.
+Optionally override the default separator (`'&'`) and assignment (`'='`)
+characters.
 
 Example:
 
index 91181ca..a55835a 100644 (file)
@@ -27,17 +27,18 @@ For example, you could add this to your bashrc file:
     alias node="env NODE_NO_READLINE=1 rlwrap node"
 
 
-### repl.start(prompt='> ', stream=process.stdin, eval=eval, useGlobal=false, ignoreUndefined=false)
+### repl.start([prompt], [stream], [eval], [useGlobal], [ignoreUndefined])
 
 Starts a REPL with `prompt` as the prompt and `stream` for all I/O.  `prompt`
 is optional and defaults to `> `.  `stream` is optional and defaults to
-`process.stdin`. `eval` is optional too and defaults to async wrapper for `eval`.
+`process.stdin`. `eval` is optional too and defaults to async wrapper for
+`eval()`.
 
 If `useGlobal` is set to true, then the repl will use the global object,
-instead of running scripts in a separate context.
+instead of running scripts in a separate context. Defaults to `false`.
 
 If `ignoreUndefined` is set to true, then the repl will not output return value
-of command if it's `undefined`.
+of command if it's `undefined`. Defaults to `false`.
 
 You can use your own `eval` function if it has following signature:
 
index 6637b39..4c35321 100644 (file)
@@ -128,7 +128,7 @@ Emitted when the stream is passed to a readable stream's pipe method.
 A boolean that is `true` by default, but turns `false` after an `'error'`
 occurred or `end()` / `destroy()` was called.
 
-### stream.write(string, encoding='utf8', [fd])
+### stream.write(string, [encoding], [fd])
 
 Writes `string` with the given `encoding` to the stream.  Returns `true` if
 the string has been flushed to the kernel buffer.  Returns `false` to
index 372dae8..a4dbec9 100644 (file)
@@ -45,16 +45,17 @@ string will not be in the parsed object. Examples are shown for the URL
 
 The following methods are provided by the URL module:
 
-### url.parse(urlStr, parseQueryString=false, slashesDenoteHost=false)
+### url.parse(urlStr, [parseQueryString], [slashesDenoteHost])
 
 Take a URL string, and return an object.
 
 Pass `true` as the second argument to also parse
 the query string using the `querystring` module.
+Defaults to `false`.
 
 Pass `true` as the third argument to treat `//foo/bar` as
 `{ host: 'foo', pathname: '/bar' }` rather than
-`{ pathname: '//foo/bar' }`.
+`{ pathname: '//foo/bar' }`. Defaults to `false`.
 
 ### url.format(urlObj)
 
index ee0622a..fefe227 100644 (file)
@@ -50,12 +50,12 @@ Output with timestamp on `stdout`.
     require('util').log('Timestamped message.');
 
 
-### util.inspect(object, showHidden=false, depth=2, colors=false)
+### util.inspect(object, [showHidden], [depth], [colors])
 
 Return a string representation of `object`, which is useful for debugging.
 
 If `showHidden` is `true`, then the object's non-enumerable properties will be
-shown too.
+shown too. Defaults to `false`.
 
 If `depth` is provided, it tells `inspect` how many times to recurse while
 formatting the object. This is useful for inspecting large complicated objects.
@@ -64,6 +64,7 @@ The default is to only recurse twice.  To make it recurse indefinitely, pass
 in `null` for `depth`.
 
 If `colors` is `true`, the output will be styled with ANSI color codes.
+Defaults to `false`.
 
 Example of inspecting all properties of the `util` object: