I would like to store json file in google storage. To save storage and network bandwidth, the file is compressed in gzip format and upload to my bucket, and set Caches-Control: no-transform to prevent Transcoding. The problem is the file stored in google storage is in decompressed format (json), and the Cache-Control in object metadata is empty. My code:
const admin = await import("firebase-admin");
const bucket = admin.storage().bucket();
const file = bucket.file(path);
await file.save(JSON.stringify(jsonArray),
{'gzip': true, 'contentType':'application/json',
'metadata': {
'Cache-Control': 'no-transform'}})
The object metadata: Content-Encoding: gzip, Content-Type: application/json. File size in google storage: 10.8kb. I manually set Cache-Control: no-transform, and use postmant & Firebase_storage plugin for flutter to download content, and I always receives content in text format – What am I missing here?