-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
Supports for remote modules (Sync/Async).
这个功能实现了吗?
var http = require('http')
, vm = require('vm')
, concat = require('concat-stream')
, async = require('async');
function http_require(url, callback) {
http.get(url, function(res) {
// console.log('fetching: ' + url)
res.setEncoding('utf8');
res.pipe(concat({encoding: 'string'}, function(data) {
callback(null, vm.runInThisContext(data));
}));
})
}
urls = [
'http://example.com/nodejsmodules/myModule1.js',
'http://example.com/nodejsmodules/myModule2.js',
'http://example.com/nodejsmodules/myModule3.js',
]
async.map(urls, http_require, function(err, results) {
// results is an array of values returned by runInThisContext
// the rest of your program logic
});
网上找的nodejs 的代码 nc.js 这种应该怎么做
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels