summaryrefslogtreecommitdiff
path: root/.resume/resume.js
diff options
context:
space:
mode:
authorprzemyslawpluta <przemekpluta@hotmail.com>2016-01-07 20:03:05 +0000
committerprzemyslawpluta <przemekpluta@hotmail.com>2016-01-07 20:03:05 +0000
commitdd2cf8bd5e90a01466a5934017e2129aeb2b0f51 (patch)
tree3759a0e9994d86eb301904e1bd93b5d5dac0dc78 /.resume/resume.js
parent617c52ba5f06bcb3f9a5100347253c7969317101 (diff)
downloadmongo-edu-dd2cf8bd5e90a01466a5934017e2129aeb2b0f51.zip
resume downlod
Diffstat (limited to '.resume/resume.js')
-rw-r--r--.resume/resume.js15
1 files changed, 9 insertions, 6 deletions
diff --git a/.resume/resume.js b/.resume/resume.js
index 5d92f51..385e356 100644
--- a/.resume/resume.js
+++ b/.resume/resume.js
@@ -60,9 +60,15 @@ var ytdl = module.exports = function(videoUrl, args, options) {
});
req.on('response', function(res) {
- if (options && options.start > 0 && res.statusCode == 416) {
+
+ var size = parseInt(res.headers['content-length'], 10);
+ if (size) {
+ item.size = size;
+ }
+
+ if (options && options.start > 0 && res.statusCode === 416) {
// the file that is being resumed is complete.
- stream.emit('end');
+ stream.emit('complete', item);
return;
}
@@ -71,11 +77,8 @@ var ytdl = module.exports = function(videoUrl, args, options) {
return;
}
- var size = parseInt(res.headers['content-length'], 10);
- if (size) {
- item.size = size;
- }
stream.emit('info', item);
+
});
stream.resolve(req);
});