|
1 | 1 | # @vercel/blob |
2 | 2 |
|
| 3 | +## 2.3.0 |
| 4 | + |
| 5 | +### Minor Changes |
| 6 | + |
| 7 | +- 04ca1f0: Add private storage support (beta), a new `get()` method, and conditional gets |
| 8 | + |
| 9 | + **Private storage (beta)** |
| 10 | + |
| 11 | + You can now upload and read private blobs by setting `access: 'private'` on `put()` and `get()`. Private blobs require authentication to access — they are not publicly accessible via their URL. |
| 12 | + |
| 13 | + **New `get()` method** |
| 14 | + |
| 15 | + Fetch blob content by URL or pathname. Returns a `ReadableStream` along with blob metadata (url, pathname, contentType, size, etag, etc.). |
| 16 | + |
| 17 | + **Conditional gets with `ifNoneMatch`** |
| 18 | + |
| 19 | + Pass an `ifNoneMatch` option to `get()` with a previously received ETag. When the blob hasn't changed, the response returns `statusCode: 304` with `stream: null`, avoiding unnecessary re-downloads. |
| 20 | + |
| 21 | + **Example** |
| 22 | + |
| 23 | + ```ts |
| 24 | + import { put, get } from "@vercel/blob"; |
| 25 | + |
| 26 | + // Upload a private blob |
| 27 | + const blob = await put("user123/avatar.png", file, { access: "private" }); |
| 28 | + |
| 29 | + // Read it back |
| 30 | + const response = await get(blob.pathname, { access: "private" }); |
| 31 | + // response.stream — ReadableStream of the blob content |
| 32 | + // response.blob — metadata (url, pathname, contentType, size, etag, ...) |
| 33 | + |
| 34 | + // Conditional get — skip download if unchanged |
| 35 | + const cached = await get(blob.pathname, { |
| 36 | + access: "private", |
| 37 | + ifNoneMatch: response.blob.etag, |
| 38 | + }); |
| 39 | + if (cached.statusCode === 304) { |
| 40 | + // Blob hasn't changed, reuse previous data |
| 41 | + } |
| 42 | + ``` |
| 43 | + |
| 44 | + Learn more: https://vercel.com/docs/vercel-blob/private-storage |
| 45 | + |
3 | 46 | ## 2.2.0 |
4 | 47 |
|
5 | 48 | ### Minor Changes |
|
0 commit comments