You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
475 B
22 lines
475 B
1 month ago
|
var concat = require('concat-stream')
|
||
|
|
||
|
function MemoryStorage (opts) {}
|
||
|
|
||
|
MemoryStorage.prototype._handleFile = function _handleFile (req, file, cb) {
|
||
|
file.stream.pipe(concat({ encoding: 'buffer' }, function (data) {
|
||
|
cb(null, {
|
||
|
buffer: data,
|
||
|
size: data.length
|
||
|
})
|
||
|
}))
|
||
|
}
|
||
|
|
||
|
MemoryStorage.prototype._removeFile = function _removeFile (req, file, cb) {
|
||
|
delete file.buffer
|
||
|
cb(null)
|
||
|
}
|
||
|
|
||
|
module.exports = function (opts) {
|
||
|
return new MemoryStorage(opts)
|
||
|
}
|