MCPcopy Create free account
hub / github.com/bitwarden/clients / saveFile

Method saveFile

apps/cli/src/tools/export.command.ts:96–113  ·  view source on GitHub ↗
(exportContent: ExportedVault, options: OptionValues)

Source from the content-addressed store, hash-verified

94 }
95
96 private async saveFile(exportContent: ExportedVault, options: OptionValues): Promise<Response> {
97 try {
98 if (exportContent.type === "application/zip") {
99 exportContent = exportContent as ExportedVaultAsBlob;
100 const arrayBuffer = await exportContent.data.arrayBuffer();
101 const buffer = Buffer.from(arrayBuffer);
102 return await CliUtils.saveResultToFile(buffer, options.output, exportContent.fileName);
103 }
104
105 return await CliUtils.saveResultToFile(
106 exportContent.data,
107 options.output,
108 exportContent.fileName,
109 );
110 } catch (e) {
111 return Response.error(e.toString());
112 }
113 }
114
115 private async promptPassword(password: string | boolean) {
116 // boolean => flag set with no value, we need to prompt for password

Callers 1

runMethod · 0.95

Calls 4

saveResultToFileMethod · 0.80
errorMethod · 0.65
toStringMethod · 0.65
fromMethod · 0.45

Tested by

no test coverage detected