-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
HI!
I encountered some strange problem while using multer - sometimes it hangs while uploading the file.
When I am testing this behavior on my Ubuntu it succeeds every time, but when I switch to development server it hangs quite often.
I compared the behavior on both environments and added some basic printouts for troubleshooting:
app.use(multer({
dest: './uploads/',
rename: function (fieldname, filename) {
return filename.replace(/\W+/g, '-').toLowerCase();
},
onFileUploadStart: function (file) {
process.stderr.write('Uploading file..........');
},
onFileUploadComplete: function (file) {
process.stderr.write('done\n');
},
...
}));On development server Uploading file......... is printed in the console but done doesn't show up - which suggests it can be multer or busboy issue.
Full code in which I am using multer can be found here:
https://github.com/aplikacjespoleczne/WizualizacjaBudzetu
Also for troubleshooting I've added the simmilar logging to the multer code (in index.js) :
fileStream.on('data', function(data) {
console.log('Next part received!'); // ADDED
if (data) { file.size += data.length; }
// trigger "file data" event
if (options.onFileUploadData) { options.onFileUploadData(file, data); }
});And the difference between Ubuntu and development server is the last chunk of data. In both environments Next part received! shows up but on development server done doesn't - which may suggest that the 'finish' event is not emitted.
Can it be multer or busboy? Can you give me some advice where to look further? What else could I trace?
Thanks!