Skip to content

Commit 6ad6b9d

Browse files
costleyaElad Ben-Israel
authored and
Elad Ben-Israel
committed
fix(jsii-runtime): Use buffer factory methods instead of constructor. (#246)
Guidance from https://nodejs.org/en/docs/guides/buffer-constructor-deprecation/
1 parent 828a26f commit 6ad6b9d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

packages/jsii-runtime/lib/sync-stdio.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -7,22 +7,22 @@ const INPUT_BUFFER_SIZE = 1024 * 1024; // not related to max line length
77

88
export class SyncStdio {
99
private inputQueue = new Array<string>();
10-
private currentLine = ''
10+
private currentLine = '';
1111

1212
writeErrorLine(line: string) {
13-
this.writeBuffer(new Buffer(`${line}\n`), STDERR_FD);
13+
this.writeBuffer(Buffer.from(`${line}\n`), STDERR_FD);
1414
}
1515

1616
writeLine(line: string) {
17-
this.writeBuffer(new Buffer(`${line}\n`), STDOUT_FD);
17+
this.writeBuffer(Buffer.from(`${line}\n`), STDOUT_FD);
1818
}
1919

2020
readLine(): string | undefined {
2121
if (this.inputQueue.length > 0) {
2222
return this.inputQueue.shift();
2323
}
2424

25-
const buff = new Buffer(INPUT_BUFFER_SIZE);
25+
const buff = Buffer.alloc(INPUT_BUFFER_SIZE);
2626
const read = fs.readSync(STDIN_FD, buff, 0, buff.length, null);
2727

2828
if (read === 0) {

0 commit comments

Comments
 (0)