Skip to content

Instantly share code, notes, and snippets.

@mashihua
Created August 25, 2011 05:59
Show Gist options
  • Save mashihua/1170079 to your computer and use it in GitHub Desktop.
Save mashihua/1170079 to your computer and use it in GitHub Desktop.
All built-in function and javascript source in Node.js
#!/usr/bin/env node
//all built-in module and lib/*.js,expcept node.js
['constants','io_watcher','timer','buffer','cares','child_process','evals','fs','net','http_parser','signal_watcher','stdio','os'].forEach(function(v){
console.log('built-in module:\t' + v);
console.dir(require('sys').inspect(process.binding(v)));
});
console.log('all javascript from built-in module natives,expect node.js');
var sources = process.binding('natives');
Object.keys(sources).forEach(function(key){
console.log('\n\n**************************************************')
console.log('Source of lib/' + key + '.js');
console.log('**************************************************\n\n')
console.log(sources[key]);
});
Copy link

ghost commented Sep 23, 2015

Please explain above code and what it does ?
I want to get all built-in functions in node js using terminal cmd, so plz help me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment