whoughton / lz77 Goto Github PK
View Code? Open in Web Editor NEWA javascript implementation of the lz77 compression algorithm, usable for node, requirejs/AMD, and browsers...
A javascript implementation of the lz77 compression algorithm, usable for node, requirejs/AMD, and browsers...
As per your request
I used some existing source as a reference, but I do not know where from at this stage, if anyone notices it, please let me know.
You are adapting Olle Törnström's 2009 code found here: https://github.com/olle/lz77-kit/blob/master/src/main/js/lz77.js, which is in turn based on Diogo Kollross's 2006 JS implementation here: https://web.archive.org/web/20091026234748/http://geocities.com/diogok_br/lz77/.
The jshint params can be moved into the package.json file.
Repro:
var lz = require('lz77');
var settings = {
minStringLength: 6
};
var to_compress = "can't read my, can't read my, no he can't read my poker face";
console.log(to_compress);
var compressed = lz.compress(to_compress, settings);
console.log(compressed);
var decompressed = lz.decompress(compressed, settings);
console.log(decompressed);
console.assert(to_compress === decompressed);
Outputs:
can't read my, can't read my, no he can't read my poker face
can't read my, ca` "'no he` '( poker face
can't read my, can't read my, o he, can't read mpoker face
And trips the assertion. This also happens when setting it to below the default value of 5.
lz77 version = 1.1.0
node version = v6.5.0
Repro:
var lz = require('lz77');
var settings = {
minStringLength: 5
};
var to_compress = 'hello hello baby you called I can\'t hear a thing';
console.log(to_compress);
var compressed = lz.compress(to_compress, settings);
console.log(compressed);
console.assert(to_compress === compressed);
minStringLength is set to 5 (the default), and there's a repeating substring of length 6 (hello
), so it seems like that should get replaced with a reference?
Correct and unify license information in package.json
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.