You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
|`authentication`| An object containing authentication credentials (see [Authentication](#authentication)) |**Yes**|
24
+
|`context`| The [deploy context](https://docs.netlify.com/site-deploys/overview/#deploy-contexts) to use (defaults to `production`) | No |
25
+
|`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 |
26
+
|`siteID`| The Netlify site ID |**Yes**|
27
+
28
+
### Authentication
29
+
30
+
Authentication with the blob storage is done in one of two ways:
31
+
32
+
- Using a [Netlify API token](https://docs.netlify.com/api/get-started/#authentication)
33
+
34
+
```javascript
35
+
import { Blobs } from'@netlify/blobs'
36
+
37
+
conststore=newBlobs({
38
+
authentication: {
39
+
token:'YOUR_NETLIFY_API_TOKEN',
40
+
},
41
+
siteID:'YOUR_NETLIFY_SITE_ID',
42
+
})
43
+
```
44
+
45
+
- Using a context object injected in Netlify Functions
If an object with the given key is found, a [standard `Response` object](https://developer.mozilla.org/en-US/docs/Web/API/Response) is returned, allowing you to use methods like `.json()`, `.text()`, or `.blob()` to read the underlying value.
85
+
If an object with the given key is found, a
86
+
[standard `Response` object](https://developer.mozilla.org/en-US/docs/Web/API/Response) is returned, allowing you to use
87
+
methods like `.json()`, `.text()`, or `.blob()` to read the underlying value.
@@ -75,22 +112,24 @@ If an entry with the given key already exists, its value is overwritten.
75
112
76
113
```javascript
77
114
awaitblobs.setJSON('some-key', {
78
-
foo:"bar"
79
-
});
115
+
foo:'bar',
116
+
})
80
117
```
81
118
82
119
### `delete(key: string): Promise<void>`
83
120
84
121
Deletes an object with the given key, if one exists.
85
122
86
123
```javascript
87
-
awaitblobs.delete('my-key');
124
+
awaitblobs.delete('my-key')
88
125
```
89
126
90
127
## Contributing
91
128
92
-
Contributions are welcome! If you encounter any issues or have suggestions for improvements, please open an issue or submit a pull request on the [GitHub repository](https://github.com/example/netlify-blobs).
129
+
Contributions are welcome! If you encounter any issues or have suggestions for improvements, please open an issue or
130
+
submit a pull request on the [GitHub repository](https://github.com/example/netlify-blobs).
93
131
94
132
## License
95
133
96
-
Netlify Blobs is open-source software licensed under the [MIT license](https://github.com/example/netlify-blobs/blob/main/LICENSE).
134
+
Netlify Blobs is open-source software licensed under the
0 commit comments