Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 59 lines (48 sloc) 2.976 kb
8bd25439 »
2011-04-09 Readme and license.
1 # About
2
3 Node module/wrapper for Google's fast compressor/decompressor: http://code.google.com/p/snappy/
4
5 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.
6
7 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.)
8
9 # Installation
10 - Grab the latest Snappy build and install it on your system:
11 - http://code.google.com/p/snappy/
12 - Install coffee-script (http://jashkenas.github.com/coffee-script/)
13 - npm install coffee-script
14 - Edit wscript and edit change the snappy_home-variable to the path were you've installed snappy_home
15 - Build and install node-snappy
16 - node-waf configure install
17
18 # Examples
19 ## String
20 snappy = require('./snappy');
21 snappy.compress('string to compress', function(err, compressed){
22 // result will be string instead of Buffer
23 snappy.decompress(compressed, snappy.parsers.string, function(err, result){
24 console.log(result);
25 }
26 }
27
28 ## JSON
29 snappy = require('./snappy');
30 // Snappy automatically convert json to a string
31 snappy.compress({"foo": "bar"}, function(err, compressed){
32 // result will be json instead of Buffer
33 snappy.decompress(compressed, snappy.parsers.json, function(err, result){
34 console.log(result["foo"]);
35 }
36 }
37
38 For more examples of the api, see test.coffee
39
40 # License
41 Copyright (c) 2011 David Björklund
42
43 Permission is hereby granted, free of charge, to any person obtaining a copy
44 of this software and associated documentation files (the "Software"), to deal
45 in the Software without restriction, including without limitation the rights
46 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
47 copies of the Software, and to permit persons to whom the Software is
48 furnished to do so, subject to the following conditions:
49
50 The above copyright notice and this permission notice shall be included in
51 all copies or substantial portions of the Software.
52
53 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
54 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
55 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
56 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
57 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
58 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
59 THE SOFTWARE.
Something went wrong with that request. Please try again.