blob-storage
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
This val pairs the lowdb lib with val.town built-in blob storage.
Usage:
import { blobStorage } from "https://esm.town/v/pomdtr/blob-storage/mod.ts";
const storage = await blobStorage(
{ posts: [] } as { posts: string[] } // default data, used for types
]);
// use the update method to mutage the data
await storage.update(({ posts }) => {
posts.push("Hello");
});
// use the `data` attribute to read
console.log(storage.data.posts)