Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Update Readme.md

  • Loading branch information...
commit fccb28c027be3c2db13bc557557a4a0c4f1991f3 1 parent ecb51a6
@kesla authored
Showing with 17 additions and 13 deletions.
  1. +17 −13 Readme.md
View
30 Readme.md
@@ -13,22 +13,26 @@ Snappy is widely used inside Google, in everything from BigTable and MapReduce t
## Examples
### String
- snappy = require('./snappy');
- // Use synchronous version
- var compressed= snappy.compressSync('string to compress');
- var result = snappy.decompressSync(compressed, snappy.parsers.string);
- // result will be string instead of Buffer
- console.log(result);
+```js
+ var snappy = require('./snappy');
+ // Use synchronous version
+ var compressed = snappy.compressSync('string to compress');
+ var result = snappy.decompressSync(compressed, snappy.parsers.string);
+ // result will be string instead of Buffer
+ console.log(result);
+```
### JSON
- snappy = require('./snappy');
- // Snappy automatically convert json to a string
- snappy.compress({"foo": "bar"}, function(err, compressed){
- snappy.decompress(compressed, snappy.parsers.json, function(err, result){
- // result will be json instead of Buffer
- console.log(result["foo"]);
- }
+```js
+ var snappy = require('./snappy');
+ // Snappy automatically convert json to a string
+ snappy.compress({"foo": "bar"}, function(err, compressed){
+ snappy.decompress(compressed, snappy.parsers.json, function(err, result){
+ // result will be json instead of Buffer
+ console.log(result["foo"]);
}
+ }
+```
## API
### snappy.compress(input, cb)
Please sign in to comment.
Something went wrong with that request. Please try again.