File Download Sails.js returns an array of empty files when a large file is loaded in a multi-user download format

I have a multi-part form in my Sails.js project that presents two different files (first audio , then image ) along with some text parameters. In most cases, everything works fine with small files. But when I tried the larger audio file (33 MB), I had an empty file array for my image field in the receiver. Here is the code.

Controller:

var uploadParamNames = ['audio', 'image'];

async.map(uploadParamNames, 
    function (file, cb) {

       sails.log(req.file(file)._files)
       req.file(file).upload(
       {
           adapter:     require('skipper-gridfs'),
           uri:         sails.config.connections.mongoConnection.url + '.' + file           
       }, 
       function (err, files) {
           // save the file, and then:
           return cb(err, files);
    });

}, function doneUploading(err, files) {
...
});

I mainly get the following logs for audio and image:

[ { stream: [Object], status: 'bufferingOrWriting' } ]
[]

I tried debugging and found that in the case of the image field, it never reached the line where the file is actually written in the line prototype.onFile.js up.writeFile(part);.

:

Parser: Read a chunk of textparam through field `_csrf`
Parser: Read a chunk of textparam through field `ss-name`
Parser: Read a chunk of textparam through field `ss-desc`
Parser: Read a chunk of textparam through field `ss-category`
Parser: Read a chunk of textparam through field `ss-language`
Parser: Read a chunk of textparam through field `ss-place`
Parser: Read a chunk of textparam through field `ss-place-lat`
Parser: Read a chunk of textparam through field `ss-place-lon`
Acquiring new Upstream for field `audio`
Tue, 13 Oct 2015 10:52:54 GMT skipper Set up "maxTimeToWaitForFirstFile" timer for 10000ms
Tue, 13 Oct 2015 10:52:58 GMT skipper passed control to app because first file was received
Tue, 13 Oct 2015 10:52:58 GMT skipper waiting for any text params
Upstream: Pumping incoming file through field `audio`
Parser: Done reading textparam through field `_csrf`
Parser: Done reading textparam through field `ss-name`
Parser: Done reading textparam through field `ss-desc`
Parser: Done reading textparam through field `ss-category`
Parser: Done reading textparam through field `ss-language`
Parser: Done reading textparam through field `ss-tags`
Parser: Done reading textparam through field `ss-place`
Parser: Done reading textparam through field `ss-place-lat`
Parser: Done reading textparam through field `ss-place-lon`
Tue, 13 Oct 2015 10:53:11 GMT skipper Something is trying to read from Upstream `audio`...
Tue, 13 Oct 2015 10:53:11 GMT skipper Passing control to app...
Tue, 13 Oct 2015 10:53:16 GMT skipper maxTimeToWaitForFirstFile timer fired- as of now there are 1 file uploads pending (so it fine)
debug: [ { stream: [Object], status: 'bufferingOrWriting' } ]
Tue, 13 Oct 2015 10:53:41 GMT skipper .upload() called on upstream
Acquiring new Upstream for field `image`
Tue, 13 Oct 2015 10:53:46 GMT skipper Set up "maxTimeToWaitForFirstFile" timer for 10000ms
debug: []

, , , , . , . ?

EDIT: , receivedFirstFileOfRequest , . , , ?

EDIT: ... . 29KB , 320KB ...

+4

Source: https://habr.com/ru/post/1611408/


All Articles