Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
sunnyswag opened this issue Oct 8, 2024 · 0 comments
Open

Comments

@sunnyswag
Copy link

修改 ./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 的方式去请求,需要提供一下相关实现代码和示例

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant