refactor(stream): move streams to new package

This commit is contained in:
Simon Chan 2022-06-11 13:38:38 +08:00
parent ce8f062e96
commit 6887d8549f
87 changed files with 985 additions and 811 deletions

View file

@ -1,6 +1,7 @@
import Struct from "@yume-chan/struct";
import { BufferedStream } from '@yume-chan/stream-extra';
import Struct from '@yume-chan/struct';
import type { Adb } from '../adb.js';
import { AdbBufferedStream } from '../stream/index.js';
const Version =
new Struct({ littleEndian: true })
@ -60,7 +61,7 @@ export type AdbFrameBuffer = AdbFrameBufferV1 | AdbFrameBufferV2;
export async function framebuffer(adb: Adb): Promise<AdbFrameBuffer> {
const socket = await adb.createSocket('framebuffer:');
const stream = new AdbBufferedStream(socket);
const stream = new BufferedStream(socket.readable);
const { version } = await Version.deserialize(stream);
switch (version) {
case 1: