firebase-storage-kit 1.3.0 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -2,21 +2,15 @@
2
2
 
3
3
  Storage manager for Firebase Storage with uploads, progress tracking, batch uploads, and file query helpers.
4
4
 
5
- ## Install
5
+ **Full documentation:** [firebase-storage-kit.vercel.app/docs](https://firebase-storage-kit.vercel.app/docs)
6
6
 
7
- With npm:
7
+ ## Install
8
8
 
9
9
  ```bash
10
- npm install firebase-storage-kit
10
+ npm install firebase firebase-storage-kit
11
11
  ```
12
12
 
13
- Or with Yarn, pnpm, or Bun:
14
-
15
- ```bash
16
- yarn add firebase-storage-kit
17
- pnpm add firebase-storage-kit
18
- bun add firebase-storage-kit
19
- ```
13
+ Also works with Yarn, pnpm, or Bun. See [Installation](https://firebase-storage-kit.vercel.app/docs/getting-started/installation) for all package managers.
20
14
 
21
15
  ## Quick start
22
16
 
@@ -38,84 +32,24 @@ handle.on("success", (upload) => {
38
32
  });
39
33
  ```
40
34
 
41
- ### Batch uploads
42
-
43
- ```ts
44
- const batch = manager.uploadFiles(
45
- files,
46
- (file) => ({ path: `uploads/${file.name}` }),
47
- { concurrency: 3, continueOnError: true },
48
- );
49
-
50
- batch.on("success", (snapshot) => {
51
- console.log(snapshot.completedCount, snapshot.failedCount);
52
- });
53
- ```
54
-
55
- ### Subscriptions (manager state)
56
-
57
- ```ts
58
- const unsubscribe = manager.subscribe((state) => {
59
- console.log(state.uploads, state.batches);
60
- });
61
- ```
62
-
63
- ### Custom metadata
64
-
65
- Attach app-specific metadata when uploading. Read it back later with `getMetadata`:
66
-
67
- ```ts
68
- const handle = manager.uploadFile(file, {
69
- path: `uploads/${file.name}`,
70
- customMetadata: {
71
- owner: "user-123",
72
- source: "mobile-app",
73
- },
74
- });
75
-
76
- const meta = await manager.getMetadata(`uploads/${file.name}`);
77
- console.log(meta.customMetadata?.owner);
78
- ```
79
-
80
- Works with batch uploads too — use `customMetadata` in the `UploadOptions` for each file.
35
+ ### React
81
36
 
82
- #### Caveats
37
+ ```tsx
38
+ import { useStorageManager, useUpload } from "firebase-storage-kit/react";
83
39
 
84
- - **String values only.** Keys and values must both be strings (`Record<string, string>`).
85
- - **Reserved keys.** Client apps cannot set internal keys such as `firebaseStorageDownloadTokens`; Firebase rejects those with a 400 error.
86
- - **Small data only.** Custom metadata is for lightweight, file-specific tags. For richer or queryable data, use Firestore or Realtime Database instead.
87
- - **Security rules.** Who can read or write metadata is controlled by your Firebase Storage security rules — configure them if metadata is sensitive.
88
-
89
- ### Upload retries
90
-
91
- Uploads retry transient failures automatically (3 retries by default, exponential backoff with jitter). Pass `retry: false` to disable, or customize:
92
-
93
- ```ts
94
- const handle = manager.uploadFile(file, {
95
- path: `uploads/${file.name}`,
96
- retry: { maxRetries: 5, initialDelayMs: 700 },
97
- });
98
-
99
- handle.on("retry", ({ attempt, maxAttempts, delayMs, error }) => {
100
- console.log(`Retry ${attempt}/${maxAttempts} in ${delayMs}ms`, error.message);
101
- });
40
+ const manager = useStorageManager(storage);
41
+ const handle = manager.uploadFile(file, { path: `uploads/${file.name}` });
42
+ const upload = useUpload(handle);
102
43
  ```
103
44
 
104
- ### Querying files
45
+ See [React hooks](https://firebase-storage-kit.vercel.app/docs/guides/react-hooks).
105
46
 
106
- ```ts
107
- const exists = await manager.exists("uploads/photo.jpg");
108
-
109
- if (exists) {
110
- const meta = await manager.getMetadata("uploads/photo.jpg");
111
- const url = await manager.getDownloadURL("uploads/photo.jpg");
112
- console.log(meta.size, url);
113
- }
114
-
115
- await manager.delete("uploads/old.jpg");
116
- ```
47
+ ## Learn more
117
48
 
118
- `exists` returns `false` only when the object is not found. Permission and network errors are thrown.
49
+ - [Single upload](https://firebase-storage-kit.vercel.app/docs/getting-started/single-upload)
50
+ - [Batch uploads](https://firebase-storage-kit.vercel.app/docs/guides/batch-uploads)
51
+ - [API reference](https://firebase-storage-kit.vercel.app/docs/api/storage-manager)
52
+ - [Troubleshooting](https://firebase-storage-kit.vercel.app/docs/troubleshooting)
119
53
 
120
54
  ## License
121
55