FeaturesTemplatesShowcaseTownie
AI
BlogDocsPricing
Log inSign up
stevekrouse
stevekrouser2
Public
Like
2
r2
Home
Code
2
README.md
main.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
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.
Sign up now
Code
/
Code
/
Search
README.md

r2 wrapper

Save blobs without leaving Val Town! Only for Val Town Pro users to limit abuse.

We get 10gb free, so as long as nobody abuses this, I won't put any strict limits on it. If you want to use more than 10gb, let me know, and we can bill you for it.

All data in this bucket is public if you know it's name!

This val, @stevekrouse.r2, is the "SDK" for @stevekrouse.r2Proxy.

Setup

  1. This val requires you to setup public key auth, which is really just three clicks here: https://blog.val.town/public-key-auth-val-town-users-can-be-your-users
  2. [Optional] You can setup a helper function so you don't have to pass your keys every time:
Create val
let blob = (key, value) => @stevekrouse.r2(key, value, @me.exportedKeys)

Warning: Do not make your blob function public or unlisted. That would allow anyone to use it.

Usage

Create val
await @me.blob("demo", { hello: "world" }); return @me.blob("demo"); // {hello: "world"}

Example usage: https://www.val.town/v/stevekrouse.r2Demo

Migrated from folder: Archive/r2_wrapper/r2

Code
README.mdmain.tsx
Go to top
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Product
FeaturesPricing
Developers
DocsStatusAPI ExamplesNPM Package Examples
Explore
ShowcaseTemplatesNewest ValsTrending ValsNewsletter
Company
AboutBlogCareersBrandhi@val.town
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.