1
Node.js 서버가 있고 google-cloud 패키지를 사용하여 이미지 파일을 Firebase Storage에 업로드하고 있습니다.Node.js Google 클라우드 저장소 업로드 대상 지정
업로드 자체는 정상적으로 작동하지만 google-cloud API는 Firebase Storage 루트 폴더에만 파일을 업로드 할 수있는 것 같습니다.
이미지를 업로드 할 원격 위치를 지정하는 방법이 있습니까?
내가 지금 무엇을하고 있어요 :
const serviceAccount = require('./serviceAccount.json');
const storage = gcloud.storage({
projectId: '*projectId*',
credentials: serviceAccount
});
const storageBucket = storage.bucket('*bucket*');
storageBucket.upload(localFsPath)
.then(data => /* Some stuff */)
.catch(err => console.log(err));
이런 일을 할 수있는 방법이 있나요?
storageBucket.upload(path, { destination: 'a/b/c/file.jpg' })
.then(data => /* Some stuff */)
.catch(err => console.log(err));
'{destination : newPath} '를 사용해 보셨습니까? 그것은 그것이 어떻게 작동하는지 정확히 알기 때문입니다. [doc] (https://googlecloudplatform.github.io/google-cloud-node/#/docs/google-cloud/0.44.0/storage/bucket?method=upload)을 참조하십시오. –