i'm generating signed url to upload media files using node script. But, when i check the file at storage, the file metadata is wrong like it was a multipart form data. Print from GCP Storage console demonstrate:
I need the files to be interpreted as media files like the print:
the code that i'm generating signed url:
import { GetSignedUrlConfig, Storage } from '@google-cloud/storage';import { BucketProvider } from '@shared/providers/Bucket.provider';export class CloudStorageProviderImp implements BucketProvider { private storage: Storage; constructor() { this.storage = new Storage({ projectId: process.env.GCP_PROJECT_ID, }); } public async generateUploadSignedUrl( bucketName: string, fileName: string, expireTimeInMinutes: number ): Promise<string> { const options: GetSignedUrlConfig = { version: 'v4', action: 'write', expires: this.formatExpires(expireTimeInMinutes), contentType: 'audio/wav' }; const [url] = await this.storage .bucket(bucketName) .file(fileName) .getSignedUrl(options) return url; } private formatExpires(expireTimeInMinutes: number) { return Date.now() + expireTimeInMinutes * 60 * 1000; }}
The documentation of GCP is poor and until now i haven't found solutions how i can set metadata of my object to be uploaded correctly