@yume-chan/scrcpy 0.0.13 → 0.0.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/CHANGELOG.json +45 -0
  2. package/CHANGELOG.md +25 -1
  3. package/LICENSE +21 -21
  4. package/README.md +90 -89
  5. package/bin/scrcpy-server +0 -0
  6. package/bin/version.d.ts +1 -1
  7. package/bin/version.js +1 -1
  8. package/esm/client.d.ts +14 -2
  9. package/esm/client.d.ts.map +1 -1
  10. package/esm/client.js +275 -143
  11. package/esm/client.js.map +1 -1
  12. package/esm/connection.d.ts.map +1 -1
  13. package/esm/connection.js +74 -86
  14. package/esm/connection.js.map +1 -1
  15. package/esm/decoder/tinyh264/index.js +48 -48
  16. package/esm/decoder/tinyh264/index.js.map +1 -1
  17. package/esm/decoder/tinyh264/wrapper.js +3 -2
  18. package/esm/decoder/tinyh264/wrapper.js.map +1 -1
  19. package/esm/decoder/web-codecs/index.js +26 -21
  20. package/esm/decoder/web-codecs/index.js.map +1 -1
  21. package/esm/message.d.ts +13 -8
  22. package/esm/message.d.ts.map +1 -1
  23. package/esm/message.js +14 -8
  24. package/esm/message.js.map +1 -1
  25. package/esm/options/1_16/index.d.ts +8 -4
  26. package/esm/options/1_16/index.d.ts.map +1 -1
  27. package/esm/options/1_16/index.js +44 -18
  28. package/esm/options/1_16/index.js.map +1 -1
  29. package/esm/options/1_16/sps.js +3 -2
  30. package/esm/options/1_16/sps.js.map +1 -1
  31. package/esm/options/1_18.d.ts +3 -2
  32. package/esm/options/1_18.d.ts.map +1 -1
  33. package/esm/options/1_18.js +24 -1
  34. package/esm/options/1_18.js.map +1 -1
  35. package/esm/options/1_21.js +4 -1
  36. package/esm/options/1_21.js.map +1 -1
  37. package/esm/options/1_22.d.ts +3 -3
  38. package/esm/options/1_22.d.ts.map +1 -1
  39. package/esm/options/1_22.js +9 -6
  40. package/esm/options/1_22.js.map +1 -1
  41. package/esm/options/1_23.js +4 -1
  42. package/esm/options/1_23.js.map +1 -1
  43. package/esm/options/1_24.d.ts +9 -0
  44. package/esm/options/1_24.d.ts.map +1 -0
  45. package/esm/options/1_24.js +13 -0
  46. package/esm/options/1_24.js.map +1 -0
  47. package/esm/options/common.d.ts +2 -0
  48. package/esm/options/common.d.ts.map +1 -1
  49. package/esm/options/common.js.map +1 -1
  50. package/esm/options/index.d.ts +1 -0
  51. package/esm/options/index.d.ts.map +1 -1
  52. package/esm/options/index.js +1 -0
  53. package/esm/options/index.js.map +1 -1
  54. package/esm/push-server.js +5 -10
  55. package/esm/push-server.js.map +1 -1
  56. package/package.json +8 -8
  57. package/scrcpy.LICENSE +203 -203
  58. package/scripts/fetch-server.cjs +28 -28
  59. package/src/client.ts +435 -275
  60. package/src/codec.ts +35 -35
  61. package/src/connection.ts +148 -145
  62. package/src/decoder/index.ts +3 -3
  63. package/src/decoder/tinyh264/index.ts +112 -112
  64. package/src/decoder/tinyh264/types.d.ts +137 -137
  65. package/src/decoder/tinyh264/worker.ts +2 -2
  66. package/src/decoder/tinyh264/wrapper.ts +89 -89
  67. package/src/decoder/types.ts +35 -35
  68. package/src/decoder/web-codecs/index.ts +99 -99
  69. package/src/index.ts +8 -8
  70. package/src/message.ts +113 -105
  71. package/src/options/1_16/index.ts +345 -315
  72. package/src/options/1_16/sps.ts +300 -300
  73. package/src/options/1_18.ts +61 -41
  74. package/src/options/1_21.ts +34 -34
  75. package/src/options/1_22.ts +78 -80
  76. package/src/options/1_24.ts +18 -0
  77. package/src/options/common.ts +66 -63
  78. package/src/options/index.ts +7 -6
  79. package/src/push-server.ts +24 -24
  80. package/src/utils.ts +5 -5
@@ -1,41 +1,61 @@
1
- import Struct, { placeholder } from "@yume-chan/struct";
2
- import type { AndroidKeyEventAction } from "../message.js";
3
- import { ScrcpyBackOrScreenOnEvent1_16, ScrcpyOptions1_16, type ScrcpyOptionsInit1_16 } from "./1_16/index.js";
4
-
5
- export interface ScrcpyOptionsInit1_18 extends ScrcpyOptionsInit1_16 {
6
- powerOffOnClose: boolean;
7
- }
8
-
9
- export const ScrcpyBackOrScreenOnEvent1_18 =
10
- new Struct()
11
- .fields(ScrcpyBackOrScreenOnEvent1_16)
12
- .uint8('action', placeholder<AndroidKeyEventAction>());
13
-
14
- export type ScrcpyBackOrScreenOnEvent1_18 = typeof ScrcpyBackOrScreenOnEvent1_18["TInit"];
15
-
16
- export class ScrcpyOptions1_18<T extends ScrcpyOptionsInit1_18 = ScrcpyOptionsInit1_18> extends ScrcpyOptions1_16<T> {
17
- constructor(value: Partial<ScrcpyOptionsInit1_18>) {
18
- super(value);
19
- }
20
-
21
- protected override getArgumentOrder(): (keyof T)[] {
22
- return super.getArgumentOrder().concat(['powerOffOnClose']);
23
- }
24
-
25
- protected override getDefaultValue(): T {
26
- return {
27
- ...super.getDefaultValue(),
28
- powerOffOnClose: false,
29
- };
30
- }
31
-
32
- public override getOutputEncoderNameRegex(): RegExp {
33
- return /\s+scrcpy --encoder '(.*?)'/;
34
- }
35
-
36
- public override serializeBackOrScreenOnControlMessage(
37
- message: ScrcpyBackOrScreenOnEvent1_18,
38
- ) {
39
- return ScrcpyBackOrScreenOnEvent1_18.serialize(message);
40
- }
41
- }
1
+ import Struct, { placeholder } from "@yume-chan/struct";
2
+ import { AndroidKeyEventAction, ScrcpyControlMessageType } from "../message.js";
3
+ import { ScrcpyBackOrScreenOnEvent1_16, ScrcpyOptions1_16, type ScrcpyOptionsInit1_16 } from "./1_16/index.js";
4
+
5
+ export interface ScrcpyOptionsInit1_18 extends ScrcpyOptionsInit1_16 {
6
+ powerOffOnClose: boolean;
7
+ }
8
+
9
+ export const ScrcpyBackOrScreenOnEvent1_18 =
10
+ new Struct()
11
+ .fields(ScrcpyBackOrScreenOnEvent1_16)
12
+ .uint8('action', placeholder<AndroidKeyEventAction>());
13
+
14
+ export type ScrcpyBackOrScreenOnEvent1_18 = typeof ScrcpyBackOrScreenOnEvent1_18["TInit"];
15
+
16
+ export class ScrcpyOptions1_18<T extends ScrcpyOptionsInit1_18 = ScrcpyOptionsInit1_18> extends ScrcpyOptions1_16<T> {
17
+ constructor(value: Partial<ScrcpyOptionsInit1_18>) {
18
+ super(value);
19
+ }
20
+
21
+ protected override getArgumentOrder(): (keyof T)[] {
22
+ return super.getArgumentOrder().concat(['powerOffOnClose']);
23
+ }
24
+
25
+ protected override getDefaultValue(): T {
26
+ return {
27
+ ...super.getDefaultValue(),
28
+ powerOffOnClose: false,
29
+ };
30
+ }
31
+
32
+ public override getOutputEncoderNameRegex(): RegExp {
33
+ return /\s+scrcpy --encoder '(.*?)'/;
34
+ }
35
+
36
+ public override getControlMessageTypes(): ScrcpyControlMessageType[] {
37
+ /**
38
+ * 0 InjectKeycode
39
+ * 1 InjectText
40
+ * 2 InjectTouch
41
+ * 3 InjectScroll
42
+ * 4 BackOrScreenOn
43
+ * 5 ExpandNotificationPanel
44
+ * 6 ExpandSettingsPanel
45
+ * 7 CollapseNotificationPanel
46
+ * 8 GetClipboard
47
+ * 9 SetClipboard
48
+ * 10 SetScreenPowerMode
49
+ * 11 RotateDevice
50
+ */
51
+ const types = super.getControlMessageTypes();
52
+ types.splice(6, 0, ScrcpyControlMessageType.ExpandSettingPanel);
53
+ return types;
54
+ }
55
+
56
+ public override serializeBackOrScreenOnControlMessage(
57
+ message: ScrcpyBackOrScreenOnEvent1_18,
58
+ ) {
59
+ return ScrcpyBackOrScreenOnEvent1_18.serialize(message);
60
+ }
61
+ }
@@ -1,34 +1,34 @@
1
- // cspell: ignore autosync
2
-
3
- import { ScrcpyOptions1_18, type ScrcpyOptionsInit1_18 } from './1_18.js';
4
- import { toScrcpyOptionValue } from "./common.js";
5
-
6
- export interface ScrcpyOptionsInit1_21 extends ScrcpyOptionsInit1_18 {
7
- clipboardAutosync?: boolean;
8
- }
9
-
10
- function toSnakeCase(input: string): string {
11
- return input.replace(/([A-Z])/g, '_$1').toLowerCase();
12
- }
13
-
14
- export class ScrcpyOptions1_21<T extends ScrcpyOptionsInit1_21 = ScrcpyOptionsInit1_21> extends ScrcpyOptions1_18<T> {
15
- public constructor(init: Partial<ScrcpyOptionsInit1_21>) {
16
- super(init);
17
- }
18
-
19
- protected override getDefaultValue(): T {
20
- return {
21
- ...super.getDefaultValue(),
22
- clipboardAutosync: true,
23
- };
24
- }
25
-
26
- public override formatServerArguments(): string[] {
27
- // 1.21 changed the format of arguments
28
- // So `getArgumentOrder()` is no longer needed
29
- return Object.entries(this.value)
30
- .map(([key, value]) => [key, toScrcpyOptionValue(value, undefined)] as const)
31
- .filter((pair): pair is [string, string] => pair[1] !== undefined)
32
- .map(([key, value]) => `${toSnakeCase(key)}=${value}`);
33
- }
34
- }
1
+ // cspell: ignore autosync
2
+
3
+ import { ScrcpyOptions1_18, type ScrcpyOptionsInit1_18 } from './1_18.js';
4
+ import { toScrcpyOptionValue } from "./common.js";
5
+
6
+ export interface ScrcpyOptionsInit1_21 extends ScrcpyOptionsInit1_18 {
7
+ clipboardAutosync?: boolean;
8
+ }
9
+
10
+ function toSnakeCase(input: string): string {
11
+ return input.replace(/([A-Z])/g, '_$1').toLowerCase();
12
+ }
13
+
14
+ export class ScrcpyOptions1_21<T extends ScrcpyOptionsInit1_21 = ScrcpyOptionsInit1_21> extends ScrcpyOptions1_18<T> {
15
+ public constructor(init: Partial<ScrcpyOptionsInit1_21>) {
16
+ super(init);
17
+ }
18
+
19
+ protected override getDefaultValue(): T {
20
+ return {
21
+ ...super.getDefaultValue(),
22
+ clipboardAutosync: true,
23
+ };
24
+ }
25
+
26
+ public override formatServerArguments(): string[] {
27
+ // 1.21 changed the format of arguments
28
+ // So `getArgumentOrder()` is no longer needed
29
+ return Object.entries(this.value)
30
+ .map(([key, value]) => [key, toScrcpyOptionValue(value, undefined)] as const)
31
+ .filter((pair): pair is [string, string] => pair[1] !== undefined)
32
+ .map(([key, value]) => `${toSnakeCase(key)}=${value}`);
33
+ }
34
+ }
@@ -1,80 +1,78 @@
1
- import type { Adb } from "@yume-chan/adb";
2
- import Struct from "@yume-chan/struct";
3
- import { ScrcpyClientForwardConnection, ScrcpyClientReverseConnection, type ScrcpyClientConnection, type ScrcpyClientConnectionOptions } from "../connection.js";
4
- import { ScrcpyInjectScrollControlMessage1_16 } from "./1_16/index.js";
5
- import { ScrcpyOptions1_21, type ScrcpyOptionsInit1_21 } from "./1_21.js";
6
-
7
- export interface ScrcpyOptionsInit1_22 extends ScrcpyOptionsInit1_21 {
8
- downsizeOnError: boolean;
9
-
10
- /**
11
- * Send device name and size
12
- *
13
- * @default true
14
- */
15
- sendDeviceMeta: boolean;
16
-
17
- /**
18
- * Write a byte on start to detect connection issues
19
- *
20
- * @default true
21
- */
22
- sendDummyByte: boolean;
23
-
24
- /**
25
- * Implies `sendDeviceMeta: false`, `sendFrameMeta: false` and `sendDummyByte: false`
26
- *
27
- * @default false
28
- */
29
- rawVideoStream: boolean;
30
- }
31
-
32
- export const ScrcpyInjectScrollControlMessage1_22 =
33
- new Struct()
34
- .fields(ScrcpyInjectScrollControlMessage1_16)
35
- .int32("buttons");
36
-
37
- export type ScrcpyInjectScrollControlMessage1_22 = typeof ScrcpyInjectScrollControlMessage1_22["TInit"];
38
-
39
- export class ScrcpyOptions1_22<T extends ScrcpyOptionsInit1_22 = ScrcpyOptionsInit1_22> extends ScrcpyOptions1_21<T> {
40
- public constructor(init: Partial<ScrcpyOptionsInit1_22>) {
41
- if (init.rawVideoStream) {
42
- // Set implied options for client-side processing
43
- init.sendDeviceMeta = false;
44
- init.sendFrameMeta = false;
45
- init.sendDummyByte = false;
46
- }
47
-
48
- super(init);
49
- }
50
-
51
- protected override getDefaultValue(): T {
52
- return {
53
- ...super.getDefaultValue(),
54
- downsizeOnError: true,
55
- sendDeviceMeta: true,
56
- sendDummyByte: true,
57
- rawVideoStream: false,
58
- };
59
- }
60
-
61
- public override createConnection(device: Adb): ScrcpyClientConnection {
62
- const defaultValue = this.getDefaultValue();
63
- const options: ScrcpyClientConnectionOptions = {
64
- control: this.value.control ?? defaultValue.control,
65
- sendDummyByte: this.value.sendDummyByte ?? defaultValue.sendDummyByte,
66
- sendDeviceMeta: this.value.sendDeviceMeta ?? defaultValue.sendDeviceMeta,
67
- };
68
- if (this.value.tunnelForward) {
69
- return new ScrcpyClientForwardConnection(device, options);
70
- } else {
71
- return new ScrcpyClientReverseConnection(device, options);
72
- }
73
- }
74
-
75
- public override serializeInjectScrollControlMessage(
76
- message: ScrcpyInjectScrollControlMessage1_22,
77
- ): Uint8Array {
78
- return ScrcpyInjectScrollControlMessage1_22.serialize(message);
79
- }
80
- }
1
+ import type { Adb } from "@yume-chan/adb";
2
+ import Struct from "@yume-chan/struct";
3
+ import { ScrcpyClientForwardConnection, ScrcpyClientReverseConnection, type ScrcpyClientConnection } from "../connection.js";
4
+ import { ScrcpyInjectScrollControlMessage1_16 } from "./1_16/index.js";
5
+ import { ScrcpyOptions1_21, type ScrcpyOptionsInit1_21 } from "./1_21.js";
6
+
7
+ export interface ScrcpyOptionsInit1_22 extends ScrcpyOptionsInit1_21 {
8
+ downsizeOnError: boolean;
9
+
10
+ /**
11
+ * Send device name and size at start of video stream.
12
+ *
13
+ * @default true
14
+ */
15
+ sendDeviceMeta: boolean;
16
+
17
+ /**
18
+ * Send a `0` byte on start of video stream to detect connection issues
19
+ *
20
+ * @default true
21
+ */
22
+ sendDummyByte: boolean;
23
+
24
+ /**
25
+ * Implies `sendDeviceMeta: false`, `sendFrameMeta: false` and `sendDummyByte: false`
26
+ *
27
+ * @default false
28
+ */
29
+ rawVideoStream: boolean;
30
+ }
31
+
32
+ export const ScrcpyInjectScrollControlMessage1_22 =
33
+ new Struct()
34
+ .fields(ScrcpyInjectScrollControlMessage1_16)
35
+ .int32("buttons");
36
+
37
+ export type ScrcpyInjectScrollControlMessage1_22 = typeof ScrcpyInjectScrollControlMessage1_22["TInit"];
38
+
39
+ export class ScrcpyOptions1_22<T extends ScrcpyOptionsInit1_22 = ScrcpyOptionsInit1_22> extends ScrcpyOptions1_21<T> {
40
+ public constructor(init: Partial<ScrcpyOptionsInit1_22>) {
41
+ if (init.rawVideoStream) {
42
+ // Set implied options for client-side processing
43
+ init.sendDeviceMeta = false;
44
+ init.sendFrameMeta = false;
45
+ init.sendDummyByte = false;
46
+ }
47
+
48
+ super(init);
49
+ }
50
+
51
+ protected override getDefaultValue(): T {
52
+ return {
53
+ ...super.getDefaultValue(),
54
+ downsizeOnError: true,
55
+ sendDeviceMeta: true,
56
+ sendDummyByte: true,
57
+ rawVideoStream: false,
58
+ };
59
+ }
60
+
61
+ public override createConnection(device: Adb): ScrcpyClientConnection {
62
+ const options = {
63
+ ...this.getDefaultValue(),
64
+ ...this.value,
65
+ };
66
+ if (this.value.tunnelForward) {
67
+ return new ScrcpyClientForwardConnection(device, options);
68
+ } else {
69
+ return new ScrcpyClientReverseConnection(device, options);
70
+ }
71
+ }
72
+
73
+ public override serializeInjectScrollControlMessage(
74
+ message: ScrcpyInjectScrollControlMessage1_22,
75
+ ): Uint8Array {
76
+ return ScrcpyInjectScrollControlMessage1_22.serialize(message);
77
+ }
78
+ }
@@ -0,0 +1,18 @@
1
+ import { ScrcpyOptions1_23, type ScrcpyOptionsInit1_23 } from './1_23.js';
2
+
3
+ export interface ScrcpyOptionsInit1_24 extends ScrcpyOptionsInit1_23 {
4
+ powerOn: boolean;
5
+ }
6
+
7
+ export class ScrcpyOptions1_24<T extends ScrcpyOptionsInit1_24 = ScrcpyOptionsInit1_24> extends ScrcpyOptions1_23<T> {
8
+ public constructor(init: Partial<ScrcpyOptionsInit1_24>) {
9
+ super(init);
10
+ }
11
+
12
+ protected override getDefaultValue(): T {
13
+ return {
14
+ ...super.getDefaultValue(),
15
+ powerOn: true,
16
+ };
17
+ }
18
+ }
@@ -1,63 +1,66 @@
1
- import type { Adb, TransformStream } from "@yume-chan/adb";
2
- import type { ScrcpyClientConnection } from "../connection.js";
3
- import type { H264Configuration } from "../decoder/index.js";
4
- import type { ScrcpyBackOrScreenOnEvent1_18 } from "./1_18.js";
5
- import type { ScrcpyInjectScrollControlMessage1_22 } from "./1_22.js";
6
-
7
- export const DEFAULT_SERVER_PATH = '/data/local/tmp/scrcpy-server.jar';
8
-
9
- export interface ScrcpyOptionValue {
10
- toOptionValue(): string | undefined;
11
- }
12
-
13
- export function isScrcpyOptionValue(value: any): value is ScrcpyOptionValue {
14
- return typeof value === 'object' &&
15
- value !== null &&
16
- typeof value.toOptionValue === 'function';
17
- }
18
-
19
- export function toScrcpyOptionValue<T>(value: any, empty: T): string | T {
20
- if (isScrcpyOptionValue(value)) {
21
- value = value.toOptionValue();
22
- }
23
-
24
- if (value === undefined) {
25
- return empty;
26
- }
27
-
28
- return `${value}`;
29
- }
30
-
31
- export interface VideoStreamConfigurationPacket {
32
- type: 'configuration';
33
- data: H264Configuration;
34
- }
35
-
36
- export interface VideoStreamFramePacket {
37
- type: 'frame';
38
- keyframe?: boolean | undefined;
39
- pts?: bigint | undefined;
40
- data: Uint8Array;
41
- }
42
-
43
- export type VideoStreamPacket = VideoStreamConfigurationPacket | VideoStreamFramePacket;
44
-
45
- export interface ScrcpyOptions<T> {
46
- value: Partial<T>;
47
-
48
- formatServerArguments(): string[];
49
-
50
- getOutputEncoderNameRegex(): RegExp;
51
-
52
- createConnection(adb: Adb): ScrcpyClientConnection;
53
-
54
- createVideoStreamTransformer(): TransformStream<Uint8Array, VideoStreamPacket>;
55
-
56
- serializeBackOrScreenOnControlMessage(
57
- message: ScrcpyBackOrScreenOnEvent1_18,
58
- ): Uint8Array | undefined;
59
-
60
- serializeInjectScrollControlMessage(
61
- message: ScrcpyInjectScrollControlMessage1_22,
62
- ): Uint8Array;
63
- }
1
+ import type { Adb, TransformStream } from "@yume-chan/adb";
2
+ import type { ScrcpyClientConnection } from "../connection.js";
3
+ import type { H264Configuration } from "../decoder/index.js";
4
+ import type { ScrcpyControlMessageType } from "../message.js";
5
+ import type { ScrcpyBackOrScreenOnEvent1_18 } from "./1_18.js";
6
+ import type { ScrcpyInjectScrollControlMessage1_22 } from "./1_22.js";
7
+
8
+ export const DEFAULT_SERVER_PATH = '/data/local/tmp/scrcpy-server.jar';
9
+
10
+ export interface ScrcpyOptionValue {
11
+ toOptionValue(): string | undefined;
12
+ }
13
+
14
+ export function isScrcpyOptionValue(value: any): value is ScrcpyOptionValue {
15
+ return typeof value === 'object' &&
16
+ value !== null &&
17
+ typeof value.toOptionValue === 'function';
18
+ }
19
+
20
+ export function toScrcpyOptionValue<T>(value: any, empty: T): string | T {
21
+ if (isScrcpyOptionValue(value)) {
22
+ value = value.toOptionValue();
23
+ }
24
+
25
+ if (value === undefined) {
26
+ return empty;
27
+ }
28
+
29
+ return `${value}`;
30
+ }
31
+
32
+ export interface VideoStreamConfigurationPacket {
33
+ type: 'configuration';
34
+ data: H264Configuration;
35
+ }
36
+
37
+ export interface VideoStreamFramePacket {
38
+ type: 'frame';
39
+ keyframe?: boolean | undefined;
40
+ pts?: bigint | undefined;
41
+ data: Uint8Array;
42
+ }
43
+
44
+ export type VideoStreamPacket = VideoStreamConfigurationPacket | VideoStreamFramePacket;
45
+
46
+ export interface ScrcpyOptions<T> {
47
+ value: Partial<T>;
48
+
49
+ formatServerArguments(): string[];
50
+
51
+ getOutputEncoderNameRegex(): RegExp;
52
+
53
+ createConnection(adb: Adb): ScrcpyClientConnection;
54
+
55
+ createVideoStreamTransformer(): TransformStream<Uint8Array, VideoStreamPacket>;
56
+
57
+ getControlMessageTypes(): ScrcpyControlMessageType[];
58
+
59
+ serializeBackOrScreenOnControlMessage(
60
+ message: ScrcpyBackOrScreenOnEvent1_18,
61
+ ): Uint8Array | undefined;
62
+
63
+ serializeInjectScrollControlMessage(
64
+ message: ScrcpyInjectScrollControlMessage1_22,
65
+ ): Uint8Array;
66
+ }
@@ -1,6 +1,7 @@
1
- export * from './1_16/index.js';
2
- export * from './1_18.js';
3
- export * from './1_21.js';
4
- export * from './1_22.js';
5
- export * from './1_23.js';
6
- export * from './common.js';
1
+ export * from './1_16/index.js';
2
+ export * from './1_18.js';
3
+ export * from './1_21.js';
4
+ export * from './1_22.js';
5
+ export * from './1_23.js';
6
+ export * from './1_24.js';
7
+ export * from './common.js';
@@ -1,24 +1,24 @@
1
- import { WrapWritableStream, type Adb, type AdbSync } from "@yume-chan/adb";
2
- import { DEFAULT_SERVER_PATH } from "./options/index.js";
3
-
4
- export interface PushServerOptions {
5
- path?: string;
6
- }
7
-
8
- export function pushServer(
9
- device: Adb,
10
- options: PushServerOptions = {}
11
- ) {
12
- const { path = DEFAULT_SERVER_PATH } = options;
13
-
14
- let sync!: AdbSync;
15
- return new WrapWritableStream<Uint8Array>({
16
- async start() {
17
- sync = await device.sync();
18
- return sync.write(path);
19
- },
20
- async close() {
21
- await sync.dispose();
22
- },
23
- });
24
- }
1
+ import { WrapWritableStream, type Adb, type AdbSync } from "@yume-chan/adb";
2
+ import { DEFAULT_SERVER_PATH } from "./options/index.js";
3
+
4
+ export interface PushServerOptions {
5
+ path?: string;
6
+ }
7
+
8
+ export function pushServer(
9
+ device: Adb,
10
+ options: PushServerOptions = {}
11
+ ) {
12
+ const { path = DEFAULT_SERVER_PATH } = options;
13
+
14
+ let sync!: AdbSync;
15
+ return new WrapWritableStream<Uint8Array>({
16
+ async start() {
17
+ sync = await device.sync();
18
+ return sync.write(path);
19
+ },
20
+ async close() {
21
+ await sync.dispose();
22
+ },
23
+ });
24
+ }
package/src/utils.ts CHANGED
@@ -1,5 +1,5 @@
1
- export function delay(time: number): Promise<void> {
2
- return new Promise(resolve => {
3
- (globalThis as any).setTimeout(resolve, time);
4
- });
5
- }
1
+ export function delay(time: number): Promise<void> {
2
+ return new Promise(resolve => {
3
+ (globalThis as any).setTimeout(resolve, time);
4
+ });
5
+ }