Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
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());
April 4, 2024