module.exports = {
upload: function (req, res) {
req.file('upload').upload(sails.config.skipper, function (err, files) {
if (err) return res.negotiate(err);
res.ok(files)
})
},
download: function (req, res) {
var SkipperAdapter = sails.config.skipper.adapter;
SkipperAdapter(sails.config.skipper).read(req.param('fd'), function (err, file) {
if (err) return res.negotiate(err);
res.send(new Buffer(file))
})
}
}
If you upload a file with a size of 200kb, an error occurs
buffer.js:422
throw new TypeError(kConcatErrMsg);
^
TypeError: "list" argument must be an Array of Buffer or Uint8Array instances
at Function.Buffer.concat (buffer.js:422:11)
at PostgresWritableStream._write (/home/nrp/Документы/nodejs/calls_records/node_modules/skipper-postgresql/dist/PostgresWritableStream.js:60:22)
at doWrite (_stream_writable.js:387:12)
at writeOrBuffer (_stream_writable.js:373:5)
at PostgresWritableStream.Writable.write (_stream_writable.js:290:11)
at Transform.ondata (_stream_readable.js:642:20)
at emitOne (events.js:115:13)
at Transform.emit (events.js:210:7)
at addChunk (_stream_readable.js:266:12)
at readableAddChunk (_stream_readable.js:253:11)
at Transform.Readable.push (_stream_readable.js:211:10)
at Transform.push (_stream_transform.js:147:32)
at /home/nrp/Документы/nodejs/calls_records/node_modules/skipper/standalone/Upstream/build-renamer-stream.js:58:19
at determineBasename (/home/nrp/Документы/nodejs/calls_records/node_modules/skipper/standalone/Upstream/build-renamer-stream.js:47:16)
at Transform.__renamer__._transform (/home/nrp/Документы/nodejs/calls_records/node_modules/skipper/standalone/Upstream/build-renamer-stream.js:49:7)
at Transform._read (_stream_transform.js:186:10)
at Transform._write (_stream_transform.js:174:12)
at doWrite (_stream_writable.js:387:12)
at writeOrBuffer (_stream_writable.js:373:5)
at Transform.Writable.write (_stream_writable.js:290:11)
at Upstream.ondata (_stream_readable.js:642:20)
at emitOne (events.js:115:13)
at Upstream.emit (events.js:210:7)
at Upstream.Readable.read (_stream_readable.js:478:10)
at flow (_stream_readable.js:849:34)
at resume_ (_stream_readable.js:831:3)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickDomainCallback (internal/process/next_tick.js:218:9)
config/http.js
config/skipper.js
api/controllers/FileController.js
If you upload a file with a size of 200kb, an error occurs