Skip to content

Commit

Permalink
refactor(deno): use denoflate instead of compress (#1482)
Browse files Browse the repository at this point in the history
deno.land/x/denoflate is about 10% smaller, and a lot more polished and
up to date than deno.land/x/compress.
  • Loading branch information
lucacasonato authored Aug 1, 2021
1 parent 01f0dd0 commit 2041f0a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
12 changes: 2 additions & 10 deletions lib/deno/external.d.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,3 @@
declare module 'https://deno.land/x/[email protected]/mod.ts' {
export interface InflateOptions {
windowBits?: number;
dictionary?: Uint8Array;
chunkSize?: number;
to?: string;
raw?: boolean;
}

export function gunzip(input: Uint8Array, options?: InflateOptions): Uint8Array
declare module "https://deno.land/x/[email protected]/mod.ts" {
export function gunzip(input: Uint8Array): Uint8Array;
}
4 changes: 2 additions & 2 deletions lib/deno/mod.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as types from "../shared/types"
import * as common from "../shared/common"
import * as compress from "https://deno.land/x/[email protected]/mod.ts"
import * as denoflate from "https://deno.land/x/[email protected]/mod.ts"

declare const ESBUILD_VERSION: string

Expand Down Expand Up @@ -108,7 +108,7 @@ function getCachePath(name: string): { finalPath: string, finalDir: string } {

function extractFileFromTarGzip(buffer: Uint8Array, file: string): Uint8Array {
try {
buffer = compress.gunzip(buffer)
buffer = denoflate.gunzip(buffer)
} catch (err) {
throw new Error(`Invalid gzip data in archive: ${err && err.message || err}`)
}
Expand Down

0 comments on commit 2041f0a

Please sign in to comment.