Created
May 13, 2019 01:20
-
-
Save matthewharwood/3f2bee82e64999bfd4487e1c1a27ba1c to your computer and use it in GitHub Desktop.
Small script to allow to add files to a gcp bucket
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const admin = require("firebase-admin"); | |
const globby = require('globby'); | |
const serviceAccount = require("../../cert.json"); | |
admin.initializeApp({ | |
credential: admin.credential.cert(serviceAccount), | |
storageBucket: "" // e.g. genesis-morningharwood.appspot.com | |
}); | |
var bucket = admin.storage().bucket(); | |
(async () => { | |
const paths = await globby(['../../www/mh/build'], { | |
expandDirectories: { | |
extensions: ['png', 'jpg', 'gif'] | |
} | |
}); | |
paths.forEach(p => bucket.upload(p)); | |
console.log('ALL FINISHED'); | |
})(); |
Author
matthewharwood
commented
May 13, 2019
•
- https://docs.imgix.com/setup/creating-sources/google-cloud-storage
- https://dashboard.imgix.com/
- https://cloud.google.com/nodejs/docs/reference/storage/2.5.x/Bucket#upload
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment