add metadata to google storage

This commit is contained in:
Quan HL
2023-07-28 17:54:47 +07:00
parent a507f67fbc
commit e173c12d43
+3 -1
View File
@@ -9,7 +9,9 @@ class GoogleStorageUploadStream extends Writable {
const storage = new Storage(opts.bucketCredential);
this.gcsFile = storage.bucket(opts.bucketName).file(opts.Key);
this.writeStream = this.gcsFile.createWriteStream();
this.writeStream = this.gcsFile.createWriteStream({
metadata: opts.metadata
});
this.writeStream.on('error', (err) => console.error(err));
this.writeStream.on('finish', () => console.log('Upload completed.'));