File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ This library also exports consistent async methods to compress and decompress ea
4747* ` gzip `
4848* ` gunzip `
4949* ` deflate `
50+ * ` deflateRaw `
5051* ` inflate `
5152* ` inflateRaw `
5253* ` brotliCompress `
Original file line number Diff line number Diff line change @@ -19,6 +19,7 @@ export type SUPPORTED_ENCODING =
1919export const gzip = promisify ( zlib . gzip ) ;
2020export const gunzip = promisify ( zlib . gunzip ) ;
2121export const deflate = promisify ( zlib . deflate ) ;
22+ export const deflateRaw = promisify ( zlib . deflateRaw ) ;
2223export const inflate = promisify ( zlib . inflate ) ;
2324export const inflateRaw = promisify ( zlib . inflateRaw ) ;
2425
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ import chaiAsPromised = require("chai-as-promised");
77chai . use ( chaiAsPromised ) ;
88const expect = chai . expect ;
99
10- import { encodeBuffer } from '../src/index' ;
10+ import { encodeBuffer , deflateRaw } from '../src/index' ;
1111
1212function bufferToArrayBuffer ( buffer : Buffer ) : ArrayBuffer {
1313 return buffer . buffer . slice ( buffer . byteOffset , buffer . byteLength + buffer . byteOffset )
@@ -57,6 +57,11 @@ describe("Encode", () => {
5757 expect ( zlib . inflateSync ( body ) . toString ( ) ) . to . equal ( 'Response to deflate' ) ;
5858 } ) ;
5959
60+ it ( 'should encode raw deflate bodies' , async ( ) => {
61+ const body = await deflateRaw ( Buffer . from ( 'Response to raw deflate' ) , { level : 1 } ) ;
62+ expect ( zlib . inflateRawSync ( body ) . toString ( ) ) . to . equal ( 'Response to raw deflate' ) ;
63+ } ) ;
64+
6065 it ( 'should encode brotli bodies' , async ( ) => {
6166 const body = await encodeBuffer ( Buffer . from ( 'Response to brotlify brotlify' ) , 'br' ) ;
6267 expect ( Buffer . from (
You can’t perform that action at this time.
0 commit comments