Public
valle_tmp_069034869725444597641897580363524
janpaul123
valle_tmp_069034869725444597641897580363524
// Define the key for blob storage
HTTP
scraper_template
resat
scraper_template
Remix of: gwoods22/scraper_template
Script
easyAQI
bcongdon
easyAQI
Remix of: stevekrouse/easyAQI
Script
valle_tmp_115772121902645334646172151872623
janpaul123
valle_tmp_115772121902645334646172151872623
* This val creates a simple hacker news clone with 30 fake sample stories. * It uses blob storage to store story data, including the ability to submit * new stories and upvote existing stories.
HTTP
getBlobAndRenderAsImage
ashryanio
getBlobAndRenderAsImage
getBlobAndRenderAsImage Shows how to get a Val Town blob and render it as an image in the DOM with React. Setup Make sure you have an image named test.png in your Val Town blob storage (alternatively, you can change the key name in the blob getter in the script). To easily upload an image to your blob storage, fork this val , run it, and enter your API key in the password input. How it works Fetching the blob: The client-side React component makes a fetch request to "/image". This request is handled by our server function. Server-side handling: The server function calls blob.get("test.png") . This blob.get() method makes an HTTP request to the Val Town API. The API returns a Response object containing the image data. Processing the blob on the server: We receive this Response object from blob.get() . We don't need to extract the data on the server side. We can directly return this Response object to the client. Sending the response to the client: We set the appropriate "Content-Type" header (e.g., "image/png"). We return the Response object to the client. Client-side handling: The fetch request in the React component receives the Response. We call response.blob() to get a Blob object from the Response. Creating a data URL: We create a FileReader object. We use FileReader to read the Blob as a data URL. This data URL is a base64-encoded string representing the image. Updating the React state: We set the data URL as the state of our component. Rendering the image: We use the data URL as the src attribute of an <img> tag. The browser decodes the base64 data and renders the image. Further reading on Val Town blobs Blob storage overview in Val Town docs Val Town REST API references for blobs Val Town blob std lib source code
HTTP
realTimeWhiteboard
davincidreams
realTimeWhiteboard
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
valle_tmp_1383961774625823777944450091493644
janpaul123
valle_tmp_1383961774625823777944450091493644
// This code will create a simple Hacker News clone with 30 fake sample stories,
HTTP
passionateScarletPrawn
stevekrouse
passionateScarletPrawn
Remix of: torlanco/shirtGenScript
HTTP
valle_tmp_90775096713594030038814365860220246
janpaul123
valle_tmp_90775096713594030038814365860220246
// Define interface for Story object
HTTP
AI_generated_Pictures
Shega
AI_generated_Pictures
@jsxImportSource https://esm.sh/react@18.2.0
HTTP
diabetesMealCalculatorApp
msclicks
diabetesMealCalculatorApp
Diabetics Guide Manageing Diabetes In 2025
HTTP
philosophicalHarlequinSturgeon
charmaine
philosophicalHarlequinSturgeon
Remix of: pinjasaur/unsplashSourceReimplementation
HTTP
valle_tmp_87778475813607539720320402884255
janpaul123
valle_tmp_87778475813607539720320402884255
// Unique key for blob storage
HTTP
blobCounter
Negash
blobCounter
Remix of: stevekrouse/blobCounter
HTTP
Authorization_from_Blob
rozek
Authorization_from_Blob
some tests can be found in val Authorization_from_Blob_Test
Script
btcPriceAlert
samk
btcPriceAlert
Remix of: stevekrouse/btcPriceAlert
Cron
Updated: August 13, 2024