Skip to content

Commit

Permalink
v0.3.8
Browse files Browse the repository at this point in the history
  • Loading branch information
fuxingZhang committed Apr 8, 2021
1 parent 6fae119 commit ba8238a
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ The reason can be seen here:
#### definition
```ts
import { tar } from "https://deno.land/x/[email protected].7/mod.ts";
import { tar } from "https://deno.land/x/[email protected].8/mod.ts";
// or only import tar
// import { tar } from "https://deno.land/x/[email protected].7/tar/mod.ts";
// import { tar } from "https://deno.land/x/[email protected].8/tar/mod.ts";
export interface compressInterface {
excludeSrc?: boolean; // exclude src directory, default: include src directory
}
Expand All @@ -30,7 +30,7 @@ tar.uncompress(src, dest): Promise<void>;

#### example
```ts
import { tar } from "https://deno.land/x/[email protected].7/mod.ts";
import { tar } from "https://deno.land/x/[email protected].8/mod.ts";
// compress folder
await tar.compress("./test","./test.tar");
// compress folder, exclude src directory
Expand All @@ -50,9 +50,9 @@ import {
/** Compress data using deflate, and do not append a zlib header. */
deflateRaw,
inflateRaw
} from "https://deno.land/x/[email protected].7/mod.ts";
} from "https://deno.land/x/[email protected].8/mod.ts";
// or only import deflate, inflate, deflateRaw, inflateRaw
// import { deflate, inflate, deflateRaw, inflateRaw } from "https://deno.land/x/[email protected].7/zlib/mod.ts";
// import { deflate, inflate, deflateRaw, inflateRaw } from "https://deno.land/x/[email protected].8/zlib/mod.ts";
const str = "hello world!";
const bytes = new TextEncoder().encode(str);
// with zlib header
Expand Down Expand Up @@ -89,9 +89,9 @@ compress and uncompress file, only supports compressing and decompressing a sing
__stream mode__
used to read and write large files
```ts
import { GzipStream } from "https://deno.land/x/[email protected].7/mod.ts";
import { GzipStream } from "https://deno.land/x/[email protected].8/mod.ts";
// or only import GzipStream
// import { GzipStream } from "https://deno.land/x/[email protected].7/gzip/mod.ts";
// import { GzipStream } from "https://deno.land/x/[email protected].8/gzip/mod.ts";
const gzip = new GzipStream();
gzip.on("progress", (progress: string) => {
console.log(progress); // 0.00% => 100.00%
Expand All @@ -103,19 +103,19 @@ await gzip.uncompress("./big.mkv.gz", "./big.mkv");
__no stream mode__
loading all data into memory, so can't get `progress` event
```ts
import { gzipFile, gunzipFile } from "https://deno.land/x/[email protected].7/mod.ts";
import { gzipFile, gunzipFile } from "https://deno.land/x/[email protected].8/mod.ts";
// or only import gzipFile, gunzipFile
// import { gzipFile, gunzipFile } from "https://deno.land/x/[email protected].7/gzip/mod.ts";
// import { gzipFile, gunzipFile } from "https://deno.land/x/[email protected].8/gzip/mod.ts";
await gzipFile("./deno.txt", "./deno.txt.gz");
await gunzipFile("./deno.txt.gz", "./deno.txt");
```

**gzip/gunzip string or bytes**
> This is a pure TypeScript implementation. Almost as fast as Rust implementation.
```ts
import { gzip, gunzip } from "https://deno.land/x/[email protected].7/mod.ts";
import { gzip, gunzip } from "https://deno.land/x/[email protected].8/mod.ts";
// or only import gzip, gunzip
// import { gzip, gunzip } from "https://deno.land/x/[email protected].7/zlib/mod.ts";
// import { gzip, gunzip } from "https://deno.land/x/[email protected].8/zlib/mod.ts";
// gzip
const bytes = new TextEncoder().encode("hello");
const compressed = gzip(bytes);
Expand All @@ -127,9 +127,9 @@ const decompressed = gunzip(compressed);

#### definition
```ts
import { tgz } from "https://deno.land/x/[email protected].7/mod.ts";
import { tgz } from "https://deno.land/x/[email protected].8/mod.ts";
// or only import tgz
// import { tgz } from "https://deno.land/x/[email protected].7/tgz/mod.ts";
// import { tgz } from "https://deno.land/x/[email protected].8/tgz/mod.ts";
interface compressInterface {
excludeSrc?: boolean; // exclude src directory, default: include src directory
}
Expand All @@ -139,7 +139,7 @@ tgz.uncompress(src, dest): Promise<void>;

#### example
```ts
import { tgz } from "https://deno.land/x/[email protected].7/mod.ts";
import { tgz } from "https://deno.land/x/[email protected].8/mod.ts";
// compress folder
await tgz.compress("./test","./test.tar.gz");
// compress folder, exclude src directory
Expand All @@ -155,7 +155,7 @@ Not implemented

#### definition
```ts
import { zip } from "https://deno.land/x/[email protected].7/mod.ts";
import { zip } from "https://deno.land/x/[email protected].8/mod.ts";
interface compressInterface {
excludeSrc?: boolean; // exclude src directory, default: include src directory
}
Expand Down

0 comments on commit ba8238a

Please sign in to comment.