“JavaScript Compress Base64 obraz” Kod odpowiedzi

JavaScript Compress Base64 obraz

/*
Maybe string compression is the solution for you. 
This converts the data to byte arrays.

There are multiple implementations and algorithms around, for instance

LZMA-JS A standalone JavaScript implementation of the Lempel-Ziv-Markov chain (LZMA) compression algorithm.
*/
var str = "This is my compression test.";
console.log("Size of sample is: " + str.length);
var compressed = LZString.compress(str);
console.log("Size of compressed sample is: " + compressed.length);
str = LZString.decompress(compressed);
console.log("Sample is: " + str);
//solution 2
my_lzma = new LZMA("./lzma_worker.js");
my_lzma.compress("This is my compression test.", 1, function on_compress_complete(result) {
    console.log("Compressed: " + result);
    my_lzma.decompress(result, function on_decompress_complete(result) {
        console.log("Decompressed: " + result);
    }, function on_decompress_progress_update(percent) {
        console.log("Decompressing: " + (percent * 100) + "%");
    });
}, function on_compress_progress_update(percent) {
    console.log("Compressing: " + (percent * 100) + "%");
});
Dentetsu

JavaScript Compress Base64 obraz

var str = "This is my compression test.";
console.log("Size of sample is: " + str.length);
var compressed = LZString.compress(str);
console.log("Size of compressed sample is: " + compressed.length);
str = LZString.decompress(compressed);
console.log("Sample is: " + str);
Arrogant Alligator

Odpowiedzi podobne do “JavaScript Compress Base64 obraz”

Pytania podobne do “JavaScript Compress Base64 obraz”

Więcej pokrewnych odpowiedzi na “JavaScript Compress Base64 obraz” w JavaScript

Przeglądaj popularne odpowiedzi na kod według języka

Przeglądaj inne języki kodu