node-tyrant icon indicating copy to clipboard operation
node-tyrant copied to clipboard

A node.js module for the Tokyo Tyrant database

node-tyrant

This is an implementation of the Tokyo Tyrant network protocol for the Node javascript/v8 language.

Update: v0.2 updated to move from promises to function(err, value) callbacks in node.js

Update: v0.1.3 updated to use the updated module structure of node.

Update: v0.1.1 node-tyrant has been updated to use the new binary stream representation, and now uses promises for callbacks.

Install Tokyo Cabinet / Tokyo Tyrant, and set up either a b-tree or table database:

For a table database: ttserver casket.tdb

For a b-tree (key/value) database: ttserver casket.tcb

Quick Example

var tyrant = require("./tyrant"); var sys = require('sys');

var c = tyrant.connect();

c.addListener("connect", function (){ c.genuid(function(err, v) {sys.puts(v);}); c.put('0', 'town', 'Bangor € 1'); c.get('0', function(err, values) { var r=tyrant.dict(values); sys.puts(r.town); c.quit(); }); });