MCPcopy Create free account
hub / github.com/WICG/webpackage / getOutputPath

Function getOutputPath

js/sign/src/cli-sign.ts:27–45  ·  view source on GitHub ↗
(
  bundlePath: string,
  options: { inPlace?: boolean; output?: string }
)

Source from the content-addressed store, hash-verified

25
26// Get output file path depending on options: bundle path if in-place and provided path otherwise.
27function 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.
48async function parseRemovalKey(keyInput: string): Promise<Uint8Array> {

Callers 1

parseArgumentsFunction · 0.85

Calls 1

warnLogFunction · 0.90

Tested by

no test coverage detected