@anabranch/storage 0.1.0 → 0.1.3
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 +53 -1
- package/package.json +4 -1
package/README.md
CHANGED
|
@@ -3,4 +3,56 @@
|
|
|
3
3
|
Object storage primitives with Task/Stream semantics for error-tolerant
|
|
4
4
|
operations.
|
|
5
5
|
|
|
6
|
-
|
|
6
|
+
A storage abstraction that integrates with anabranch's Task and Stream types for
|
|
7
|
+
composable error handling, concurrent processing, and automatic resource
|
|
8
|
+
management.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
```ts
|
|
13
|
+
import { createMemory, Storage } from "@anabranch/storage";
|
|
14
|
+
|
|
15
|
+
const connector = createMemory({ prefix: "files/" });
|
|
16
|
+
const storage = await Storage.connect(connector).run();
|
|
17
|
+
|
|
18
|
+
// Put an object
|
|
19
|
+
await storage.put("hello.txt", "Hello, World!", {
|
|
20
|
+
contentType: "text/plain",
|
|
21
|
+
}).run();
|
|
22
|
+
|
|
23
|
+
// Get an object
|
|
24
|
+
const object = await storage.get("hello.txt").run();
|
|
25
|
+
const text = await new Response(object.body).text();
|
|
26
|
+
console.log(text); // "Hello, World!"
|
|
27
|
+
|
|
28
|
+
// List objects with concurrent processing
|
|
29
|
+
const { successes, errors } = await storage.list("files/")
|
|
30
|
+
.withConcurrency(10)
|
|
31
|
+
.map(async (entry) => await processFile(entry))
|
|
32
|
+
.partition();
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Installation
|
|
36
|
+
|
|
37
|
+
**Deno (JSR)**
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { Storage } from "jsr:@anabranch/storage";
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
**Node / Bun (npm)**
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
npm install @anabranch/storage
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Adapters
|
|
50
|
+
|
|
51
|
+
- `createMemory` - In-memory storage for testing
|
|
52
|
+
- S3, GCS, Azure Blob Storage adapters coming soon
|
|
53
|
+
|
|
54
|
+
## API Reference
|
|
55
|
+
|
|
56
|
+
See
|
|
57
|
+
[generated documentation](https://frodi-karlsson.github.io/anabranch/storage)
|
|
58
|
+
for full API details.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anabranch/storage",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "TODO: Add description",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -20,5 +20,8 @@
|
|
|
20
20
|
"dependencies": {
|
|
21
21
|
"anabranch": "^0"
|
|
22
22
|
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"@types/node": "^24"
|
|
25
|
+
},
|
|
23
26
|
"_generatedBy": "dnt@dev"
|
|
24
27
|
}
|