Finish/End event never fired
See original GitHub issueI’m trying to setup a Resumable.js NodeJS backend with latest Express (v4).
Whatever I upload I never get either the end
or finish
event.
var busboy = new Busboy({headers: req.headers});
var query = {};
busboy.on('field', function(fieldname, val, fieldnameTruncated, valTruncated) {
if(fieldname) query[fieldname] = val;
});
busboy.on('file', function(fieldname, file, filename, encoding, mimetype) {
log.info('Writing chunk-%d/%d of file "%s" from GridFS', query.resumableChunkNumber, query.resumableTotalChunks, query.resumableFilename); // Called
// var saveTo = path.join(os.tmpDir(), path.basename(fieldname));
// file.pipe(fs.createWriteStream(saveTo));
});
busboy._parser.parser.on('finish', function() {
d('Done parsing form!'); // Never called
});
busboy.on('finish', function() {
d('Done parsing form!'); // Never called
});
busboy.once('end', function() {
d('Done parsing form!'); // Never called
});
busboy.on('error', function(err) {
d('err', err);
});
req.pipe(busboy);
Also if I try to res.send(200)
on file, somehow it breaks resumable, the behavior is not the same that if I directly res.send(200), even if I have only one file
.
Headers
Request URL:http://server-78b0.local:3000/upload
Request Headers
Provisional headers are shown
Accept:application/json, text/plain, */*
Authorization:Bearer eyJ0eTAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJlbWFpbCI6IndhdGNoc2xhdGVAcmljaGVtb250LWNvdWNvdS5jb20iLCJmaXJzdE5hbWUiOiJXYXRjaHNsYXRlIiwibGFzdE5hbWUiOiJBcHBsaWNhdGlvbiIsInBhc3N3b3JkIjoiJDJhJDEwJHJpQXJVMHlQbDZ0MUtwUnFLZ1djbHVVVkxlODdPS2lQbjVTc2VzNzMwS21kTDZYb2JKN2pXIiwiX2lkIjoiNTNjZDFmNTlmMDAxNTIyZDA0MGI1ZWU4IiwiX192IjowfQ.0aQYQNGO2ud7DtjH5ssG_M85i53MakClhBVUQv9AEP0
Content-Type:multipart/form-data; boundary=----WebKitFormBoundaryKAbkqHZYocMBQFF4
Origin:http://localhost:9000
Referer:http://localhost:9000/
User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1985.125 Safari/537.36
Request Payload
------WebKitFormBoundaryKAbkqHZYocMBQFF4
Content-Disposition: form-data; name="resumableChunkNumber"
1
------WebKitFormBoundaryKAbkqHZYocMBQFF4
Content-Disposition: form-data; name="resumableChunkSize"
1048576
------WebKitFormBoundaryKAbkqHZYocMBQFF4
Content-Disposition: form-data; name="resumableCurrentChunkSize"
1048576
------WebKitFormBoundaryKAbkqHZYocMBQFF4
Content-Disposition: form-data; name="resumableTotalSize"
32156861
------WebKitFormBoundaryKAbkqHZYocMBQFF4
Content-Disposition: form-data; name="resumableType"
------WebKitFormBoundaryKAbkqHZYocMBQFF4
Content-Disposition: form-data; name="resumableIdentifier"
32156861-testipa
------WebKitFormBoundaryKAbkqHZYocMBQFF4
Content-Disposition: form-data; name="resumableFilename"
test.ipa
------WebKitFormBoundaryKAbkqHZYocMBQFF4
Content-Disposition: form-data; name="resumableRelativePath"
test.ipa
------WebKitFormBoundaryKAbkqHZYocMBQFF4
Content-Disposition: form-data; name="resumableTotalChunks"
30
------WebKitFormBoundaryKAbkqHZYocMBQFF4
Content-Disposition: form-data; name="file"; filename="blob"
Content-Type: application/octet-stream
------WebKitFormBoundaryKAbkqHZYocMBQFF4--
Issue Analytics
- State:
- Created 9 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Video event listener waiting for 'ended' not firing - Stack Overflow
You have a loop attribute on the first video. This means it never technically ends, and will just continue playing from the beginning....
Read more >finish event never fired · Issue #185 · katspaugh/wavesurfer.js
This keeps firing after it has finished playing. See the demo in wavesurfer.fm - see the 'finished playing' duplicates keep going. When I...
Read more >How to ensure an event listener is only fired once in JavaScript
In this case, the event listener bound to the button to give us permission to view the file should only be fired once...
Read more >Window: load event - Web APIs - MDN Web Docs - Mozilla
The load event is fired when the whole page has loaded, including all dependent resources such as stylesheets, scripts, iframes, and images.
Read more >Events | Maps JavaScript API - Google Developers
MVC events, for example, do not pass arguments within their event. ... When a shape is edited or dragged, an event is fired...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This is flow control doing its duty. For files you need to do something with the
file
stream, even if it’s just ignoring the data withfile.resume();
Indeed
file.resume()
properly fixes it. Now stuck onMongoError: exception: chunks out of order
, but that’s another story 😉. Thanks!