Stream.pause在将file upload到azure色时不是函数

我声明我的multerconfiguration如下:

 const storage = multer.memoryStorage() const upload = multer({ limits: { fileSize: 1000 * 1000 * 10 // 10 Megabytes }, storage: storage }); 

然后在我的快车路线:

 ...//On api.post() {} console.log(file); ... 

这输出文件,一个缓冲区,这是伟大的! 但是,当我打电话给:

createBlockBlobFromStream(containerName, fileName, file, size)

我得到错误streamstream.pause is not a function上传开始时由azure-storage调用stream.pause is not a function ,因为sdk想要在Azure云blob服务继续之前等待获得200 ,这是有道理的。

但是,它不认为我通过的文件有属性pause()

任何人都遇到过这个? 我在某处读到,由multer创build的stream不是正确的共振峰,我需要将它包裹在streamifier或其他包中。

问题是缓冲区不符合stream 。 最好看看麂皮储存更容易。
例如

 var multer = require('multer') var MulterAzureStorage = require('multer-azure-storage') var upload = multer({ storage: new MulterAzureStorage({ azureStorageConnectionString: 'https://mystorageaccount.blob.core.windows.net/', azureStorageAccessKey: 'myaccesskey', azureStorageAccount: 'mystorageaccount', containerName: 'photos', containerSecurity: 'blob' }) }) 
Interesting Posts