@replit/database
TypeScript icon, indicating that this package has built-in type declarations

2.0.5 • Public • Published

npm version

Run on Repl.it

Repl.it Database client

Repl.it Database client is a simple way to use Repl.it Database in your Node.js repls. It uses await/async.

Get started

const Client = require("@replit/database");
const client = new Client();
await client.set("key", "value");
let key = await client.get("key");
console.log(key);

Docs

class Client(String key?)

The key is the optional custom URL.

Native Functions

These functions are specified in the repl.it DB.

get(String key, Object options?)

Gets a key. Returns Promise.

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

set(String key, Any value)

Sets a key to value. Returns Client.

delete(String key)

Deletes a key. Returns Client.

list(String? prefix)

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

Dynamic Functions

These functions have been added by me.

empty()

Clears the database. Returns Client

getAll()

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

setAll(Object obj)

Sets the entire database through a key/value object. Returns Client

deleteMultiple(...String args)

Deletes multiple keys. Returns client.

Tests

npm i
npm run test

Readme

Keywords

none

Package Sidebar

Install

npm i @replit/database

Weekly Downloads

1,151

Version

2.0.5

License

MIT

Unpacked Size

11.1 kB

Total Files

8

Last publish

Collaborators

  • james-addison-replit
  • replitdstewart
  • ryanweingast
  • harryatreplit
  • theflowingsky
  • jonesit-replit
  • szymon_k
  • cdmistman
  • jackyzha0
  • jamesaustinreplit
  • lopezhoracio
  • bradymaddenreplit
  • ryantm
  • alexisreplit
  • ink404
  • brianpool
  • tobyho
  • brenoafb
  • masad-frost
  • lincolnreplit
  • stkenned
  • replitmatt
  • cbrewster
  • ltazmin_replit
  • moudy
  • schestakov
  • lhchavez
  • slmjkdbtl
  • lunaroyster