Day30
質問サービスの画像アップロードを作った。Cloud Storageへ。
async upload(filePath: string) {
const storage = new Storage({ projectId: process.env.GCP_PROJECT_ID })
await storage
.bucket(<string>process.env.STORAGE_BUCKET)
.upload(filePath, {
destination: this.path,
gzip: true,
metadata: {
cacheControl: 'public, max-age=31536000'
}
})
}