Browse files

Update readme to use async methods

  • Loading branch information...
1 parent f314128 commit e8bef140335a8645c67058b6a060e2ac10be13ed @mikepb mikepb committed with Feb 20, 2012
Showing with 12 additions and 9 deletions.
  1. +12 −9
@@ -1,4 +1,4 @@
-[![Build Status](](
+[![Build Status](](
# Node-LevelDB
@@ -14,14 +14,17 @@ Since LevelDB provides good primitives like MVCC and binary support (It was desi
* get the build working for 0.7
-## Status
-var db ="path/to/my/db", { create_if_missing: true });"path/to/my/db", { create_if_missing: true }, onOpen);
-The I/O in this initial version is all blocking and doesn't make use of node's thread pool for disk I/O. Since my use case is single-user applications, this is a perfectly fine compromise.
-Eventually I'll need to make async versions of all the calls so that it can also be used in a highly concurrent server environment.
-## API
+function onOpen(err, db) {
+ var key = "mykey";
+ db.put(key, "My Value!", function(err) {
+ db.getSync(key, function(err, value) {
+ console.dir(value); // prints: My Value!
+ db.del(key);
+ });
+ });
The API is meant to be an almost one-to-one mapping to the underlying C++ library. Essentially it's a key/value store, but has some extra nice things like sorted keys, snapshots and iterators.
@@ -40,7 +43,7 @@ This is the main Class and probably the only one that a user needs to create man
I'll document more as this stabilizes. In the mean-time, check out the demo scripts I use for testing.
## Compiling

0 comments on commit e8bef14

Please sign in to comment.