Skip to content

Commit

Permalink
use zlib.gzip and gunzip
Browse files Browse the repository at this point in the history
  • Loading branch information
fuxingZhang committed Jul 27, 2020
1 parent fa888b8 commit 8a3aba8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
8 changes: 2 additions & 6 deletions gzip/gzip_file.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
/**
* fast,
* not export in mod.ts and not in deps.ts for it requires permission --allow-net
* so you must import from this file
**/
import { gzip, gunzip } from "https://deno.land/x/denoflate/mod.ts";
/** very fast */
import { gzip , gunzip} from "../zlib/mod.ts";
/** slow */
// import { gzip, gunzip } from "./gzip.ts";

Expand Down
6 changes: 4 additions & 2 deletions zlib/inflate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,15 +177,17 @@ export class Inflate {
}
}

export function inflate(input: Uint8Array, options: InflateOptions) {
export function inflate(input: Uint8Array, options: InflateOptions = {}) {
const inflator = new Inflate(options);
const result = inflator.push(input, true);
// That will never happens, if you don't cheat with options :)
if (inflator.err) throw inflator.msg || msg[inflator.err as CODE];
return result;
}

export function inflateRaw(input: Uint8Array, options: InflateOptions) {
export function inflateRaw(input: Uint8Array, options: InflateOptions = {}) {
options.raw = true;
return inflate(input, options);
}

export const gunzip = inflate;

0 comments on commit 8a3aba8

Please sign in to comment.