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/lib
diff options
context:
space:
mode:
authorisaacs <i@izs.me>2010-05-08 22:48:42 +0400
committerisaacs <i@izs.me>2010-05-08 22:48:42 +0400
commitff5fc1344e3740c491eb0de1cceb77c273003de4 (patch)
tree8ca8c18b307ac7aba9f5edc31fa6a74a8c0e8946 /lib
parentee34a4e77cda03455b9ab9ef184f293d5704eb00 (diff)
Buffers are faster than ascii, which is faster than binary.
Diffstat (limited to 'lib')
-rw-r--r--lib/utils/fetch.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/lib/utils/fetch.js b/lib/utils/fetch.js
index 445f3c417..8fea43ede 100644
--- a/lib/utils/fetch.js
+++ b/lib/utils/fetch.js
@@ -48,7 +48,8 @@ function fetchAndWrite (remote, fd, headers, maxRedirects, redirects, cb) {
var https = (remote.protocol === "https:")
http
.createClient(remote.port || (https ? 443 : 80), remote.hostname, https)
- .request("GET", (remote.pathname||"/")+(remote.search||"")+(remote.hash||""), headers)
+ .request("GET",
+ (remote.pathname||"/")+(remote.search||"")+(remote.hash||""), headers)
.addListener("response", function (response) {
// handle redirects.
var loc = get(response.headers, "location")
@@ -78,7 +79,7 @@ function fetchAndWrite (remote, fd, headers, maxRedirects, redirects, cb) {
fs.write(fd, chunk, 0, chunk.length, null
, function (er) { if (er) cb(er) })
} else {
- fs.write(fd, chunk, "binary", null
+ fs.write(fd, chunk, "ascii", null
, function (er) { if (er) cb(er) })
}
})