Skip to content

Commit a86252b

Browse files
author
zhangfuxing
committed
docs: Add symbol documentation to existing interfaces
1 parent 2f72454 commit a86252b

File tree

5 files changed

+72
-24
lines changed

5 files changed

+72
-24
lines changed

README.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ If you want to read and write files, you need the following [permissions](https:
2020
2121
### Definition
2222

23-
v0.5.1
23+
v0.5.2
2424
Use `@std/tar` instead of `@std/archive` due to deprecation
2525
If you want to use the old API, you can do it
2626
> import { tar } from "jsr:@deno-library/compress/tar_archive/mod.ts";
@@ -29,11 +29,11 @@ If you want to use the old API, you can do it
2929
// JSR
3030
import { tar } from "jsr:@deno-library/compress";
3131
// or
32-
// import { tar } from "jsr:@deno-library/[email protected].1";
32+
// import { tar } from "jsr:@deno-library/[email protected].2";
3333
// or
34-
// import { tar } from "https://deno.land/x/[email protected].1/mod.ts";
34+
// import { tar } from "https://deno.land/x/[email protected].2/mod.ts";
3535
// or only import tar
36-
// import { tar } from "https://deno.land/x/[email protected].1/tar/mod.ts";
36+
// import { tar } from "https://deno.land/x/[email protected].2/tar/mod.ts";
3737
export interface compressInterface {
3838
excludeSrc?: boolean; // does not contain the src directory
3939
debug?: boolean; // list the files and folders
@@ -51,7 +51,7 @@ tar.uncompress(src, dest, options?: uncompressInterface): Promise<void>;
5151
// JSR
5252
import { tar } from "jsr:@deno-library/compress";
5353
// or
54-
// import { tar } from "https://deno.land/x/[email protected].1/mod.ts";
54+
// import { tar } from "https://deno.land/x/[email protected].2/mod.ts";
5555
// compress folder
5656
await tar.compress("./test", "./test.tar");
5757
// compress folder, exclude src directory
@@ -78,9 +78,9 @@ import {
7878
inflateRaw,
7979
} from "jsr:@deno-library/compress";
8080
// or
81-
// import { deflate, inflate, deflateRaw, inflateRaw } from "https://deno.land/x/[email protected].1/mod.ts";
81+
// import { deflate, inflate, deflateRaw, inflateRaw } from "https://deno.land/x/[email protected].2/mod.ts";
8282
// or only import deflate, inflate, deflateRaw, inflateRaw
83-
// import { deflate, inflate, deflateRaw, inflateRaw } from "https://deno.land/x/[email protected].1/zlib/mod.ts";
83+
// import { deflate, inflate, deflateRaw, inflateRaw } from "https://deno.land/x/[email protected].2/zlib/mod.ts";
8484
const str = "hello world!";
8585
const bytes = new TextEncoder().encode(str);
8686
// with zlib header
@@ -123,9 +123,9 @@ Useful for reading and writing large files.
123123
```ts
124124
import { GzipStream } from "jsr:@deno-library/compress";
125125
// or
126-
// import { GzipStream } from "https://deno.land/x/[email protected].1/mod.ts";
126+
// import { GzipStream } from "https://deno.land/x/[email protected].2/mod.ts";
127127
// or only import GzipStream
128-
// import { GzipStream } from "https://deno.land/x/[email protected].1/gzip/mod.ts";
128+
// import { GzipStream } from "https://deno.land/x/[email protected].2/gzip/mod.ts";
129129
const gzip = new GzipStream();
130130
gzip.on("progress", (progress: string) => {
131131
console.log(progress); // 0.00% => 100.00%
@@ -140,9 +140,9 @@ await gzip.uncompress("./big.mkv.gz", "./big.mkv");
140140
```ts
141141
import { gunzipFile, gzipFile } from "jsr:@deno-library/compress";
142142
// or
143-
// import { gunzipFile, gzipFile } from "https://deno.land/x/[email protected].1/mod.ts";
143+
// import { gunzipFile, gzipFile } from "https://deno.land/x/[email protected].2/mod.ts";
144144
// or only import gzipFile, gunzipFile
145-
// import { gzipFile, gunzipFile } from "https://deno.land/x/[email protected].1/gzip/mod.ts";
145+
// import { gzipFile, gunzipFile } from "https://deno.land/x/[email protected].2/gzip/mod.ts";
146146
await gzipFile("./deno.txt", "./deno.txt.gz");
147147
await gunzipFile("./deno.txt.gz", "./deno.txt");
148148
```
@@ -155,9 +155,9 @@ await gunzipFile("./deno.txt.gz", "./deno.txt");
155155
```ts
156156
import { gunzip, gzip } from "jsr:@deno-library/compress";
157157
// or
158-
// import { gunzip, gzip } from "https://deno.land/x/[email protected].1/mod.ts";
158+
// import { gunzip, gzip } from "https://deno.land/x/[email protected].2/mod.ts";
159159
// or only import gzip, gunzip
160-
// import { gzip, gunzip } from "https://deno.land/x/[email protected].1/zlib/mod.ts";
160+
// import { gzip, gunzip } from "https://deno.land/x/[email protected].2/zlib/mod.ts";
161161
// gzip
162162
const bytes = new TextEncoder().encode("hello");
163163
const compressed = gzip(bytes);
@@ -167,7 +167,7 @@ const decompressed = gunzip(compressed);
167167

168168
## `tgz`
169169

170-
v0.5.1
170+
v0.5.2
171171
Use `@std/tar` instead of `@std/archive` due to deprecation
172172
If you want to use the old API, you can do it
173173
> import { tgz } from "jsr:@deno-library/compress/tgz_archive/mod.ts";
@@ -177,9 +177,9 @@ If you want to use the old API, you can do it
177177
```ts
178178
import { tgz } from "jsr:@deno-library/compress";
179179
// or
180-
// import { tgz } from "https://deno.land/x/[email protected].1/mod.ts";
180+
// import { tgz } from "https://deno.land/x/[email protected].2/mod.ts";
181181
// or only import tgz
182-
// import { tgz } from "https://deno.land/x/[email protected].1/tgz/mod.ts";
182+
// import { tgz } from "https://deno.land/x/[email protected].2/tgz/mod.ts";
183183
export interface compressInterface {
184184
excludeSrc?: boolean; // does not contain the src directory
185185
debug?: boolean; // list the files and folders
@@ -196,7 +196,7 @@ tgz.uncompress(src, dest, options?: uncompressInterface): Promise<void>;
196196
```ts
197197
import { tgz } from "jsr:@deno-library/compress";
198198
// or
199-
// import { tgz } from "https://deno.land/x/[email protected].1/mod.ts";
199+
// import { tgz } from "https://deno.land/x/[email protected].2/mod.ts";
200200
// compress folder
201201
await tgz.compress("./test", "./test.tar.gz");
202202
// compress folder, exclude src directory
@@ -214,9 +214,9 @@ await tgz.uncompress("./test.tar.gz", "./dest");
214214
```ts
215215
import { zip } from "jsr:@deno-library/compress";
216216
// or
217-
// import { zip } from "https://deno.land/x/[email protected].1/mod.ts";
217+
// import { zip } from "https://deno.land/x/[email protected].2/mod.ts";
218218
// or only import zip
219-
// import { zip } from "https://deno.land/x/[email protected].1/zip/mod.ts";
219+
// import { zip } from "https://deno.land/x/[email protected].2/zip/mod.ts";
220220

221221
export interface compressInterface {
222222
excludeSrc?: boolean; // does not contain the src directory
@@ -234,7 +234,7 @@ zip.uncompress(src, dest, options?: uncompressInterface): Promise<void>;
234234
```ts
235235
import { zip } from "jsr:@deno-library/compress";
236236
// or
237-
// import { zip } from "https://deno.land/x/[email protected].1/mod.ts";
237+
// import { zip } from "https://deno.land/x/[email protected].2/mod.ts";
238238
// compress folder
239239
await zip.compress("./test", "./test.tar.gz");
240240
// compress folder, exclude src directory

changelog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
## Changelog
22

3+
### v0.5.2 - 2024.11.6
4+
5+
- docs: Add symbol documentation to existing interfaces
6+
37
### v0.5.1 - 2024.11.6
48

59
- refactor(zip): Use `zip-js` instead of using a terminal

interface.ts

Lines changed: 39 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,43 @@
1+
/**
2+
* Configuration interface for compression operations.
3+
*
4+
* @interface compressInterface
5+
*/
16
export interface compressInterface {
2-
excludeSrc?: boolean; // does not contain the src directory
3-
debug?: boolean; // list the files and folders
7+
/**
8+
* Specifies whether to exclude the source directory from the compression.
9+
* If set to true, the `src` directory will not be included in the compressed output.
10+
* By default, the `src` directory is included.
11+
*
12+
* @type {boolean}
13+
* @memberof compressInterface
14+
*/
15+
excludeSrc?: boolean;
16+
17+
/**
18+
* Specifies whether to enable debug mode.
19+
* In debug mode, all files and folders being processed will be listed.
20+
* By default, no such information is displayed.
21+
*
22+
* @type {boolean}
23+
* @memberof compressInterface
24+
*/
25+
debug?: boolean;
426
}
527

28+
/**
29+
* Configuration interface for uncompression (decompression) operations.
30+
*
31+
* @interface uncompressInterface
32+
*/
633
export interface uncompressInterface {
7-
debug?: boolean; // list the files and folders
8-
}
34+
/**
35+
* Specifies whether to enable debug mode.
36+
* In debug mode, all files and folders being processed will be listed.
37+
* By default, no such information is displayed.
38+
*
39+
* @type {boolean}
40+
* @memberof uncompressInterface
41+
*/
42+
debug?: boolean;
43+
}

zip_archive/archive.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ export async function uncompress(
3535
}
3636
}
3737

38+
/**
39+
* Compresses a file.
40+
* @param {string} src - Source file path.
41+
* @param {string} dest - Destination file path.
42+
* @param {compressInterface} [options] - Optional parameters.
43+
*/
3844
export async function compress(
3945
src: string,
4046
dest: string,

zlib/deflate.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@ export interface DeflateOptions {
2222
header?: zlibDeflate.Header; // Custom header
2323
}
2424

25+
/**
26+
* Required Options for the Deflate class.
27+
*/
2528
interface DeflateOptionsRequired {
2629
level: number;
2730
method: number;

0 commit comments

Comments
 (0)