我正在尝试使用 NodeJS 应用程序将文件从 s3 存储桶发送到客户端。这是我到目前为止所拥有的:
import { S3 } from '@aws-sdk/client-s3';
const BUCKET_NAME = process.env.S3_BUCKET_NAME;
const s3 = new S3({
region: 'ap-southeast-2',
httpOptions: {
connectTimeout: 2 * 1000,
timeout: 60 * 1000,
},
});
router.get('/download/:id', async (req, res) => {
console.log('api: GET /download/:id');
console.log('req.params.id: ', req.params.id);
const result = await getRequiredInfo(req.params.id);
if (typeof result !== 'number') {
res.attachment(result.filename);
await s3
.getObject({
Bucket: BUCKET_NAME,
Key: result.location,
})
.createReadStream()
.pipe(res);
} else {
res.sendStatus(result);
}
});
Run Code Online (Sandbox Code Playgroud)
当我运行这段代码时,我收到以下信息:
(node:11224) UnhandledPromiseRejectionWarning: TypeError: s3.getObject(...).createReadStream is …Run Code Online (Sandbox Code Playgroud) 我想将 APNS 证书的 .p12 文件发送到 One Signal API,但我需要首先将 .p12 文件转换为 base64 字符串。我怎么做?API 文档如下: https: //documentation.onesignal.com/reference#create-an-app
现在我正在尝试这个API(只是从项目中随机选择一个id)
https://gitlab.com/api/v4/projects/3199253/repository/contributors
Run Code Online (Sandbox Code Playgroud)
我发现提交数始终为 1,而贡献者页面上的提交数则大于 1。同时,名单尚未完成,很多人不在返回结果中。
我检查了文档,似乎我不需要对其进行分页,或者我可以选择这样做。
https://docs.gitlab.com/ee/api/repositories.html#contributors
如果有更好的方法来统计用户在 GitLab 上的所有提交,请告诉我。提前致谢!
更新:刚刚在 Gitlab 上发现了一个相关问题:
https://gitlab.com/gitlab-org/gitlab/-/issues/233119
看起来由于目前的错误,提交计数将始终为 1?
更新:现在我正在扫描提交列表,并使用 for 循环将它们与当前用户进行匹配(他们说它比 map() 具有更好的性能)。猜测这会消耗不必要的 API 调用使用量。
目前,我直接在 Xcode 和 Fastlane 中使用相同的构建过程。但是,虽然它在 Xcode 中工作得很好(构建和归档都工作得很好),但在 Fastlane 中它会抛出一个错误并告诉我ARCHIVE FAILED。看起来 Fastlane 正在尝试查找 iOS 应用程序开发配置文件,而我认为它只找到应用程序分发配置文件。有没有办法解决这个问题,比如我可以使用命令行(没有 Fastlane)构建应用程序并使用 Fastlane 部署.ipa我创建的文件?
Fastlane 日志中显示的错误:
\n+--------------------------------------+-----------------------------------------------------------+\n| Summary for gym 2.208.0 |\n+--------------------------------------+-----------------------------------------------------------+\n| workspace | ./platforms/ios/myproject.xcworkspace |\n| configuration | Release |\n| scheme | myproject |\n| output_directory | . |\n| output_name | output |\n| clean | true |\n| export_method | app-store |\n| skip_profile_detection | false |\n| destination | generic/platform=iOS |\n| silent | false |\n| skip_package_ipa | false |\n| skip_package_pkg | false |\n| build_path …Run Code Online (Sandbox Code Playgroud) 在我的一个组件中,我需要以下两项:
import Image from 'next/image';(来自NextJS)
Image()(来自 TypeScript)
而这两者是相互冲突的。
是否可以为 指定不同的名称next/image?我试过
import Image as image from 'next/image';
和
import {Image as image} from 'next/image';
但他们没有工作。
目前,我面临验证地理权限的问题。我已检查相关文档并联系了我的管理员,他可以确认新西兰的所有验证地理权限均已检查为在面板上可用(短信和语音通道)。谁能告诉我出现此错误消息的其他原因是什么?