@pikku/backblaze
v0.12.4
Published
Backblaze B2 content service for Pikku
Readme
@pikku/backblaze
Backblaze B2 storage implementation of Pikku's ContentService interface.
Installation
npm install @pikku/backblaze backblaze-b2Usage
import { B2Content } from '@pikku/backblaze'
const content = new B2Content(
{
applicationKeyId: 'your-key-id',
applicationKey: 'your-app-key',
bucketId: 'your-bucket-id',
},
logger
)
// Upload a file
await content.writeFile('path/to/file.txt', stream)
// Read a file
const buffer = await content.readFileAsBuffer('path/to/file.txt')
// Get upload URL with headers for direct client upload
const { uploadUrl, assetKey, uploadHeaders, uploadMethod } =
await content.getUploadURL('file.txt', 'text/plain')