Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
drbh authored May 6, 2019
1 parent a638f0e commit 78e9f7c
Showing 1 changed file with 38 additions and 7 deletions.
45 changes: 38 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,43 @@
# 🦀🕸️ Shipping Compressed Data
# 🦀🕸️ wasm-flate
Superfast compression and decompression in the browser.

## WASM for fast (de)compression
## WASM npm library for fast (de)compression

This is a try package
- Uses WASM
- As fast as C or Rust implementation
- Works in all browsers
- GZIP supported
- ZLIB supported
- DELFATE supported

### Uses
- Shipping compressed data from server and decompress in browser
- Shipping compressed data to server by compressing in browser
- Better UX for mobile (fast decompress - slow data fetch)
- Better UX for people with sparse networks
- Less resource use on server side
- Decreased storage need
- Leveraging growing WASM ecosystem

## Compressing Data
This package allows you to quickly compress and decompress data in the browser. The process is simple and optmized to execute as fast as your browser can run.

#### Compress
Pass a string or Uint8Array to the compression function you choose. The contents will be compressed and encoded to base64. The returned value will be a base64 encoded string.

#### Decompress
Pass a base64 string of the compressed data and it will return a base64 decompressed value.

# Example

```javascript
var flate = require('wasm-flate');

var data = "THIS IS EXAMPLE DATA TO COMPRESS"
var compressed_data = flate.zlib_encode(data)
var original_data = flate.zlib_decode(compressed_data)
```

### Compressing Data

```javascript
var data = "THIS IS EXAMPLE DATA TO COMPRESS"
Expand All @@ -25,8 +57,7 @@ var compressed_data = deflate_encode(data)
// this data is deflate compressed and base64 encoded
```

## Decompressing Data

### Decompressing Data

```javascript
var original_data = zlib_decode("eNrtlEtOAzEMhvc9RTXrLpw4jmMu0EMgFk7GQQjRSjCgSlXvThgG1KpqeUgskOpN/Ppt61tkO5vPu14H7a7m2+a3aHjU3p5afD3G8yk/1vRh/bwalja0cuco+kARE/lucdRz92JjEzgiiZEAE0y23337Pgs2xbhCzOo5o5GnUvpamrSYSotbrooztQPxtAQ2Kk6sFvbcjvK+AHt1JMFqnzU5TqoYoU/76mF9b6vlx36DzOK5BK0eOVLJ5NAFBQPyTiUGqmBejyd8HgHftG6asFt8QVgkCgglCKcBMzI7hCRB4t/xdQYphkwxclOElBO7LD2IQ8SqVjBgqLH+N77nuPoLzx/zxOTPMqWAGC5cf/sP4Gm2Cbj9ANzYBrzwPeQ7vjezN2/3Cpfxnx4=")
Expand All @@ -46,4 +77,4 @@ output:
}
], "..."
}
```
```

0 comments on commit 78e9f7c

Please sign in to comment.