pomdtr avatar
pomdtr
val_town_by_example_toc
Cron
// edit this if you want to add new items to the home page
0
pomdtr avatar
pomdtr
serve_blobs
HTTP
Serve prefixed blobs. Usage import { serveBlobs } from "https://esm.town/v/pomdtr/serve_blobs" export default serveBlobs({ root: "public/" }) All your blobs prefixed by public/ will be publicly accessible. Ex: Go to https://pomdtr-public.web.val.run/example.json to view the blob public/example.json from my account.
3
pomdtr avatar
pomdtr
blob
Script
Forked from janpaul123/blob
0
easrng avatar
easrng
generateOnce
Script
An interactive, runnable TypeScript val by easrng
0
vladimyr avatar
vladimyr
blob
Script
Forked from std/blob
0
std avatar
std
blob
Script
Blob Storage - Docs ↗ Val Town comes with blob storage built-in. It allows for storing any data, like text, JSON, or images. You can access it via std/blob . Blob storage is scoped globally to your account. If you set a blob in one val, you can retrieve it by the same key in another val. It's backed by Cloudflare R2. Blob Admin Panels Blob Storage in Settings – built-into Val Town - list, download, delete blobs Blob Admin – search, view, edit, upload blobs – built in a val – easy to customize in Val Town! Usage Get JSON import { blob } from "https://esm.town/v/std/blob"; let blobDemo = await blob.getJSON("myKey"); console.log(blobDemo); // returns `undefined` if not found Set JSON import { blob } from "https://esm.town/v/std/blob"; await blob.setJSON("myKey", { hello: "world" }); List keys import { blob } from "https://esm.town/v/std/blob"; let allKeys = await blob.list(); console.log(allKeys); const appKeys = await blob.list("app_"); console.log(appKeys); // all keys that begin with `app_` Delete by key import { blob } from "https://esm.town/v/std/blob"; await blob.delete("myKey"); Examples Counter RSS Notifications (saving the last run time) Picture: Save & Read Error Handling blob.get can throw ValTownBlobNotFoundError Any method can throw ValTownBlobError for unexpected errors. Utilities Our Blob SDK also includes some utility functions to make working with blobs easier. Copy import { blob } from "https://esm.town/v/std/blob"; await blob.copy("myKey", "myKeyCopy"); Move import { blob } from "https://esm.town/v/std/blob"; await blob.move("myKey", "myKeyNew"); Lower-level API We provide access to the lower-level getter and setters, which are useful if you are storing non-JSON or binary data, need to stream in your response or request data, or do anything else lower-level. async get(key: string) : Retrieves a blob for a given key. async set(key: string, value: string | BodyInit) : Sets the blob value for a given key. See BodyInit . Limitations Blob-stored data counts towards your total Val Town storage – 10mb on the free plan and 1gb on pro. Check our pricing page to learn more. Keys for blobs can be up to 512 characters long. 📝 Edit docs
9
andreterron avatar
andreterron
blob_docs
Script
Forked from std/blob
0
janpaul123 avatar
janpaul123
blob
Script
Forked from std/blob
5
nichoth avatar
nichoth
blob
Script
Forked from janpaul123/blob
0
rayyan avatar
rayyan
blob
Script
Forked from janpaul123/blob
0
yawnxyz avatar
yawnxyz
blobWithSqlite
Script
Forked from janpaul123/blob
1
iamseeley avatar
iamseeley
val_town_by_example_toc
Cron
Forked from pomdtr/val_town_by_example_toc
0
natashatherobot avatar
natashatherobot
blob
Script
Forked from std/blob
0
bons avatar
bons
blob
Script
Forked from std/blob
0
ianmenethil avatar
ianmenethil
blob
Script
Forked from std/blob
0
1
Next
Updated: November 14, 2023