-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1812 from yigaldviri/brotli
feat(brotli): support brotli compression format
- Loading branch information
Showing
7 changed files
with
284 additions
and
35 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
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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
const zlib = require('zlib'); | ||
const utils = require('../utils'); | ||
const { isGzipOrDeflateEncoding, isBrotliEncoding } = utils; | ||
|
||
exports.chooseDecompresser = (res) => { | ||
let decompresser; | ||
if (isGzipOrDeflateEncoding(res)) { | ||
decompresser = zlib.createUnzip(); | ||
} else if (isBrotliEncoding(res)) { | ||
decompresser = zlib.createBrotliDecompress(); | ||
} else { | ||
throw new Error('unknown content-encoding'); | ||
} | ||
return decompresser; | ||
} |
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
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
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
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
Oops, something went wrong.
Tinyify should be locked at 3.0.0 per https://github.com/browserify/tinyify/issues
cc @yigaldviri (I will fix this though)