1
0
mirror of https://github.com/bitwarden/cli synced 2025-12-16 00:03:23 +00:00

Export to stdout (#152)

* describe file-saving and add helper to write to stdout if appropriate

* allow writing attachments to stdout

* allow writing export to stdout

* add help texts for export and get
This commit is contained in:
Andreas Schneider
2020-08-25 20:24:43 +02:00
committed by GitHub
parent 9f72e0e316
commit f2530c133e
4 changed files with 52 additions and 13 deletions

View File

@@ -283,10 +283,7 @@ export class GetCommand {
const key = attachments[0].key != null ? attachments[0].key :
await this.cryptoService.getOrgKey(cipher.organizationId);
const decBuf = await this.cryptoService.decryptFromBytes(buf, key);
const filePath = await CliUtils.saveFile(Buffer.from(decBuf), cmd.output, attachments[0].fileName);
const res = new MessageResponse('Saved ' + filePath, null);
res.raw = filePath;
return Response.success(res);
return await CliUtils.saveResultToFile(Buffer.from(decBuf), cmd.output, attachments[0].fileName);
} catch (e) {
if (typeof (e) === 'string') {
return Response.error(e);