#!/usr/bin/env node var request = require('request') , fs = require('fs') , uvheadloc = 'https://raw.github.com/joyent/libuv/master/include/uv.h' , defreg = /^\s*XX\(\s*([\-\d]+),\s*([A-Z]+),\s*"([^"]*)"\s*\)\s*\\?$/ request(uvheadloc, function (err, response) { if (err) throw err var data, out data = response.body .split('\n') .map(function (line) { return line.match(defreg) }) .filter(function (match) { return match }) .map(function (match) { return { errno: parseInt(match[1], 10) , code: match[2] , description: match[3] }}) out = 'var all = module.exports.all = ' + JSON.stringify(data, 0, 1) + '\n\n' out += '\nmodule.exports.errno = {\n ' + data.map(function (e, i) { return '\'' + e.errno + '\': all[' + i + ']' }).join('\n , ') + '\n}\n\n' out += '\nmodule.exports.code = {\n ' + data.map(function (e, i) { return '\'' + e.code + '\': all[' + i + ']' }).join('\n , ') + '\n}\n\n' out += '\nmodule.exports.custom = require("./custom")(module.exports)\n' fs.writeFile('errno.js', out) })
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
.travis.yml | File | 77 B | 0644 |
|
README.md | File | 4.59 KB | 0644 |
|
build.js | File | 1.11 KB | 0755 |
|
cli.js | File | 440 B | 0755 |
|
custom.js | File | 1.62 KB | 0644 |
|
errno.js | File | 5.48 KB | 0644 |
|
package.json | File | 1.5 KB | 0644 |
|
test.js | File | 2.58 KB | 0644 |
|