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.

npm install firebase-storage-kit
INSTALL
IMPORT
SIG · FIREBASE-STORAGE-K
F
firebase-storage-kit
storagejavascriptv1.4.0
harness data pending
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.

StorageManager
import { StorageManager } from 'firebase-storage-kit';
const { StorageManager } = require('firebase-storage-kit');
ESM-only; CommonJS require will fail. Use import statement.
useStorageManager
import { useStorageManager } from 'firebase-storage-kit/react';
import { useStorageManager } from 'firebase-storage-kit';
React hooks are exported from the /react subpath. Importing from main entry gives undefined.
useUpload
import { useUpload } from 'firebase-storage-kit/react';
import { useUpload } from 'firebase-storage-kit';
Same as useStorageManager; must use /react subpath.
StorageManager (types)
import { type StorageManager } from 'firebase-storage-kit';
TypeScript users can import the type explicitly; library ships definitions.

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 issues
breakingRequires firebase ^12.13.0. Older versions of firebase are incompatible.
fix
Upgrade firebase to >=12.13.0.
affects: <1.0.0
breakingPackage is ESM-only; CommonJS require() will fail with ERR_REQUIRE_ESM.
fix
Use import syntax or dynamic import().
affects: >=1.0.0
deprecatedReact hooks are exported from 'firebase-storage-kit/react' subpath; importing from main entry is deprecated and will be removed in v2.
fix
Import from 'firebase-storage-kit/react' for React hooks.
affects: >=1.0.0
gotchauseUpload hook expects a handle object from StorageManager.uploadFile; passing an incorrect value will throw runtime error.
fix
Ensure you pass the return value of manager.uploadFile to useUpload.
affects: >=1.0.0
gotchaUpload path must be relative and not start with '/'. Absolute paths or leading slash cause Firebase Storage errors.
fix
Use relative path like 'uploads/file.txt' instead of '/uploads/file.txt'.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'firebase-storage-kit' or its corresponding type declarations.
Package not installed or TypeScript cannot resolve types.
fix
Install the package: npm install firebase-storage-kit. Ensure tsconfig.json includes 'moduleResolution': 'node' or 'bundler'.
Uncaught Error: Firebase Storage instance is required.
StorageManager constructed without a valid Firebase Storage instance.
fix
Pass a storage instance from getStorage(app) to the constructor: new StorageManager(getStorage(app)).
import { useStorageManager } from 'firebase-storage-kit/react' does not work: module not found.
React hooks subpath may not be resolved by bundler (e.g., Vite, Webpack).
fix
Ensure your bundler supports package.json exports field (most modern bundlers do). If using CRA, you may need to upgrade or alias the subpath.
TypeError: handle.on is not a function
Using a handle that is not a valid UploadHandle (e.g., from an older version or wrong return).
fix
Ensure you use the handle returned by manager.uploadFile and that both firebase and firebase-storage-kit are up to date.
Upgrade
Version history
1.4.0latest on npm
Audit
Dependencies
firebaserequiredPeer dependency for Firebase Storage instance
reactoptionalPeer dependency for React hooks
Agent activity
16 hits · last 30 days
node
16
Resources
firebase-storage-kit — npm install firebase-storage-kit · libregistry