Skip to content

Commit 0ead0a3

Browse files
committed
Fix PolicyDumper.writeXlsx
Do FS work ourselves since the library couldn't figure it out
1 parent 31498c2 commit 0ead0a3

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/components/authorization/policy/executor/policy-dumper.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import Table from 'cli-table3';
1616
import { startCase } from 'lodash';
1717
import { DateTime } from 'luxon';
1818
import { Command, Console } from 'nestjs-console';
19+
import fs from 'node:fs/promises';
1920
import { keys as keysOf } from 'ts-transformer-keys';
2021
import { LiteralUnion } from 'type-fest';
2122
import { inspect } from 'util';
@@ -63,7 +64,8 @@ export class PolicyDumper {
6364
xlsx.utils.book_append_sheet(book, sheet, startCase(role).slice(0, 31));
6465
}
6566

66-
xlsx.writeFile(book, filename ?? 'permissions.xlsx');
67+
const buffer: Buffer = xlsx.write(book, { type: 'buffer' });
68+
await fs.writeFile(filename ?? 'permissions.xlsx', buffer);
6769
}
6870

6971
@Command({

0 commit comments

Comments
 (0)