diff options
author | isaacs <i@izs.me> | 2010-05-27 07:09:12 +0400 |
---|---|---|
committer | isaacs <i@izs.me> | 2010-05-27 07:09:12 +0400 |
commit | 2583c9ed50462895c6ee1af0890423db8a7eb352 (patch) | |
tree | 7e9462faadced0257f118c37501602ca2dc65f90 | |
parent | d456cafe34e9bc8e33e0a9a188f100f7b8a162b6 (diff) |
Bug in fetch
-rw-r--r-- | lib/utils/fetch.js | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/utils/fetch.js b/lib/utils/fetch.js index 2e66a56a6..876a3cace 100644 --- a/lib/utils/fetch.js +++ b/lib/utils/fetch.js @@ -64,7 +64,7 @@ function fetchAndWrite (remote, fd, headers, maxRedirects, redirects, cb) { var written = 0 , len = response.headers["content-length"] , pct = 0 - , prevPct = 0 + , lastPct = 0 log(len || "unknown", "content-length") response.addListener("data", function (chunk) { // write the chunk... @@ -73,8 +73,8 @@ function fetchAndWrite (remote, fd, headers, maxRedirects, redirects, cb) { pct = written / len * 100 if (lastPct === 0 || (pct - lastPct > 10)) { log(Math.round(pct)+"%", "downloaded") + lastPct = pct } - lastPct = pct } try { fs.writeSync(fd, chunk, 0, chunk.length, null) |