Skip to content

ProjectTaskTargetDownload API 下载的 body zip 包内容缺失 #11

@sunnyswag

Description

@sunnyswag

修改 ./src/service/i18nOpenapi/demo.js 的代码, 发起 ProjectTaskTargetDownload 请求:

const { defaultService } = require('../../../lib/services/i18nOpenapi');
const fs = require('fs');

async function main(AccessKeyId, SecretKey, SessionToken) {
  const i18nOpenapiService = defaultService;
  i18nOpenapiService.setAccessKeyId(AccessKeyId);
  i18nOpenapiService.setSecretKey(SecretKey);

  if (SessionToken) {
    // 使用sts请求时 设置SessionToken
    i18nOpenapiService.setSessionToken(SessionToken);
  }

  const result = await i18nOpenapiService.ProjectTaskTargetDownload({
    projectId: xxx,
    taskId: xxxx
  });

  console.log("result:", result);
  fs.writeFileSync("filename.zip", result);
}

解压相关 zip 包文件后显示文件内容缺失

unzip filename.zip                     
Archive:  filename.zip

caution:  zipfile comment truncated
error [filename.zip]:  missing 3232541214 bytes in zipfile
  (attempting to process anyway)
error [filename.zip]:  attempt to seek before beginning of zipfile
  (please check that you have transferred or created the zipfile in the
  appropriate BINARY mode and that you have compiled UnZip properly)

这里看起来需要使用 stream 的方式去请求,需要提供一下相关实现代码和示例

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions