@netlify/blobs
Advanced tools
Comparing version
@@ -9,3 +9,3 @@ import http from 'node:http'; | ||
type BlobInput = ReadableStream | string | ArrayBuffer | Blob; | ||
type BlobInput = string | ArrayBuffer | Blob; | ||
type Fetcher = typeof globalThis.fetch; | ||
@@ -61,3 +61,2 @@ declare enum HTTPMethod { | ||
etag?: string; | ||
fresh: boolean; | ||
metadata: Metadata; | ||
@@ -64,0 +63,0 @@ } |
@@ -243,3 +243,3 @@ // src/environment.ts | ||
const res = await this.client.makeRequest({ key, method: "delete" /* DELETE */, storeName: this.name }); | ||
if (res.status !== 200 && res.status !== 204 && res.status !== 404) { | ||
if (![200, 202, 404].includes(res.status)) { | ||
throw new BlobsInternalError(res.status); | ||
@@ -304,7 +304,6 @@ } | ||
etag: responseETag, | ||
fresh: false, | ||
metadata | ||
}; | ||
if (res.status === 304 && requestETag) { | ||
return { data: null, ...result, fresh: true }; | ||
return { data: null, ...result }; | ||
} | ||
@@ -311,0 +310,0 @@ if (type === void 0 || type === "text") { |
{ | ||
"name": "@netlify/blobs", | ||
"version": "4.2.0", | ||
"version": "5.0.0", | ||
"description": "A JavaScript client for the Netlify Blob Store", | ||
@@ -5,0 +5,0 @@ "type": "module", |
@@ -224,5 +224,5 @@ [](https://github.com/netlify/blobs/actions) | ||
// have locally, which means the entry has changed since you last obtained it | ||
const { data, etag, fresh } = await store.getWithMetadata('some-key', { etag: cachedETag }) | ||
const { data, etag } = await store.getWithMetadata('some-key', { etag: cachedETag }) | ||
if (fresh) { | ||
if (etag === cachedETag) { | ||
// `data` is `null` because the local blob is fresh | ||
@@ -235,3 +235,3 @@ } else { | ||
### `getMetadata(key: string, { etag?: string, type?: string }): Promise<{ data: any, etag: string, metadata: object }>` | ||
### `getMetadata(key: string, { etag?: string, type?: string }): Promise<{ etag: string, metadata: object }>` | ||
@@ -252,3 +252,3 @@ Retrieves any metadata associated with a given key and its | ||
### `set(key: string, value: ArrayBuffer | Blob | ReadableStream | string, { metadata?: object }): Promise<void>` | ||
### `set(key: string, value: ArrayBuffer | Blob | string, { metadata?: object }): Promise<void>` | ||
@@ -277,3 +277,4 @@ Creates an object with the given key and value. | ||
Deletes an object with the given key, if one exists. | ||
Deletes an object with the given key, if one exists. The return value is always `undefined`, regardless of whether or | ||
not there was an object to delete. | ||
@@ -280,0 +281,0 @@ ```javascript |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
367
0.27%79259
-0.14%1734
-0.17%