Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/npm/cli.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/npm.js
diff options
context:
space:
mode:
authorisaacs <i@foohack.com>2009-09-30 03:51:41 +0400
committerisaacs <i@foohack.com>2009-09-30 03:51:41 +0400
commit1b2b6968606c58bc8709a091136788da9b28b926 (patch)
tree7b1fb4ce95be84abdb3a2c3173be6b8ef65a76c5 /npm.js
parent8c72b78c2745a4d746e1a5958da6f3ce466987e6 (diff)
Remove the command line curl in favor of http.cat.
Diffstat (limited to 'npm.js')
-rwxr-xr-xnpm.js18
1 files changed, 4 insertions, 14 deletions
diff --git a/npm.js b/npm.js
index efb23cf18..d03d99b22 100755
--- a/npm.js
+++ b/npm.js
@@ -68,26 +68,16 @@ npm.getSources = function npm_getSources () {
};
npm.refreshSource = function npm_refreshSource (src) {
- // debug("refresh the source: "+src);
-
var p = new node.Promise();
-
- var uri = http.parseUri(src);
-
- // TODO: Replace this nonportable kludge with http.createClient.
- var data = "";
- exec("curl "+src+" > .npm.catalog.tmp").addCallback(function (stdout, stderr) {
- // debug("it worked!" + stdout);
- // now read the file, and parse it.
- node.fs.cat(".npm.catalog.tmp").addCallback(function (data) {
+ http.cat(src)
+ .addErrback(fail(p, "Couldn't load "+src))
+ .addCallback(function (data) {
try {
data = JSON.parse(data);
merge(CATALOG, data);
p.emitSuccess(data);
} catch (ex) { p.emitError(ex); return; }
- }).addErrback(function () { p.emitError() });
- });
-
+ });
return p;
};