• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
pomdtr

pomdtr

unstorage-driver

Public
Like
1
unstorage-driver
Home
Code
4
.vtignore
README.md
deno.json
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
/
README.md
Code
/
README.md
Search
12/21/2025
README.md

Val Town Blob Storage Driver for Unstorage

An Unstorage driver that provides seamless integration with Val Town's Blob Storage.

Features

  • πŸ”Œ Drop-in driver for Unstorage
  • πŸ’Ύ Full CRUD operations for Val Town blobs
  • πŸ”‘ Key normalization and prefix support
  • πŸ“¦ Binary and text data support
  • πŸ” Secure API key authentication

Installation

Import the driver directly from this val:

import driver from "https://esm.town/v/pomdtr/unstorage-driver/main.tsx";

Or use it with the Unstorage library:

import { createStorage } from "https://esm.sh/unstorage"; import driver from "https://esm.town/v/pomdtr/unstorage-driver/main.tsx";

Usage

Basic Setup

import { createStorage } from "https://esm.sh/unstorage"; import driver from "https://esm.town/v/pomdtr/unstorage-driver/main.tsx"; const storage = createStorage({ driver: driver({ apiKey: Deno.env.get("VALTOWN_API_KEY") }) }); // Store data await storage.setItem("user:123", { name: "Alice", email: "alice@example.com" }); // Retrieve data const user = await storage.getItem("user:123"); // Check if key exists const exists = await storage.hasItem("user:123"); // List all keys const keys = await storage.getKeys(); // Remove item await storage.removeItem("user:123"); // Clear all items (or with prefix) await storage.clear("user:");

Working with Binary Data

// Store binary data const imageData = new Uint8Array([/* ... */]); await storage.setItemRaw("images:logo.png", imageData); // Retrieve binary data const data = await storage.getItemRaw("images:logo.png");

Using Key Prefixes

// List all keys with a specific prefix const userKeys = await storage.getKeys("user:"); // Clear all items with a prefix await storage.clear("user:");

API

Driver Options

type ValTownBlobOptions = { apiKey?: string; // Your Val Town API key (optional if running on Val Town) }

Supported Operations

  • hasItem(key) - Check if a key exists
  • getItem(key) - Get item as text
  • getItemRaw(key) - Get item as ArrayBuffer
  • setItem(key, value) - Store text/JSON data
  • setItemRaw(key, value) - Store binary data
  • removeItem(key) - Delete an item
  • getKeys(base?) - List all keys (optionally filtered by prefix)
  • clear(base?) - Remove all items (optionally filtered by prefix)

Use Cases

  • Key-Value Store: Simple persistent storage for your Val Town applications
  • Session Management: Store user sessions and authentication data
  • Cache Layer: Cache API responses or computed results
  • Configuration Storage: Store and retrieve application configuration
  • File Storage: Store and manage binary files like images or documents

Notes

  • Keys are automatically normalized using Unstorage's normalizeKey function
  • The driver uses Val Town's official SDK (@valtown/sdk) for blob operations
  • All operations are asynchronous and return Promises

Related

  • Unstorage Documentation
  • Val Town Blob Storage Docs
  • Val Town SDK

License

MIT

FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
Β© 2026 Val Town, Inc.