var sys = require('sys'),
http = require('http');
var google = http.createClient(80, 'www.google.com');
- var request = google.request('GET', '/', {'host': 'www.google.com'});
+ var request = google.request('GET', '/',
+ {'host': 'www.google.com'});
request.addListener('response', function (response) {
sys.puts('STATUS: ' + response.statusCode);
sys.puts('HEADERS: ' + JSON.stringify(response.headers));
var a = addresses[i];
dns.reverse(a, function (err, domains) {
if (err) {
- sys.puts('reverse for ' + a + ' failed: ' + err.message);
+ sys.puts('reverse for ' + a + ' failed: ' +
+ err.message);
} else {
- sys.puts('reverse for ' + a + ': ' + JSON.stringify(domains));
+ sys.puts('reverse for ' + a + ': ' +
+ JSON.stringify(domains));
}
});
}
### dns.resolve4(domain, callback)
The same as `dns.resolve()`, but only for IPv4 queries (`A` records).
-`addresses` is an array of IPv4 addresses (e.g. `['74.125.79.104', '74.125.79.105', '74.125.79.106']`).
+`addresses` is an array of IPv4 addresses (e.g.
+`['74.125.79.104', '74.125.79.105', '74.125.79.106']`).
### dns.resolve6(domain, callback)
The same as `dns.resolve()`, but only for service records (`SRV` records).
`addresses` is an array of the SRV records available for `domain`. Properties
-of SRV records are priority, weight, port, and name (e.g., `[{'priority': 10, {'weight': 5, 'port': 21223, 'name': 'service.example.com'}, ...]`).
+of SRV records are priority, weight, port, and name (e.g.,
+`[{'priority': 10, {'weight': 5, 'port': 21223, 'name': 'service.example.com'}, ...]`).
### dns.reverse(ip, callback)
Join all arguments together and resolve the resulting path. Example:
- node> require('path').join('/foo', 'bar', 'baz/asdf', 'quux', '..')
+ node> require('path').join(
+ ... '/foo', 'bar', 'baz/asdf', 'quux', '..')
'/foo/bar/baz/asdf'
### path.normalizeArray(arr)
// repl_test.js
var repl = require("repl"),
- message = "message";
+ msg = "message";
- repl.start().scope.m = message;
+ repl.start().scope.m = msg;
Things in the `scope` object appear as local within the REPL:
The contents of `foo.js`:
- var circle = require('./circle'),
- sys = require('sys');
- sys.puts( 'The area of a circle of radius 4 is '
- + circle.area(4));
+ var circle = require('./circle'),
+ sys = require('sys');
+ sys.puts( 'The area of a circle of radius 4 is '
+ + circle.area(4));
The contents of `circle.js`:
- var PI = 3.14;
+ var PI = 3.14;
- exports.area = function (r) {
- return PI * r * r;
- };
+ exports.area = function (r) {
+ return PI * r * r;
+ };
- exports.circumference = function (r) {
- return 2 * PI * r;
- };
+ exports.circumference = function (r) {
+ return 2 * PI * r;
+ };
The module `circle.js` has exported the functions `area()` and
`circumference()`. To export an object, add to the special `exports`
extern 'C' void init (Handle<Object> target)
For the moment, that is all the documentation on addons. Please see
-<http://github.com/ry/node_postgres[node_postgres]> for a real example.
+<http://github.com/ry/node_postgres> for a real example.