Readme

Set Blob Storage via fetch Response body

Inspired by Wes Bos's tweet about Bun's elegant Filesystem API.

1
2
3
4
5
6
import { blob } from "https://esm.town/v/std/blob?v=12";
const url = "https://example.com";
const key = "exampleBlob";
await blob.set(key, (await fetch(url)).body);
console.log(await (await blob.get(key)).text());
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
3
vladimyr avatar

@stevekrouse Let's make it even simpler 😉

// before await blob.set(key, (await fetch(url)).body); // after await blob.set(key, await fetch(url));
stevekrouse avatar

I am tempted... I like your style :)

vladimyr avatar

When Bos(s) asks ... :)

April 4, 2024