Skip to content
Browse files

Merge pull request #13 from juliangruber/patch-1

Update Readme.md
  • Loading branch information...
2 parents 3948b1c + e3a5b4c commit ecb51a6656fb693ff79491d896a0fe8bd0fb80fb @kesla committed Feb 25, 2013
Showing with 25 additions and 3 deletions.
  1. +25 −3 Readme.md
View
28 Readme.md
@@ -16,10 +16,9 @@ Snappy is widely used inside Google, in everything from BigTable and MapReduce t
snappy = require('./snappy');
// Use synchronous version
var compressed= snappy.compressSync('string to compress');
- snappy.decompressSync(compressed, snappy.parsers.string);
+ var result = snappy.decompressSync(compressed, snappy.parsers.string);
// result will be string instead of Buffer
- console.log(result);
- }
+ console.log(result);
### JSON
snappy = require('./snappy');
@@ -31,6 +30,29 @@ Snappy is widely used inside Google, in everything from BigTable and MapReduce t
}
}
+## API
+### snappy.compress(input, cb)
+
+Compress `input`, which can be a Buffer, String or arbitrary JavaScript object and call `cb` with `err` and `compressed`.
+
+### snappy.compressSync(input)
+
+Compress `input`, which can be a Buffer, String or arbitrary JavaScript object and return `compressed`. Throws if an error occurs.
+
+### snappy.decompress(compressed, cb[, parse])
+
+Decompress `compressed` using `parse` as parser (defaults to `raw`) and call `cb` with `err` and `decompressed`.
+
+### snappy.decompressSync(str, parse)
+
+Decompress `compressed` using `parse` as parser (defaults to `raw`) and return `decompressed`. Throws if an error occurs.
+
+## Parsers
+
+* json
+* string
+* raw
+
# License
Copyright (c) 2011 David Björklund

0 comments on commit ecb51a6

Please sign in to comment.
Something went wrong with that request. Please try again.