mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 12:01:23 +01:00
Adding gzip compression for improving storage use and backward compatibility. (#984)
* Basic gzip an gunzip on load and save. * refactor file save type to .gz and update the data in ui. --------- Co-authored-by: Azgaar <maxganiev@yandex.com>
This commit is contained in:
parent
5fba7d60f4
commit
ef24e3ea1a
10 changed files with 111 additions and 68 deletions
|
|
@ -14,3 +14,20 @@ if (Array.prototype.flat === undefined) {
|
|||
return this.reduce((acc, val) => (Array.isArray(val) ? acc.concat(val.flat()) : acc.concat(val)), []);
|
||||
};
|
||||
}
|
||||
|
||||
// polyfill readable stream iterator: https://bugs.chromium.org/p/chromium/issues/detail?id=929585#c10
|
||||
if(ReadableStream.prototype[Symbol.asyncIterator] === undefined){
|
||||
ReadableStream.prototype[Symbol.asyncIterator] = async function* () {
|
||||
const reader = this.getReader()
|
||||
try {
|
||||
while (true) {
|
||||
const {done, value} = await reader.read()
|
||||
if (done) return
|
||||
yield value
|
||||
}
|
||||
}
|
||||
finally {
|
||||
reader.releaseLock()
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue