This repository was archived by the owner on Apr 12, 2024. It is now read-only.
File tree 2 files changed +5
-4
lines changed
scripts/code.angularjs.org-firebase/functions
2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change 1
1
'use strict' ;
2
2
3
3
const functions = require ( 'firebase-functions' ) ;
4
- const gcs = require ( '@google-cloud/storage' ) ( ) ;
4
+ const { Storage } = require ( '@google-cloud/storage' ) ;
5
5
const path = require ( 'path' ) ;
6
6
7
+ const storage = new Storage ( ) ;
7
8
const gcsBucketId = `${ process . env . GCLOUD_PROJECT } .appspot.com` ;
8
9
9
10
const BROWSER_CACHE_DURATION = 60 * 10 ;
@@ -23,7 +24,7 @@ function sendStoredFile(request, response) {
23
24
const version = filePathSegments [ 0 ] ;
24
25
const isDocsPath = filePathSegments [ 1 ] === 'docs' ;
25
26
const lastSegment = filePathSegments [ filePathSegments . length - 1 ] ;
26
- const bucket = gcs . bucket ( gcsBucketId ) ;
27
+ const bucket = storage . bucket ( gcsBucketId ) ;
27
28
28
29
let downloadSource ;
29
30
let fileName ;
@@ -204,7 +205,7 @@ function deleteOldSnapshotZip(object, context) {
204
205
const filePath = object . name ;
205
206
const contentType = object . contentType ;
206
207
207
- const bucket = gcs . bucket ( bucketId ) ;
208
+ const bucket = storage . bucket ( bucketId ) ;
208
209
209
210
const snapshotFolderMatch = filePath . match ( snapshotRegex ) ;
210
211
Original file line number Diff line number Diff line change 2
2
"name" : " functions-firebase-code.angularjs.org" ,
3
3
"description" : " Cloud Functions to serve files from gcs to code.angularjs.org" ,
4
4
"engines" : {
5
- "node" : " 8 "
5
+ "node" : " 10 "
6
6
},
7
7
"dependencies" : {
8
8
"@google-cloud/storage" : " ^4.7.0" ,
You can’t perform that action at this time.
0 commit comments