我已将上传转换为缓冲区。当我编写此缓冲区时,我会收到路径错误。
typeError:路径必须是字符串或缓冲区
const adapter = require('skipper-better-s3')(options);
var receiver = adapter.receive({dirname: "/original"});
var upstream = req.file('file');
upstream.upload(receiver, function(err, filesUploaded){
adapter.read(filesUploaded[0].extra.fd, (err, image) => {
Jimp.read(image,function(err,image){
image.resize(600, Jimp.AUTO).quality(60).getBuffer(image.getMIME(),function(err,buffer){
const stream = fs.createReadStream(buffer);
receiver = adapter.receive({dirname: "/thumbs"});
receiver.write(file, () => {
console.log(file.extra)
});
});
});
});
});
我认为您的答案在这里:将缓冲区转换为nodejs
中的readableStream另外,请检查您的代码,但是我在这里有错误:
const stream = fs.createReadStream(buffer);
receiver = adapter.receive({dirname: "/thumbs"});
receiver.write(file, () => {
console.log(file.extra)
});
接收者。
,但首先要确保该流是实际创建的,如上面的链接中所述。