Skip to content

Commit 005c2b9

Browse files
committed
chore: update README
1 parent d5e98ab commit 005c2b9

File tree

1 file changed

+20
-17
lines changed

1 file changed

+20
-17
lines changed

README.md

Lines changed: 20 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,26 @@ with the following properties:
2525
| `fetcher` | An implementation of a [fetch-compatible]https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API module for making HTTP requests (defaults to `globalThis.fetch`) | No |
2626
| `siteID` | The Netlify site ID | **Yes** |
2727

28+
### Example
29+
30+
```javascript
31+
import assert from 'node:assert'
32+
import { Blobs } from '@netlify/blobs'
33+
34+
const store = new Blobs({
35+
authentication: {
36+
token: 'YOUR_NETLIFY_AUTH_TOKEN',
37+
},
38+
siteID: 'YOUR_NETLIFY_SITE_ID',
39+
})
40+
41+
await store.set('some-key', 'Hello!')
42+
43+
const item = await store.get('some-key')
44+
45+
assert.strictEqual(await item.text(), 'Hello!')
46+
```
47+
2848
### Authentication
2949

3050
Authentication with the blob storage is done in one of two ways:
@@ -59,23 +79,6 @@ Authentication with the blob storage is done in one of two ways:
5979
}
6080
```
6181

62-
### Example
63-
64-
```javascript
65-
import { Blobs } from '@netlify/blobs'
66-
67-
const store = new Blobs({
68-
authentication: {
69-
token: 'YOUR_NETLIFY_AUTH_TOKEN',
70-
},
71-
siteID: 'YOUR_NETLIFY_SITE_ID',
72-
})
73-
74-
const item = await store.get('some-key')
75-
76-
console.log(await item.json())
77-
```
78-
7982
## API
8083

8184
### `get(key: string): Promise<Response | null>`

0 commit comments

Comments
 (0)