Skip to content

Instantly share code, notes, and snippets.

@remorses
Created February 26, 2020 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save remorses/0e86b780f67de5e8edbb6b2302a3a5ed to your computer and use it in GitHub Desktop.
Save remorses/0e86b780f67de5e8edbb6b2302a3a5ed to your computer and use it in GitHub Desktop.
Cloud storage uplaod file and get url
import admin from 'firebase-admin'
const file = admin
.storage()
.bucket('')
.file('name.txt')
await file.save('dsfgsdf', {
gzip: true,
public: true,
contentType: 'image',
})
const meta = await file.getMetadata()
const url = meta[0]?.mediaLink
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment