(exportContent: ExportedVault, options: OptionValues)
| 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 |
no test coverage detected