refactor: switch to using Bun (#718)
This commit is contained in:
@@ -2,31 +2,31 @@ import { Utils } from "@meshtastic/core";
|
||||
import type { Types } from "@meshtastic/core";
|
||||
|
||||
export class TransportDeno implements Types.Transport {
|
||||
private _toDevice: WritableStream<Uint8Array>;
|
||||
private _fromDevice: ReadableStream<Types.DeviceOutput>;
|
||||
private _toDevice: WritableStream<Uint8Array>;
|
||||
private _fromDevice: ReadableStream<Types.DeviceOutput>;
|
||||
|
||||
public static async create(hostname: string): Promise<TransportDeno> {
|
||||
const connection = await Deno.connect({
|
||||
hostname,
|
||||
port: 4403,
|
||||
});
|
||||
return new TransportDeno(connection);
|
||||
}
|
||||
public static async create(hostname: string): Promise<TransportDeno> {
|
||||
const connection = await Deno.connect({
|
||||
hostname,
|
||||
port: 4403,
|
||||
});
|
||||
return new TransportDeno(connection);
|
||||
}
|
||||
|
||||
constructor(connection: Deno.Conn) {
|
||||
Utils.toDeviceStream.readable.pipeTo(connection.writable);
|
||||
constructor(connection: Deno.Conn) {
|
||||
Utils.toDeviceStream.readable.pipeTo(connection.writable);
|
||||
|
||||
this._toDevice = Utils.toDeviceStream.writable;
|
||||
this._fromDevice = connection.readable.pipeThrough(
|
||||
Utils.fromDeviceStream(),
|
||||
);
|
||||
}
|
||||
this._toDevice = Utils.toDeviceStream.writable;
|
||||
this._fromDevice = connection.readable.pipeThrough(
|
||||
Utils.fromDeviceStream(),
|
||||
);
|
||||
}
|
||||
|
||||
get toDevice(): WritableStream<Uint8Array> {
|
||||
return this._toDevice;
|
||||
}
|
||||
get toDevice(): WritableStream<Uint8Array> {
|
||||
return this._toDevice;
|
||||
}
|
||||
|
||||
get fromDevice(): ReadableStream<Types.DeviceOutput> {
|
||||
return this._fromDevice;
|
||||
}
|
||||
get fromDevice(): ReadableStream<Types.DeviceOutput> {
|
||||
return this._fromDevice;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user