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