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

Method saveFile

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

Source from the content-addressed store, hash-verified

92 }
93
94 private async saveFile(exportContent: ExportedVault, options: OptionValues): Promise<Response> {
95 try {
96 if (exportContent.type === "application/zip") {
97 exportContent = exportContent as ExportedVaultAsBlob;
98 const arrayBuffer = await exportContent.data.arrayBuffer();
99 const buffer = Buffer.from(arrayBuffer);
100 return await CliUtils.saveResultToFile(buffer, options.output, exportContent.fileName);
101 }
102
103 return await CliUtils.saveResultToFile(
104 exportContent.data,
105 options.output,
106 exportContent.fileName,
107 );
108 } catch (e) {
109 return Response.error(e.toString());
110 }
111 }
112
113 private async promptPassword(password: string | boolean) {
114 // 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