-
Notifications
You must be signed in to change notification settings - Fork 1
storage firebase HowTo
GitHub Action edited this page Apr 21, 2026
·
1 revision
This guide demonstrates how to use the Firebase Storage adapter.
Firebase Storage allows generating temporary, signed URLs for private files. Using getUrl() on this adapter can return a signed URL if specified.
import { Storage } from '@quatrain/storage'
async function getPrivateDownloadUrl(filePath: string) {
const storage = Storage.getAdapter('firebase')
// Some adapters can accept an options object to dictate signed URL expiration
const url = await storage.getUrl('my-private-bucket', filePath, {
action: 'read',
expires: '03-09-2491'
})
return url
}You can use the adapter's put method to stream buffers directly to the Firebase bucket.
import fs from 'fs'
import { Storage } from '@quatrain/storage'
async function uploadReport() {
const storage = Storage.getAdapter()
const fileBuffer = fs.readFileSync('/tmp/report.pdf')
await storage.put('reports', '2026/april/report.pdf', fileBuffer, {
contentType: 'application/pdf'
})
}