replit-storage
TypeScript icon, indicating that this package has built-in type declarations

2.0.11 • Public • Published

npm version

Run on Repl.it

Replit Storage

Replit Storage is a simple way to use the Replit Database in your repl.

Get started

const { Client } = require("replit-storage");
const client = new Client();

const key = 'str';

await client.set({
	key, // key: str
	[key]: key, // str: str
	other: 'value' // other: value
});

await client.get('key'); // str

Docs

class Client(String url?)

The parameter url is an optional custom DB URL.

Functions

These are the methods which a client instance provides.

get(String key, Object config?)

Gets a value.

client.get("key", { raw: false });

set(Object entries)

Sets entries through an object.

delete(String key)

Deletes a key.

list(Object config?)

Lists all of the keys, or all of the keys starting with prefix if specifed.

client.list({ prefix: "" });

empty()

Clears the database.

getAll()

Get all key/value pairs and return as an object.

deleteMany(Array keys)

Deletes multiple keys.

Tests

npm i
npm run test

Readme

Keywords

none

Package Sidebar

Install

npm i replit-storage

Weekly Downloads

5

Version

2.0.11

License

MIT

Unpacked Size

7 kB

Total Files

5

Last publish

Collaborators

  • 7hemech