Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Download file from storage
- app.get('/getDataFromStorageFile', (req, res) => {
- console.log(req.query.uid)
- return admin.storage().bucket()
- .file(`/development/resumes/123.html`).download()
- .then(data => {
- // This renders the content as html if it was stored as html
- return res.send(data[0].toString())
- })
- .catch(e => {
- return res.json({
- status: 'failed: ' + e.message
- })
- })
- })
- // Download file from storage
- app.post('/uploadDataToStorage', (req, res) => {
- return admin.storage().bucket()
- .file('/development/resumes/resume').save(req.params.body)
- .then(() => {
- return res.json({status: 'success'})
- })
- .catch(e => {
- return res.json({status: 'failed: ' + e.message})
- })
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement