![PyPI Now Supports iOS and Android Wheels for Mobile Python Development](https://cdn.sanity.io/images/cgdhsj6q/production/96416c872705517a6a65ad9646ce3e7caef623a0-1024x1024.webp?w=400&fit=max&auto=format)
Security News
PyPI Now Supports iOS and Android Wheels for Mobile Python Development
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
💾 Create data storage that uses a simple key-value method for Node, Browser, Deno, Bun, Cloudflare Workers
💾 Create data storage that uses a simple key-value method for Node, Browser, Deno, Bun, Cloudflare Workers
NPM (node, browser, deno, bun, cloudflare)
npm install kv-storage
CDN (browser)
<script src="https://cdn.jsdelivr.net/npm/kv-storage@0.0.9/dist/umd/kv-storage.js"></script>
NPM
//Node & Bun CommonJS import style
const {KVStorage} = require('kv-storage')
//Node, Browser, Deno, Bun & Cloudflare ES Modules import style
import {KVStorage} from 'kv-storage'
//Deno import style
import {KVStorage} from 'npm:kv-storage@0.0.9'
//Node, Browser, Deno & Bun Initialization
const db = await KVStorage({
runtime:'node', //node | browser | deno | bun
storageName:'storage'
})
//Cloudflare Initialization
const db = await KVStorage({
runtime:'cloudflare',
storageName:'storage', //Cloudflare D1 database name
databaseBinding:env.D1 //Cloudflare D1 database binding env
})
CDN
//Browser initialization if using CDN
const db = await KVStorage({
runtime:'browser',
storageName:'storage'
})
//Node & Bun CommonJS example
const {KVStorage} = require('kv-storage')
void async function main() {
const db = await KVStorage({
runtime:'node',//node | bun
storageName:'storage'
})
console.log(await db.put('key','value'))
console.log(await db.get('key'))
console.log(await db.list())
console.log(await db.delete('key'))
console.log(await db.has('key'))
console.log(await db.clear())
}()
//Node, Deno & Bun ES Modules example
import {KVStorage} from 'kv-storage'
void async function main() {
const db = await KVStorage({
runtime:'node',//node | deno | bun
storageName:'storage'
})
console.log(await db.put('key','value'))
console.log(await db.get('key'))
console.log(await db.list())
console.log(await db.delete('key'))
console.log(await db.has('key'))
console.log(await db.clear())
}()
<script src="https://cdn.jsdelivr.net/npm/kv-storage@0.0.9/dist/umd/kv-storage.js"></script>
<script>
//Browser using CDN example
void async function main() {
const db = await KVStorage({
runtime:'browser',
storageName:'storage'
})
console.log(await db.put('key','value'))
console.log(await db.get('key'))
console.log(await db.list())
console.log(await db.delete('key'))
console.log(await db.has('key'))
console.log(await db.clear())
}()
</script>
<script type="module">
//Browser ES Modules example
import {KVStorage} from 'https://cdn.jsdelivr.net/npm/kv-storage@0.0.9/dist/mjs/kv-storage.js'
void async function main() {
const db = await KVStorage({
runtime:'browser',
storageName:'storage'
})
console.log(await db.put('key','value'))
console.log(await db.get('key'))
console.log(await db.list())
console.log(await db.delete('key'))
console.log(await db.has('key'))
console.log(await db.clear())
}()
</script>
//Deno example
import {KVStorage} from 'npm:kv-storage@0.0.9'
void async function main() {
const db = await KVStorage({
runtime:'deno',
storageName:'storage'
})
console.log(await db.put('key','value'))
console.log(await db.get('key'))
console.log(await db.list())
console.log(await db.delete('key'))
console.log(await db.has('key'))
console.log(await db.clear())
}()
//Cloudflare workers example
import {KVStorage} from 'kv-storage'
export default {
async fetch(request, env) {
const db = await KVStorage({
runtime:'cloudflare',
storageName:'storage', //Cloudflare D1 database name
databaseBinding:env.D1 //Cloudflare D1 database binding env
})
let data = []
data.push(await db.put('key','value'))
data.push(await db.get('key'))
data.push(await db.has('key'))
data.push(await db.list())
data.push(await db.delete('key'))
data.push(await db.clear())
return new Response(JSON.stringify(data, null, 2))
}
}
https://nuzulul.github.io/kv-storage/
await init({
runtime,
storageName,
databaseBinding
})
runtime = Javascript runtime
storageName = Alphanumeric storage name
databaseBinding = Cloudflare only D1 database binding env
Supported runtime :
node
use File Systemdeno
use File System need --allow-read --allow-write
browser
use IndexedDBbun
use File Systemcloudflare
workers use D1 Database docs example wrangler.tomlawait put(key,value)
The put() method returns a Promise that you should await on to verify a successful update, resolve to true
or false
await get(key)
The get() method returns a promise you can await on to get the value, resolve to the value or false
await list()
Use a list operation to view all the keys that live in a given storage, return a promise which resolves with an object consist of:
await delete(key)
To delete a key-value pair, call the delete() method, resolve to true
or false
await has(key)
To check for the existence of a key, resolve to true
or false
await clear()
To delete all key value pairs, resolve to true
or false
FAQs
💾 Create data storage that uses a simple key-value method for Node, Browser, Deno, Bun, Cloudflare Workers
The npm package kv-storage receives a total of 5 weekly downloads. As such, kv-storage popularity was classified as not popular.
We found that kv-storage demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.