0

当我尝试上传大于 700-800 MB 的文件时遇到此错误(节点:10892) UnhandledPromiseRejectionWarning:SlowDown:降低您的请求率。我已将服务器配置为接受大于 1 GB 的文件

    await server.route({
      method: "POST",
      path: "/api/v1/uploads",
      config: {
        payload: {
          output: 'file',
          parse: true,
          maxBytes: 2000000000,
        },
      },
      handler: controller.create,
    });

  const create = async (response, h) => {
    try {
      ...
         const data = new Promise((resolve, reject) => {
        fs.readFile(filePath, (err, file_buffer) => {
        
        if (err) throw err;

        const params = {
          Bucket: process.env.BUCKET,
          Key: key,
          Body: file_buffer,
          ACL: "public-read",
        };

        s3.putObject(params, function (err, data) {
          if (err) reject(err);
          resolve(key);
        });
      });
    });
    ....
    } catch (exp) {
      ....
    }

  }

4

0 回答 0