feat: compress shareLink data when uploading to json server (#4225)

This commit is contained in:
David Luzar 2021-11-24 14:45:13 +01:00 committed by GitHub
parent 133ba19919
commit 896c476716
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 78 additions and 38 deletions

View file

@ -234,7 +234,19 @@ const splitBuffers = (concatenatedBuffer: Uint8Array) => {
let cursor = 0;
// first chunk is the version (ignored for now)
// first chunk is the version
const version = dataView(
concatenatedBuffer,
NEXT_CHUNK_SIZE_DATAVIEW_BYTES,
cursor,
);
// If version is outside of the supported versions, throw an error.
// This usually means the buffer wasn't encoded using this API, so we'd only
// waste compute.
if (version > CONCAT_BUFFERS_VERSION) {
throw new Error(`invalid version ${version}`);
}
cursor += VERSION_DATAVIEW_BYTES;
while (true) {