forked from spdy-http2/spdy-transport
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Attempt to work around Deno zlib regression
- Loading branch information
Showing
2 changed files
with
41 additions
and
9 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,15 @@ | ||
import { Buffer } from 'node:buffer'; | ||
import { createDeflate,constants,createInflate, Deflate, Inflate } from 'node:zlib'; | ||
import { createDeflate,constants,createInflate, Deflate } from 'node:zlib'; | ||
import { Inflate } from "https://deno.land/x/[email protected]/zlib/mod.ts"; | ||
import { dictionary } from "./dictionary.ts"; | ||
|
||
export { type Deflate, Inflate, constants }; | ||
|
||
// TODO(indutny): think about it, why has it always been Z_SYNC_FLUSH here. | ||
// It should be possible to manually flush stuff after the write instead | ||
function _createDeflate (version: 2|3|3.1, compression: boolean) { | ||
const deflate = createDeflate({ | ||
dictionary: Buffer.from(dictionary[version]), | ||
// dictionary: Buffer.from(dictionary[version]), | ||
flush: constants.Z_SYNC_FLUSH, | ||
windowBits: 11, | ||
level: compression ? constants.Z_DEFAULT_COMPRESSION : constants.Z_NO_COMPRESSION | ||
|
@@ -16,9 +19,9 @@ function _createDeflate (version: 2|3|3.1, compression: boolean) { | |
} | ||
|
||
function _createInflate (version: 2|3|3.1) { | ||
const inflate = createInflate({ | ||
dictionary: Buffer.from(dictionary[version]), | ||
flush: constants.Z_SYNC_FLUSH | ||
const inflate = new Inflate({ | ||
dictionary: dictionary[version], | ||
// flush: constants.Z_SYNC_FLUSH | ||
}) | ||
|
||
return inflate | ||
|
This file contains 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