0.6.1#60
Open
willfarrell wants to merge 32 commits into
Open
Conversation
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
Signed-off-by: will Farrell <willfarrell@proton.me>
|
You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool. What Enabling Code Scanning Means:
For more information about GitHub Code Scanning, check out the documentation. |
Comment on lines
+33
to
+55
| { | ||
| start(controller) { | ||
| if (signal) { | ||
| if (signal.aborted) { | ||
| controller.error(abortError()); | ||
| return; | ||
| } | ||
| onAbort = () => controller.error(abortError()); | ||
| signal.addEventListener("abort", onAbort, { once: true }); | ||
| } | ||
| }, | ||
| transform(chunk, controller) { | ||
| outputSize += chunk.byteLength; | ||
| if (outputSize > maxOutputSize) { | ||
| controller.error( | ||
| new Error( | ||
| `Compression output exceeds maxOutputSize (${maxOutputSize} bytes)`, | ||
| ), | ||
| ); | ||
| return; | ||
| controller.enqueue(toBytes(chunk)); | ||
| }, | ||
| flush() { | ||
| if (onAbort) { | ||
| signal.removeEventListener("abort", onAbort); | ||
| onAbort = undefined; | ||
| } | ||
| controller.enqueue(chunk); | ||
| }, | ||
| }; | ||
| const limiter = new TransformStream(transformer); | ||
| return { | ||
| readable: compressor.readable.pipeThrough(limiter), | ||
| writable: compressor.writable, | ||
| }; | ||
| } | ||
| return compressor; | ||
| }, | ||
| writableStrategy, | ||
| readableStrategy, |
Comment on lines
+67
to
+98
| return new TransformStream({ | ||
| start(controller) { | ||
| if (signal) { | ||
| if (signal.aborted) { | ||
| controller.error(abortError()); | ||
| return; | ||
| } | ||
| onAbort = () => controller.error(abortError()); | ||
| signal.addEventListener("abort", onAbort, { once: true }); | ||
| } | ||
| }, | ||
| transform(chunk, controller) { | ||
| if (maxOutputSize !== null && maxOutputSize !== undefined) { | ||
| outputSize += chunk.byteLength; | ||
| if (outputSize > maxOutputSize) { | ||
| controller.error( | ||
| new Error( | ||
| `Decompression output exceeds maxOutputSize (${maxOutputSize} bytes)`, | ||
| `${label} output exceeds maxOutputSize (${maxOutputSize} bytes)`, | ||
| ), | ||
| ); | ||
| return; | ||
| } | ||
| controller.enqueue(chunk); | ||
| }, | ||
| }; | ||
| const limiter = new TransformStream(transformer); | ||
| return { | ||
| readable: decompressor.readable.pipeThrough(limiter), | ||
| writable: decompressor.writable, | ||
| }; | ||
| } | ||
| return decompressor; | ||
| } | ||
| controller.enqueue(chunk); | ||
| }, | ||
| flush() { | ||
| if (onAbort) { | ||
| signal.removeEventListener("abort", onAbort); | ||
| onAbort = undefined; | ||
| } | ||
| }, | ||
| }); |
|
|
||
| export const deflateCompressStream = (options = {}, streamOptions = {}) => { | ||
| const { maxOutputSize } = options; | ||
| const compressor = new CompressionStream("deflate"); |
Comment on lines
+33
to
+55
| { | ||
| start(controller) { | ||
| if (signal) { | ||
| if (signal.aborted) { | ||
| controller.error(abortError()); | ||
| return; | ||
| } | ||
| onAbort = () => controller.error(abortError()); | ||
| signal.addEventListener("abort", onAbort, { once: true }); | ||
| } | ||
| }, | ||
| transform(chunk, controller) { | ||
| outputSize += chunk.byteLength; | ||
| if (outputSize > maxOutputSize) { | ||
| controller.error( | ||
| new Error( | ||
| `Compression output exceeds maxOutputSize (${maxOutputSize} bytes)`, | ||
| ), | ||
| ); | ||
| return; | ||
| controller.enqueue(toBytes(chunk)); | ||
| }, | ||
| flush() { | ||
| if (onAbort) { | ||
| signal.removeEventListener("abort", onAbort); | ||
| onAbort = undefined; | ||
| } | ||
| controller.enqueue(chunk); | ||
| }, | ||
| }; | ||
| const limiter = new TransformStream(transformer); | ||
| return { | ||
| readable: compressor.readable.pipeThrough(limiter), | ||
| writable: compressor.writable, | ||
| }; | ||
| } | ||
| return compressor; | ||
| }, | ||
| writableStrategy, | ||
| readableStrategy, |
Comment on lines
+67
to
+98
| return new TransformStream({ | ||
| start(controller) { | ||
| if (signal) { | ||
| if (signal.aborted) { | ||
| controller.error(abortError()); | ||
| return; | ||
| } | ||
| onAbort = () => controller.error(abortError()); | ||
| signal.addEventListener("abort", onAbort, { once: true }); | ||
| } | ||
| }, | ||
| transform(chunk, controller) { | ||
| if (maxOutputSize !== null && maxOutputSize !== undefined) { | ||
| outputSize += chunk.byteLength; | ||
| if (outputSize > maxOutputSize) { | ||
| controller.error( | ||
| new Error( | ||
| `Decompression output exceeds maxOutputSize (${maxOutputSize} bytes)`, | ||
| `${label} output exceeds maxOutputSize (${maxOutputSize} bytes)`, | ||
| ), | ||
| ); | ||
| return; | ||
| } | ||
| controller.enqueue(chunk); | ||
| }, | ||
| }; | ||
| const limiter = new TransformStream(transformer); | ||
| return { | ||
| readable: decompressor.readable.pipeThrough(limiter), | ||
| writable: decompressor.writable, | ||
| }; | ||
| } | ||
| return decompressor; | ||
| } | ||
| controller.enqueue(chunk); | ||
| }, | ||
| flush() { | ||
| if (onAbort) { | ||
| signal.removeEventListener("abort", onAbort); | ||
| onAbort = undefined; | ||
| } | ||
| }, | ||
| }); |
|
|
||
| export const gzipCompressStream = (options = {}, streamOptions = {}) => { | ||
| const { maxOutputSize } = options; | ||
| const compressor = new CompressionStream("gzip"); |
Comment on lines
+1317
to
+1327
| const ts = new TransformStream({ | ||
| transform(chunk, controller) { | ||
| if (!isBufferSource(chunk)) { | ||
| controller.error( | ||
| new TypeError("CompressionStream chunk is not a BufferSource"), | ||
| ); | ||
| return; | ||
| } | ||
| controller.enqueue(chunk); | ||
| }, | ||
| }); |
| }; | ||
|
|
||
| const deflate = async (bytes, maxOutputSize) => { | ||
| const cs = new CompressionStream("deflate"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Release 0.6.1
Merging
developintomainfor release0.6.1.