mirror of
https://github.com/arfct/itty-bitty.git
synced 2026-03-11 08:54:33 +00:00
revert data
This commit is contained in:
parent
bf65d5e68f
commit
2503c433b4
1 changed files with 6 additions and 6 deletions
|
|
@ -31,19 +31,19 @@ function decompressDataURI(dataURI, preamble, callback) {
|
||||||
var base64Index = dataURI.indexOf(LZMA64_MARKER);
|
var base64Index = dataURI.indexOf(LZMA64_MARKER);
|
||||||
if (base64Index > 0) {
|
if (base64Index > 0) {
|
||||||
var base64 = dataURI.substring(base64Index + LZMA64_MARKER.length);
|
var base64 = dataURI.substring(base64Index + LZMA64_MARKER.length);
|
||||||
zipToString(base64, function(string) {
|
zipToString(base64, function(result) {
|
||||||
stringToData(string, function(data) {
|
stringToData(result, function(data) {
|
||||||
if (!data) return callback();
|
if (!data) return callback(undefined);
|
||||||
callback(dataURI.substring(0, base64Index) + BASE64_MARKER + (preamble || '') + data.split(',')[1], string)
|
callback(dataURI.substring(0, base64Index) + BASE64_MARKER + (preamble || '') + data.split(',')[1])
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
if (preamble) dataURI = dataURI.replace(BASE64_MARKER, BASE64_MARKER + preamble)
|
||||||
callback(dataURI)
|
callback(dataURI)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function zipToString(data, callback) {
|
function zipToString(data, callback) {
|
||||||
let data = data.replace("-","");
|
|
||||||
var array = base64ToByteArray(data);
|
var array = base64ToByteArray(data);
|
||||||
LZMA.decompress(array, function(result, error) {
|
LZMA.decompress(array, function(result, error) {
|
||||||
if (!(typeof result === 'string')) result = new Uint8Array(result)
|
if (!(typeof result === 'string')) result = new Uint8Array(result)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue