Created
February 26, 2020 14:44
-
-
Save remorses/0e86b780f67de5e8edbb6b2302a3a5ed to your computer and use it in GitHub Desktop.
Cloud storage uplaod file and get url
This file contains 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
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