(
bundlePath: string,
options: { inPlace?: boolean; output?: string }
)
| 25 | |
| 26 | // Get output file path depending on options: bundle path if in-place and provided path otherwise. |
| 27 | function getOutputPath( |
| 28 | bundlePath: string, |
| 29 | options: { inPlace?: boolean; output?: string } |
| 30 | ) { |
| 31 | if (options.inPlace && options.output != null) { |
| 32 | throw new Error( |
| 33 | "Options '--in-place' and '--output' are mutually exclusive." |
| 34 | ); |
| 35 | } |
| 36 | if (!options.inPlace && options.output == null) { |
| 37 | throw new Error("One of '--in-place' and '--output' options must be used."); |
| 38 | } |
| 39 | if (options?.output && fs.existsSync(options.output)) { |
| 40 | warnLog( |
| 41 | `The file in output path ${options.output} already exists. Overwriting.` |
| 42 | ); |
| 43 | } |
| 44 | return options.output ?? bundlePath; |
| 45 | } |
| 46 | |
| 47 | // That key may be either provided by Bytes encoded in base64 or path to file with key. This function checks that and parses key. |
| 48 | async function parseRemovalKey(keyInput: string): Promise<Uint8Array> { |
no test coverage detected