instantiate bert in port

This commit is contained in:
Moon Man 2024-01-28 10:45:09 -05:00
parent cca106a321
commit 22ed1edbcc
3 changed files with 6 additions and 5 deletions

2
dist/main.d.ts vendored
View File

@ -5,7 +5,7 @@ import { Duplex } from "node:stream";
type WriteCallback = (error: Error | null | undefined) => void;
export declare class Port extends Duplex {
readonly bert: Bert;
constructor(bert: Bert);
constructor(allBinariesAsString?: boolean, mapKeyAsAtom?: boolean, decodeUndefinedValues?: boolean);
_read(): void;
_write(obj: any, encodingOrCallback?: BufferEncoding | WriteCallback, callback?: WriteCallback | undefined): boolean;
}

5
dist/main.js vendored
View File

@ -1,9 +1,10 @@
import { Bert } from "./bert.js";
import { Duplex } from "node:stream";
export class Port extends Duplex {
bert;
constructor(bert) {
constructor(allBinariesAsString, mapKeyAsAtom, decodeUndefinedValues) {
super({ objectMode: true });
this.bert = bert;
this.bert = new Bert(allBinariesAsString, mapKeyAsAtom, decodeUndefinedValues);
}
_read() {
const lenBytes = process.stdin.read(4);

View File

@ -6,9 +6,9 @@ type WriteCallback = (error: Error | null | undefined) => void;
export class Port extends Duplex {
public readonly bert: Bert;
constructor(bert: Bert) {
constructor(allBinariesAsString?: boolean, mapKeyAsAtom?: boolean, decodeUndefinedValues?: boolean) {
super({ objectMode: true });
this.bert = bert;
this.bert = new Bert(allBinariesAsString, mapKeyAsAtom, decodeUndefinedValues);
}
_read() {