Registry / storage / firebase-storage-kit

firebase-storage-kit

JSON →
library1.4.0jsnpmunverified

A TypeScript-first storage management library for Firebase Storage (v1.4.0, updated monthly). Provides a StorageManager class with file upload, download URL generation, progress tracking via events, and batch uploads. Offers React hooks (useStorageManager, useUpload) for state-managed uploads. Differentiates from raw Firebase SDK with event-based progress, simpler batch API, and first-class React integration. Requires firebase ^12.13.0 and react >=18.0.0.

storage
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ESM-only; CommonJS require will fail. Use import statement.

import { StorageManager } from 'firebase-storage-kit';

React hooks are exported from the /react subpath. Importing from main entry gives undefined.

import { useStorageManager } from 'firebase-storage-kit/react';

Same as useStorageManager; must use /react subpath.

import { useUpload } from 'firebase-storage-kit/react';

TypeScript users can import the type explicitly; library ships definitions.

import { type StorageManager } from 'firebase-storage-kit';

Upload a file to Firebase Storage with progress tracking and success/error handlers using StorageManager.

import { initializeApp } from 'firebase/app'; import { getStorage } from 'firebase/storage'; import { StorageManager } from 'firebase-storage-kit'; const firebaseConfig = { /* your config */ }; const app = initializeApp(firebaseConfig); const storage = getStorage(app); const manager = new StorageManager(storage); const file = new File(['content'], 'example.txt', { type: 'text/plain' }); const handle = manager.uploadFile(file, { path: `uploads/${file.name}` }); handle.on('progress', (upload) => { console.log('Progress:', upload.progress); }); handle.on('success', (upload) => { console.log('Download URL:', upload.downloadURL); }); handle.on('error', (err) => { console.error('Upload failed:', err); });
Debug
Known footguns
breakingRequires firebase ^12.13.0. Older versions of firebase are incompatible.
breakingPackage is ESM-only; CommonJS require() will fail with ERR_REQUIRE_ESM.
deprecatedReact hooks are exported from 'firebase-storage-kit/react' subpath; importing from main entry is deprecated and will be removed in v2.
gotchauseUpload hook expects a handle object from StorageManager.uploadFile; passing an incorrect value will throw runtime error.
gotchaUpload path must be relative and not start with '/'. Absolute paths or leading slash cause Firebase Storage errors.
Upgrade
Version history

Breaking-change detection hasn't run for this library yet.

Audit
Security & dependencies

CVE tracking and dependency tree are planned for a later release.

Agent activity
17 hits · last 30 days
gptbot
3
amazonbot
3
bytedance
3
ahrefsbot
1
Resources