Sails startDownload无法正常工作-TypeError:sails.startDownload不是函数

时间:2019-04-17 14:52:11

标签: node.js sails.js

我正在关注https://sailsjs.com/documentation/reference/response-res/res-attachment

我的代码如下:

let file = require('path').resolve(document.path)
if (fs.existsSync(file)) {
  this.res.attachment(document.name)
  let downloading = await sails.startDownload(document.fsPath)
  return exits.success(downloading)
}

退出:

  exits: {
    success: {
      statusCode: 200,
      description: 'Document has been sent for download.'
    },
  }

我遇到错误 TypeError: sails.startDownload is not a function

风帆版本1.1.0

1 个答案:

答案 0 :(得分:1)

您是否已按照链接到的sails-hook-uploads中的说明安装了documentation