summaryrefslogtreecommitdiff
path: root/.resume/resume.js
diff options
context:
space:
mode:
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);
});