File tree Expand file tree Collapse file tree
packages/@d-zero/filematch Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -55,6 +55,41 @@ https://example.com/test1.js https://example.com/test2.js
5555npx @d-zero/filematch -f list.txt
5656```
5757
58+ ## API
59+
60+ このパッケージはAPIとしても使用できます。
61+
62+ ### 基本的な使い方
63+
64+ ``` typescript
65+ import { compare } from ' @d-zero/filematch' ;
66+
67+ // 2つのファイルパスまたはURLを比較
68+ const result = await compare (' ./test1.pdf' , ' ./test2.pdf' );
69+ console .log (result ); // true または false
70+ ```
71+
72+ ### 進捗の監視
73+
74+ ``` typescript
75+ import { compare } from ' @d-zero/filematch' ;
76+
77+ const result = await compare (' ./test1.pdf' , ' ./test2.pdf' , (progress ) => {
78+ // progress は 0.0 から 1.0 の間の値
79+ console .log (` 進捗: ${(progress * 100 ).toFixed (2 )}% ` );
80+ });
81+ ```
82+
83+ ### 型定義
84+
85+ ``` typescript
86+ import type { OnProgress } from ' @d-zero/filematch' ;
87+
88+ const onProgress: OnProgress = (progress ) => {
89+ console .log (` 進捗: ${progress } ` );
90+ };
91+ ```
92+
5893## 動作環境
5994
6095- Node.js 20.11以降
Original file line number Diff line number Diff line change 88 "access" : " public"
99 },
1010 "type" : " module" ,
11+ "main" : " ./dist/index.js" ,
12+ "types" : " ./dist/index.d.ts" ,
13+ "exports" : {
14+ "." : {
15+ "import" : " ./dist/index.js" ,
16+ "types" : " ./dist/index.d.ts"
17+ }
18+ },
1119 "bin" : " ./dist/cli.js" ,
1220 "files" : [
1321 " dist"
Original file line number Diff line number Diff line change 1+ export { compare } from './compare.js' ;
2+ export type { OnProgress } from './types.js' ;
You can’t perform that action at this time.
0 commit comments