Readme

#example

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
/**
* @title Blobs
* @description Store files as blobs
*/
// The blob library can be imported from esm.town
import { blob } from "https://esm.town/v/std/blob";
const KEY = "blob_counter";
// If the blob does not exists, use a default value.
const oldState = await blob.getJSON(KEY) ?? 0;
console.log("Old value", oldState);
// setJSON updates the blob value.
await blob.setJSON(KEY, oldState + 1);
// The updated value can then be retrieved.
const newState = await blob.getJSON(KEY);
console.log("New value", newState);
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
April 7, 2024