Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 54 lines (42 sloc) 2.714 kb
d6ad26a @kesla add travis.yml, refactor Readme.md
authored
1 # Node-snappy [![Build Status](https://secure.travis-ci.org/kesla/node-snappy.png)](http://travis-ci.org/kesla/node-snappy)
2
3 ## About
8bd2543 @kesla Readme and license.
authored
4
4a0b6ac @kesla Edited Readme.md via GitHub
authored
5 Node module/wrapper for Google's fast compressor/decompressor: <http://code.google.com/p/snappy/>
8bd2543 @kesla Readme and license.
authored
6
7 Snappy is a compression/decompression library. It does not aim for maximum compression, or compatibility with any other compression library; instead, it aims for very high speeds and reasonable compression. For instance, compared to the fastest mode of zlib, Snappy is an order of magnitude faster for most inputs, but the resulting compressed files are anywhere from 20% to 100% bigger. On a single core of a Core i7 processor in 64-bit mode, Snappy compresses at about 250 MB/sec or more and decompresses at about 500 MB/sec or more.
8
9 Snappy is widely used inside Google, in everything from BigTable and MapReduce to our internal RPC systems. (Snappy has previously been referred to as “Zippy” in some presentations and the likes.)
10
d6ad26a @kesla add travis.yml, refactor Readme.md
authored
11 ## Installation
d13ae77 @kesla Update readme, reflecting 1.0.0 version
authored
12 - "npm install snappy"
8bd2543 @kesla Readme and license.
authored
13
d6ad26a @kesla add travis.yml, refactor Readme.md
authored
14 ## Examples
15 ### String
8bd2543 @kesla Readme and license.
authored
16 snappy = require('./snappy');
8018dc9 @kesla compress/uncompress/isValidCompressed are now async, with synchronous ve...
authored
17 // Use synchronous version
d6ad26a @kesla add travis.yml, refactor Readme.md
authored
18 var compressed= snappy.compressSync('string to compress');
19 snappy.decompressSync(compressed, snappy.parsers.string);
20 // result will be string instead of Buffer
21 console.log(result);
8bd2543 @kesla Readme and license.
authored
22 }
23
d6ad26a @kesla add travis.yml, refactor Readme.md
authored
24 ### JSON
8bd2543 @kesla Readme and license.
authored
25 snappy = require('./snappy');
26 // Snappy automatically convert json to a string
27 snappy.compress({"foo": "bar"}, function(err, compressed){
28 snappy.decompress(compressed, snappy.parsers.json, function(err, result){
d6ad26a @kesla add travis.yml, refactor Readme.md
authored
29 // result will be json instead of Buffer
8bd2543 @kesla Readme and license.
authored
30 console.log(result["foo"]);
31 }
32 }
33
34 # License
35 Copyright (c) 2011 David Björklund
36
37 Permission is hereby granted, free of charge, to any person obtaining a copy
38 of this software and associated documentation files (the "Software"), to deal
39 in the Software without restriction, including without limitation the rights
40 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
41 copies of the Software, and to permit persons to whom the Software is
42 furnished to do so, subject to the following conditions:
43
44 The above copyright notice and this permission notice shall be included in
45 all copies or substantial portions of the Software.
46
47 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
48 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
49 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
50 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
51 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
52 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
53 THE SOFTWARE.
Something went wrong with that request. Please try again.