/
quickbms.ts
47 lines (45 loc) · 961 Bytes
/
quickbms.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
import { spawn } from "../utils"
export interface QuickbmsArgs {
exe?: string
input: string
script: string
output: string
filter?: string[]
// list the files without extracting them
list?: boolean
// overwrite the output files without confirmation if they already exist
overwrite?: boolean
}
export async function quickbms({
exe,
input,
output,
script,
list,
filter,
overwrite,
}: QuickbmsArgs) {
// https://github.com/new-world-tools/new-world-tools
const tool = exe || 'quickbms.exe'
// quickbms.exe
// [options]
// <script.BMS>
// <input_archive/folder>
// [output_folder]
const args = []
if (list) {
args.push('-l')
}
if (filter?.length) {
args.push('-f', filter.join(';'))
}
if (overwrite) {
args.push('-o')
}
args.push(script)
args.push(input)
args.push(output)
await spawn(tool, args, {
stdio: 'inherit',
})
}