Git Product home page Git Product logo

wasm-flate's Introduction

🗜️ wasm-flate wapm version

Tweet

npm version dependencies Status

WebAssembly powered compression and decompression in the browser and server.

Docs

Documentation

var flate = require('wasm-flate');
var pako = require('pako');

var data = new Uint8Array( Buffer.from('Hello World') );
// Uint8Array [
//    72, 101, 108, 108,
//   111,  32,  87, 111,
//   114, 108, 100
// ]

compress with wasm-flate

flate.deflate_encode_raw(data)
// Uint8Array [
//   243, 72, 205, 201, 201,
//    87,  8, 207,  47, 202,
//    73,  1,   0
// ]

Then compress with pako

pako.deflateRaw(data)
// Uint8Array [
//   243, 72, 205, 201, 201,
//    87,  8, 207,  47, 202,
//    73,  1,   0
// ]

you can see the output is the same 🎉

you can even compress with one library and decompress with the other one

var data = new Uint8Array( Buffer.from('Hello World') );
var compressed_with_wasm_flate = flate.deflate_encode_raw(data)
var decompressed_with_pako = pako.inflateRaw(compressed_with_wasm_flate)

// covert to a string - since JS doesnt let us directly compare UintArrays
var original = new TextDecoder("utf-8").decode(data)
var evaluated = new TextDecoder("utf-8").decode(decompressed_with_pako)
original === evaluated
// true

Donate Here

If you found wasm-flate useful feel free to buy me a beer 🍺 or two 😀
BTC - 3QVK6D5QCZDSyLzFL3ZbELokyuSprRQQZF

wasm-flate's People

Contributors

anderspitman avatar drbh avatar erjanmx avatar syrusakbary avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.