-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
zhangfuxing
committed
Nov 18, 2024
1 parent
e18ddc9
commit c6c0fd3
Showing
12 changed files
with
301 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
name: Publish | ||
on: | ||
push: | ||
branches: | ||
- master | ||
|
||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
|
||
permissions: | ||
contents: read | ||
id-token: write | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- name: Publish package | ||
run: npx jsr publish |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
# unrar | ||
|
||
[![JSR Version](https://jsr.io/badges/@deno-library/unrar)](https://jsr.io/@deno-library/unrar) | ||
|
||
uncompress rar file for deno | ||
|
||
## Useage | ||
* upcompress all | ||
```js | ||
// Simply get an instance of UnrarAll | ||
import unrar from "https://deno.land/x/[email protected]/mod.ts"; | ||
import unrar from "jsr:@deno-library/unrar" // or "https://deno.land/x/[email protected]/mod.ts"; | ||
// Equal to: | ||
import { UnrarAll } from "https://deno.land/x/unrar@v1.0.1/mod.ts"; | ||
import { UnrarAll } from "jsr:@deno-library/unrar" | ||
const unrar = new UnrarAll(); | ||
// If you do not want to use the default bin (the default bin only supports Windows) | ||
import { UnrarAll } from "https://deno.land/x/unrar@v1.0.1/mod.ts"; | ||
import { UnrarAll } from "jsr:@deno-library/unrar" | ||
const unrar = new UnrarAll(bin: "/x/.../UnRAR.exe"); | ||
|
||
const src = './test/password.rar'; | ||
|
@@ -36,7 +39,7 @@ const switches = ['-o+', '-idcd']; | |
* uncompress part | ||
more exmaple in test folder | ||
```ts | ||
import { Unrar } from "https://deno.land/x/unrar@v1.0.1/mod.ts"; | ||
import { Unrar } from "jsr:@deno-library/unrar" | ||
const src = './test/test.rar'; | ||
const dest = './test'; | ||
const uncompressedFile = './test/test2.txt'; | ||
|
@@ -98,19 +101,35 @@ export default new UnrarAll(); | |
|
||
* uncompress part | ||
```ts | ||
interface constuctorOptions { | ||
/** | ||
* Options for the Unrar constructor. | ||
*/ | ||
interface ConstructorOptions { | ||
/** | ||
* Path to the UnRAR executable. | ||
*/ | ||
bin?: string; | ||
/** | ||
* Password for the RAR archive. | ||
*/ | ||
password?: string; | ||
} | ||
|
||
interface uncompressOptions { | ||
newName?: string | ||
/** | ||
* Options for the uncompress method. | ||
*/ | ||
interface UncompressOptions { | ||
/** | ||
* New name for the extracted file. | ||
*/ | ||
newName?: string; | ||
} | ||
|
||
|
||
interface Unrar { | ||
constructor(filepath: string, options?: constuctorOptions); | ||
constructor(filepath: string, options?: ConstructorOptions); | ||
async list(): Promise<FileInfo[]>; | ||
async uncompress(fileInfo: FileInfo, destDir: string, options?: uncompressOptions): Promise<void>; | ||
async uncompress(fileInfo: FileInfo, destDir: string, options?: UncompressOptions): Promise<void>; | ||
on(event: "progress", listener: (percent: string) => void): this; | ||
} | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"name": "@deno-library/template", | ||
"version": "1.0.0", | ||
"exports": "./mod.ts" | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
export { default as EventEmitter } from "https://deno.land/x/events/mod.ts"; | ||
export { EventEmitter } from "node:events"; | ||
export { exists } from "jsr:@std/[email protected]"; | ||
export { writeAll } from "jsr:@std/[email protected]"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.