Skip to content

Commit

Permalink
Fix type
Browse files Browse the repository at this point in the history
  • Loading branch information
abraham committed Sep 4, 2023
1 parent 7fa2e5a commit e4ec26a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions functions/src/optimize-images.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Storage } from '@google-cloud/storage';
import { Storage, UploadOptions } from '@google-cloud/storage';
import { spawnSync } from 'child_process';
import * as functions from 'firebase-functions';
import { storage } from 'firebase-functions';
Expand Down Expand Up @@ -55,14 +55,15 @@ async function optimizeImage(object) {

// Uploading the Optimized image.
const destination = bucket.file(filePath);
const [newFile] = await bucket.upload(tempLocalFile, {
const options: UploadOptions = {
destination,
metadata: {
metadata: {
optimized: true,
optimized: 'true',
},
},
});
};
const [newFile] = await bucket.upload(tempLocalFile, options);
await newFile.makePublic();
functions.logger.log('Optimized image uploaded to Storage');
// Once the image has been uploaded delete the local files to free up disk space.
Expand Down

0 comments on commit e4ec26a

Please sign in to comment.