1.0.1 • Published 4 years ago

leveldb-tcp-server v1.0.1

Weekly downloads
3
License
ISC
Repository
github
Last release
4 years ago

leveldb-tcp-server

A redis compatible protocal levelDB tcp server

Usage

$ npm install leveldb-tcp-server
const Server = require('leveldb-tcp-server');

const server = new Server({
  port: 2407,
  dbPath: './test'
})

server.run();

or

$ git clone https://github.com/HoMuChen/leveldb-tcp-server.git
$ cd leveldb-tcp-server
$ npm run start

this script will default run a server listening on port 2407 and create a directory test for the leveldb data.

Client access

Application protocal is compatible with redis protocal, so we can use redis client library to access db.

const redis = require('redis')

const client = redis.createClient({ port: 2407 });

client.set("key", "123", (err, result) => {
  client.get("key", (err, result) => {
    console.log(result)
  });
});

For now, I only implement the get, set and del command.

Author

HoMuchen - b98901052@ntu.edu.tw