使用Sails.js上载可选文件

使用Sails.js上载可选文件,sails.js,sails-skipper,Sails.js,Sails Skipper,有没有可能让Sails接受可选的文件上载,而不在请求几秒钟后吐出以下堆栈跟踪 Upstream (file upload: `image`) emitted an error: { Error: EMAXBUFFER: An upstream (`NOOP_image`) timed out before it was plugged into a receiver. It was still unused after waiting 4500ms. You can configure this

有没有可能让Sails接受可选的文件上载,而不在请求几秒钟后吐出以下堆栈跟踪

Upstream (file upload: `image`) emitted an error: { Error: EMAXBUFFER: An upstream (`NOOP_image`) timed out before it was plugged into a receiver. It was still unused after waiting 4500ms. You can configure this timeout by changing the `maxTimeToBuffer` option.

Note that this error might be occurring due to an earlier file upload that is finally timing out after an unrelated server error.
    at Timeout.<anonymous> (/home/jarrod/workspace/cuckold/Cuckold-API/node_modules/skipper/lib/private/Upstream/Upstream.js:86:15)
    at ontimeout (timers.js:498:11)
    at tryOnTimeout (timers.js:323:5)
    at Timer.listOnTimeout (timers.js:290:5)
  code: 'EMAXBUFFER',
  message: 'EMAXBUFFER: An upstream (`NOOP_image`) timed out before it was plugged into a receiver. It was still unused after waiting 4500ms. You can configure this timeout by changing the `maxTimeToBuffer` option.\n\nNote that this error might be occurring due to an earlier file upload that is finally timing out after an unrelated server error.' }

如果HTTP请求中没有上传,那么uploadedFiles是一个空数组,其余的操作代码运行时没有问题,但我不希望日志中充满这种垃圾。

事实证明,这很简单,只需从npm中引入模块,并用类似的内容替换原始问题中的Promise wrapped cruft

let uploadedFiles=wait sails.upload(inputs.image,{/*自定义适配器配置*/});
看起来工作正常,但如果请求中未提供任何内容,则不会记录上载未被及时拦截的警告


通过定量配给示例应用程序得出了这个解决方案。

事实证明它非常简单,只需从npm中引入模块,并用类似的内容替换原始问题中的承诺包装的cruft

let uploadedFiles=wait sails.upload(inputs.image,{/*自定义适配器配置*/});
看起来工作正常,但如果请求中未提供任何内容,则不会记录上载未被及时拦截的警告

通过定量配给示例应用程序导致此解决方案