@yume-chan/adb 0.0.18 → 0.0.20
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.
- package/CHANGELOG.json +54 -0
- package/CHANGELOG.md +25 -1
- package/README.md +220 -103
- package/esm/adb.d.ts +43 -60
- package/esm/adb.d.ts.map +1 -1
- package/esm/adb.js +68 -249
- package/esm/adb.js.map +1 -1
- package/esm/banner.d.ts +17 -0
- package/esm/banner.d.ts.map +1 -0
- package/esm/banner.js +67 -0
- package/esm/banner.js.map +1 -0
- package/esm/commands/base.d.ts +6 -6
- package/esm/commands/base.d.ts.map +1 -1
- package/esm/commands/base.js +8 -8
- package/esm/commands/framebuffer.d.ts +53 -53
- package/esm/commands/framebuffer.d.ts.map +1 -1
- package/esm/commands/framebuffer.js +46 -46
- package/esm/commands/framebuffer.js.map +1 -1
- package/esm/commands/index.d.ts +7 -8
- package/esm/commands/index.d.ts.map +1 -1
- package/esm/commands/index.js +7 -8
- package/esm/commands/index.js.map +1 -1
- package/esm/commands/power.d.ts +22 -22
- package/esm/commands/power.js +48 -48
- package/esm/commands/reverse.d.ts +40 -28
- package/esm/commands/reverse.d.ts.map +1 -1
- package/esm/commands/reverse.js +130 -100
- package/esm/commands/reverse.js.map +1 -1
- package/esm/commands/subprocess/command.d.ts +57 -51
- package/esm/commands/subprocess/command.d.ts.map +1 -1
- package/esm/commands/subprocess/command.js +86 -80
- package/esm/commands/subprocess/command.js.map +1 -1
- package/esm/commands/subprocess/index.d.ts +3 -3
- package/esm/commands/subprocess/index.js +3 -3
- package/esm/commands/subprocess/protocols/index.d.ts +3 -3
- package/esm/commands/subprocess/protocols/index.js +3 -3
- package/esm/commands/subprocess/protocols/none.d.ts +30 -35
- package/esm/commands/subprocess/protocols/none.d.ts.map +1 -1
- package/esm/commands/subprocess/protocols/none.js +65 -55
- package/esm/commands/subprocess/protocols/none.js.map +1 -1
- package/esm/commands/subprocess/protocols/shell.d.ts +33 -38
- package/esm/commands/subprocess/protocols/shell.d.ts.map +1 -1
- package/esm/commands/subprocess/protocols/shell.js +172 -162
- package/esm/commands/subprocess/protocols/shell.js.map +1 -1
- package/esm/commands/subprocess/protocols/types.d.ts +48 -49
- package/esm/commands/subprocess/protocols/types.d.ts.map +1 -1
- package/esm/commands/subprocess/protocols/types.js +1 -1
- package/esm/commands/subprocess/utils.d.ts +1 -1
- package/esm/commands/subprocess/utils.js +18 -18
- package/esm/commands/sync/index.d.ts +8 -7
- package/esm/commands/sync/index.d.ts.map +1 -1
- package/esm/commands/sync/index.js +8 -7
- package/esm/commands/sync/index.js.map +1 -1
- package/esm/commands/sync/list.d.ts +42 -40
- package/esm/commands/sync/list.d.ts.map +1 -1
- package/esm/commands/sync/list.js +67 -47
- package/esm/commands/sync/list.js.map +1 -1
- package/esm/commands/sync/pull.d.ts +13 -11
- package/esm/commands/sync/pull.d.ts.map +1 -1
- package/esm/commands/sync/pull.js +35 -37
- package/esm/commands/sync/pull.js.map +1 -1
- package/esm/commands/sync/push.d.ts +57 -7
- package/esm/commands/sync/push.d.ts.map +1 -1
- package/esm/commands/sync/push.js +89 -22
- package/esm/commands/sync/push.js.map +1 -1
- package/esm/commands/sync/request.d.ts +26 -23
- package/esm/commands/sync/request.d.ts.map +1 -1
- package/esm/commands/sync/request.js +40 -42
- package/esm/commands/sync/request.js.map +1 -1
- package/esm/commands/sync/response.d.ts +19 -19
- package/esm/commands/sync/response.d.ts.map +1 -1
- package/esm/commands/sync/response.js +54 -54
- package/esm/commands/sync/response.js.map +1 -1
- package/esm/commands/sync/socket.d.ts +22 -0
- package/esm/commands/sync/socket.d.ts.map +1 -0
- package/esm/commands/sync/socket.js +69 -0
- package/esm/commands/sync/socket.js.map +1 -0
- package/esm/commands/sync/stat.d.ts +72 -72
- package/esm/commands/sync/stat.d.ts.map +1 -1
- package/esm/commands/sync/stat.js +116 -104
- package/esm/commands/sync/stat.js.map +1 -1
- package/esm/commands/sync/sync.d.ts +65 -60
- package/esm/commands/sync/sync.d.ts.map +1 -1
- package/esm/commands/sync/sync.js +123 -149
- package/esm/commands/sync/sync.js.map +1 -1
- package/esm/commands/tcpip.d.ts +5 -5
- package/esm/commands/tcpip.d.ts.map +1 -1
- package/esm/commands/tcpip.js +20 -18
- package/esm/commands/tcpip.js.map +1 -1
- package/esm/{auth.d.ts → daemon/auth.d.ts} +50 -51
- package/esm/daemon/auth.d.ts.map +1 -0
- package/esm/{auth.js → daemon/auth.js} +95 -96
- package/esm/daemon/auth.js.map +1 -0
- package/esm/daemon/connection.d.ts +11 -0
- package/esm/daemon/connection.d.ts.map +1 -0
- package/esm/daemon/connection.js +2 -0
- package/esm/daemon/connection.js.map +1 -0
- package/esm/{crypto.d.ts → daemon/crypto.d.ts} +36 -36
- package/esm/daemon/crypto.d.ts.map +1 -0
- package/esm/{crypto.js → daemon/crypto.js} +244 -248
- package/esm/daemon/crypto.js.map +1 -0
- package/esm/daemon/device.d.ts +9 -0
- package/esm/daemon/device.d.ts.map +1 -0
- package/esm/daemon/device.js +2 -0
- package/esm/daemon/device.js.map +1 -0
- package/esm/daemon/dispatcher.d.ts +42 -0
- package/esm/daemon/dispatcher.d.ts.map +1 -0
- package/esm/{socket → daemon}/dispatcher.js +225 -234
- package/esm/daemon/dispatcher.js.map +1 -0
- package/esm/daemon/index.d.ts +8 -0
- package/esm/daemon/index.d.ts.map +1 -0
- package/esm/daemon/index.js +8 -0
- package/esm/daemon/index.js.map +1 -0
- package/esm/{packet.d.ts → daemon/packet.d.ts} +45 -46
- package/esm/daemon/packet.d.ts.map +1 -0
- package/esm/{packet.js → daemon/packet.js} +43 -48
- package/esm/daemon/packet.js.map +1 -0
- package/esm/daemon/socket.d.ts +58 -0
- package/esm/daemon/socket.d.ts.map +1 -0
- package/esm/{socket → daemon}/socket.js +121 -118
- package/esm/daemon/socket.js.map +1 -0
- package/esm/daemon/transport.d.ts +45 -0
- package/esm/daemon/transport.d.ts.map +1 -0
- package/esm/daemon/transport.js +184 -0
- package/esm/daemon/transport.js.map +1 -0
- package/esm/features.d.ts +10 -7
- package/esm/features.d.ts.map +1 -1
- package/esm/features.js +13 -10
- package/esm/features.js.map +1 -1
- package/esm/index.d.ts +7 -9
- package/esm/index.d.ts.map +1 -1
- package/esm/index.js +7 -9
- package/esm/index.js.map +1 -1
- package/esm/server/client.d.ts +78 -0
- package/esm/server/client.d.ts.map +1 -0
- package/esm/server/client.js +329 -0
- package/esm/server/client.js.map +1 -0
- package/esm/server/index.d.ts +3 -0
- package/esm/server/index.d.ts.map +1 -0
- package/esm/server/index.js +3 -0
- package/esm/server/index.js.map +1 -0
- package/esm/server/transport.d.ts +19 -0
- package/esm/server/transport.d.ts.map +1 -0
- package/esm/server/transport.js +44 -0
- package/esm/server/transport.js.map +1 -0
- package/esm/utils/auto-reset-event.d.ts +8 -9
- package/esm/utils/auto-reset-event.d.ts.map +1 -1
- package/esm/utils/auto-reset-event.js +33 -33
- package/esm/utils/auto-reset-event.js.map +1 -1
- package/esm/utils/base64.d.ts +27 -27
- package/esm/utils/base64.js +246 -246
- package/esm/utils/base64.js.map +1 -1
- package/esm/utils/conditional-variable.d.ts +8 -0
- package/esm/utils/conditional-variable.d.ts.map +1 -0
- package/esm/utils/conditional-variable.js +34 -0
- package/esm/utils/conditional-variable.js.map +1 -0
- package/esm/utils/hex.d.ts +3 -0
- package/esm/utils/hex.d.ts.map +1 -0
- package/esm/utils/hex.js +55 -0
- package/esm/utils/hex.js.map +1 -0
- package/esm/utils/index.d.ts +6 -3
- package/esm/utils/index.d.ts.map +1 -1
- package/esm/utils/index.js +6 -3
- package/esm/utils/index.js.map +1 -1
- package/esm/utils/no-op.d.ts +7 -0
- package/esm/utils/no-op.d.ts.map +1 -0
- package/esm/utils/no-op.js +12 -0
- package/esm/utils/no-op.js.map +1 -0
- package/package.json +14 -12
- package/src/adb.ts +47 -248
- package/src/banner.ts +82 -0
- package/src/commands/base.ts +1 -1
- package/src/commands/framebuffer.ts +4 -4
- package/src/commands/index.ts +7 -8
- package/src/commands/power.ts +2 -2
- package/src/commands/reverse.ts +90 -70
- package/src/commands/subprocess/command.ts +12 -4
- package/src/commands/subprocess/index.ts +3 -3
- package/src/commands/subprocess/protocols/index.ts +3 -3
- package/src/commands/subprocess/protocols/none.ts +36 -23
- package/src/commands/subprocess/protocols/shell.ts +94 -74
- package/src/commands/subprocess/protocols/types.ts +7 -7
- package/src/commands/subprocess/utils.ts +1 -1
- package/src/commands/sync/index.ts +8 -7
- package/src/commands/sync/list.ts +44 -25
- package/src/commands/sync/pull.ts +40 -45
- package/src/commands/sync/push.ts +158 -39
- package/src/commands/sync/request.ts +21 -16
- package/src/commands/sync/response.ts +10 -9
- package/src/commands/sync/socket.ts +99 -0
- package/src/commands/sync/stat.ts +47 -42
- package/src/commands/sync/sync.ts +73 -116
- package/src/commands/tcpip.ts +9 -7
- package/src/{auth.ts → daemon/auth.ts} +24 -23
- package/src/{crypto.ts → daemon/crypto.ts} +25 -33
- package/src/daemon/device.ts +14 -0
- package/src/{socket → daemon}/dispatcher.ts +95 -117
- package/src/daemon/index.ts +7 -0
- package/src/daemon/packet.ts +75 -0
- package/src/{socket → daemon}/socket.ts +71 -56
- package/src/daemon/transport.ts +269 -0
- package/src/features.ts +9 -6
- package/src/index.ts +3 -5
- package/src/server/client.ts +476 -0
- package/src/server/index.ts +2 -0
- package/src/server/transport.ts +77 -0
- package/src/utils/auto-reset-event.ts +14 -15
- package/src/utils/conditional-variable.ts +45 -0
- package/src/utils/hex.ts +58 -0
- package/src/utils/index.ts +6 -3
- package/src/utils/no-op.ts +12 -0
- package/tsconfig.build.json +12 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/esm/auth.d.ts.map +0 -1
- package/esm/auth.js.map +0 -1
- package/esm/backend.d.ts +0 -9
- package/esm/backend.d.ts.map +0 -1
- package/esm/backend.js +0 -2
- package/esm/backend.js.map +0 -1
- package/esm/commands/install.d.ts +0 -4
- package/esm/commands/install.d.ts.map +0 -1
- package/esm/commands/install.js +0 -29
- package/esm/commands/install.js.map +0 -1
- package/esm/crypto.d.ts.map +0 -1
- package/esm/crypto.js.map +0 -1
- package/esm/packet.d.ts.map +0 -1
- package/esm/packet.js.map +0 -1
- package/esm/socket/dispatcher.d.ts +0 -60
- package/esm/socket/dispatcher.d.ts.map +0 -1
- package/esm/socket/dispatcher.js.map +0 -1
- package/esm/socket/index.d.ts +0 -3
- package/esm/socket/index.d.ts.map +0 -1
- package/esm/socket/index.js +0 -3
- package/esm/socket/index.js.map +0 -1
- package/esm/socket/socket.d.ts +0 -60
- package/esm/socket/socket.d.ts.map +0 -1
- package/esm/socket/socket.js.map +0 -1
- package/src/backend.ts +0 -14
- package/src/commands/install.ts +0 -40
- package/src/packet.ts +0 -90
- package/src/socket/index.ts +0 -2
|
@@ -1,105 +1,117 @@
|
|
|
1
|
-
import Struct, { placeholder } from "@yume-chan/struct";
|
|
2
|
-
import { AdbSyncRequestId, adbSyncWriteRequest } from "./request.js";
|
|
3
|
-
import { AdbSyncResponseId, adbSyncReadResponse } from "./response.js";
|
|
4
|
-
// https://github.com/python/cpython/blob/4e581d64b8aff3e2eda99b12f080c877bb78dfca/Lib/stat.py#L36
|
|
5
|
-
export var LinuxFileType;
|
|
6
|
-
(function (LinuxFileType) {
|
|
7
|
-
LinuxFileType[LinuxFileType["Directory"] = 4] = "Directory";
|
|
8
|
-
LinuxFileType[LinuxFileType["File"] = 8] = "File";
|
|
9
|
-
LinuxFileType[LinuxFileType["Link"] = 10] = "Link";
|
|
10
|
-
})(LinuxFileType = LinuxFileType || (LinuxFileType = {}));
|
|
11
|
-
export const AdbSyncLstatResponse = new Struct({ littleEndian: true })
|
|
12
|
-
.int32("mode")
|
|
13
|
-
.int32("size")
|
|
14
|
-
.int32("mtime")
|
|
15
|
-
.extra({
|
|
16
|
-
id: AdbSyncResponseId.Lstat,
|
|
17
|
-
get type() {
|
|
18
|
-
return (this.mode >> 12);
|
|
19
|
-
},
|
|
20
|
-
get permission() {
|
|
21
|
-
return this.mode &
|
|
22
|
-
},
|
|
23
|
-
})
|
|
24
|
-
.postDeserialize((object) => {
|
|
25
|
-
if (object.mode === 0 && object.size === 0 && object.mtime === 0) {
|
|
26
|
-
throw new Error("lstat error");
|
|
27
|
-
}
|
|
28
|
-
});
|
|
29
|
-
export var AdbSyncStatErrorCode;
|
|
30
|
-
(function (AdbSyncStatErrorCode) {
|
|
31
|
-
AdbSyncStatErrorCode[AdbSyncStatErrorCode["SUCCESS"] = 0] = "SUCCESS";
|
|
32
|
-
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EACCES"] = 13] = "EACCES";
|
|
33
|
-
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EEXIST"] = 17] = "EEXIST";
|
|
34
|
-
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EFAULT"] = 14] = "EFAULT";
|
|
35
|
-
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EFBIG"] = 27] = "EFBIG";
|
|
36
|
-
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EINTR"] = 4] = "EINTR";
|
|
37
|
-
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EINVAL"] = 22] = "EINVAL";
|
|
38
|
-
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EIO"] = 5] = "EIO";
|
|
39
|
-
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EISDIR"] = 21] = "EISDIR";
|
|
40
|
-
AdbSyncStatErrorCode[AdbSyncStatErrorCode["ELOOP"] = 40] = "ELOOP";
|
|
41
|
-
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EMFILE"] = 24] = "EMFILE";
|
|
42
|
-
AdbSyncStatErrorCode[AdbSyncStatErrorCode["ENAMETOOLONG"] = 36] = "ENAMETOOLONG";
|
|
43
|
-
AdbSyncStatErrorCode[AdbSyncStatErrorCode["ENFILE"] = 23] = "ENFILE";
|
|
44
|
-
AdbSyncStatErrorCode[AdbSyncStatErrorCode["ENOENT"] = 2] = "ENOENT";
|
|
45
|
-
AdbSyncStatErrorCode[AdbSyncStatErrorCode["ENOMEM"] = 12] = "ENOMEM";
|
|
46
|
-
AdbSyncStatErrorCode[AdbSyncStatErrorCode["ENOSPC"] = 28] = "ENOSPC";
|
|
47
|
-
AdbSyncStatErrorCode[AdbSyncStatErrorCode["ENOTDIR"] = 20] = "ENOTDIR";
|
|
48
|
-
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EOVERFLOW"] = 75] = "EOVERFLOW";
|
|
49
|
-
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EPERM"] = 1] = "EPERM";
|
|
50
|
-
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EROFS"] = 30] = "EROFS";
|
|
51
|
-
AdbSyncStatErrorCode[AdbSyncStatErrorCode["ETXTBSY"] = 26] = "ETXTBSY";
|
|
52
|
-
})(AdbSyncStatErrorCode = AdbSyncStatErrorCode || (AdbSyncStatErrorCode = {}));
|
|
53
|
-
export const AdbSyncStatResponse = new Struct({ littleEndian: true })
|
|
54
|
-
.uint32("error", placeholder())
|
|
55
|
-
.uint64("dev")
|
|
56
|
-
.uint64("ino")
|
|
57
|
-
.uint32("mode")
|
|
58
|
-
.uint32("nlink")
|
|
59
|
-
.uint32("uid")
|
|
60
|
-
.uint32("gid")
|
|
61
|
-
.uint64("size")
|
|
62
|
-
.uint64("atime")
|
|
63
|
-
.uint64("mtime")
|
|
64
|
-
.uint64("ctime")
|
|
65
|
-
.extra({
|
|
66
|
-
id: AdbSyncResponseId.Stat,
|
|
67
|
-
get type() {
|
|
68
|
-
return (this.mode >> 12);
|
|
69
|
-
},
|
|
70
|
-
get permission() {
|
|
71
|
-
return this.mode &
|
|
72
|
-
},
|
|
73
|
-
})
|
|
74
|
-
.postDeserialize((object) => {
|
|
75
|
-
if (object.error) {
|
|
76
|
-
throw new Error(AdbSyncStatErrorCode[object.error]);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
export async function adbSyncLstat(
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
1
|
+
import Struct, { placeholder } from "@yume-chan/struct";
|
|
2
|
+
import { AdbSyncRequestId, adbSyncWriteRequest } from "./request.js";
|
|
3
|
+
import { AdbSyncResponseId, adbSyncReadResponse } from "./response.js";
|
|
4
|
+
// https://github.com/python/cpython/blob/4e581d64b8aff3e2eda99b12f080c877bb78dfca/Lib/stat.py#L36
|
|
5
|
+
export var LinuxFileType;
|
|
6
|
+
(function (LinuxFileType) {
|
|
7
|
+
LinuxFileType[LinuxFileType["Directory"] = 4] = "Directory";
|
|
8
|
+
LinuxFileType[LinuxFileType["File"] = 8] = "File";
|
|
9
|
+
LinuxFileType[LinuxFileType["Link"] = 10] = "Link";
|
|
10
|
+
})(LinuxFileType = LinuxFileType || (LinuxFileType = {}));
|
|
11
|
+
export const AdbSyncLstatResponse = new Struct({ littleEndian: true })
|
|
12
|
+
.int32("mode")
|
|
13
|
+
.int32("size")
|
|
14
|
+
.int32("mtime")
|
|
15
|
+
.extra({
|
|
16
|
+
id: AdbSyncResponseId.Lstat,
|
|
17
|
+
get type() {
|
|
18
|
+
return (this.mode >> 12);
|
|
19
|
+
},
|
|
20
|
+
get permission() {
|
|
21
|
+
return this.mode & 0b00001111_11111111;
|
|
22
|
+
},
|
|
23
|
+
})
|
|
24
|
+
.postDeserialize((object) => {
|
|
25
|
+
if (object.mode === 0 && object.size === 0 && object.mtime === 0) {
|
|
26
|
+
throw new Error("lstat error");
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
export var AdbSyncStatErrorCode;
|
|
30
|
+
(function (AdbSyncStatErrorCode) {
|
|
31
|
+
AdbSyncStatErrorCode[AdbSyncStatErrorCode["SUCCESS"] = 0] = "SUCCESS";
|
|
32
|
+
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EACCES"] = 13] = "EACCES";
|
|
33
|
+
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EEXIST"] = 17] = "EEXIST";
|
|
34
|
+
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EFAULT"] = 14] = "EFAULT";
|
|
35
|
+
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EFBIG"] = 27] = "EFBIG";
|
|
36
|
+
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EINTR"] = 4] = "EINTR";
|
|
37
|
+
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EINVAL"] = 22] = "EINVAL";
|
|
38
|
+
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EIO"] = 5] = "EIO";
|
|
39
|
+
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EISDIR"] = 21] = "EISDIR";
|
|
40
|
+
AdbSyncStatErrorCode[AdbSyncStatErrorCode["ELOOP"] = 40] = "ELOOP";
|
|
41
|
+
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EMFILE"] = 24] = "EMFILE";
|
|
42
|
+
AdbSyncStatErrorCode[AdbSyncStatErrorCode["ENAMETOOLONG"] = 36] = "ENAMETOOLONG";
|
|
43
|
+
AdbSyncStatErrorCode[AdbSyncStatErrorCode["ENFILE"] = 23] = "ENFILE";
|
|
44
|
+
AdbSyncStatErrorCode[AdbSyncStatErrorCode["ENOENT"] = 2] = "ENOENT";
|
|
45
|
+
AdbSyncStatErrorCode[AdbSyncStatErrorCode["ENOMEM"] = 12] = "ENOMEM";
|
|
46
|
+
AdbSyncStatErrorCode[AdbSyncStatErrorCode["ENOSPC"] = 28] = "ENOSPC";
|
|
47
|
+
AdbSyncStatErrorCode[AdbSyncStatErrorCode["ENOTDIR"] = 20] = "ENOTDIR";
|
|
48
|
+
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EOVERFLOW"] = 75] = "EOVERFLOW";
|
|
49
|
+
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EPERM"] = 1] = "EPERM";
|
|
50
|
+
AdbSyncStatErrorCode[AdbSyncStatErrorCode["EROFS"] = 30] = "EROFS";
|
|
51
|
+
AdbSyncStatErrorCode[AdbSyncStatErrorCode["ETXTBSY"] = 26] = "ETXTBSY";
|
|
52
|
+
})(AdbSyncStatErrorCode = AdbSyncStatErrorCode || (AdbSyncStatErrorCode = {}));
|
|
53
|
+
export const AdbSyncStatResponse = new Struct({ littleEndian: true })
|
|
54
|
+
.uint32("error", placeholder())
|
|
55
|
+
.uint64("dev")
|
|
56
|
+
.uint64("ino")
|
|
57
|
+
.uint32("mode")
|
|
58
|
+
.uint32("nlink")
|
|
59
|
+
.uint32("uid")
|
|
60
|
+
.uint32("gid")
|
|
61
|
+
.uint64("size")
|
|
62
|
+
.uint64("atime")
|
|
63
|
+
.uint64("mtime")
|
|
64
|
+
.uint64("ctime")
|
|
65
|
+
.extra({
|
|
66
|
+
id: AdbSyncResponseId.Stat,
|
|
67
|
+
get type() {
|
|
68
|
+
return (this.mode >> 12);
|
|
69
|
+
},
|
|
70
|
+
get permission() {
|
|
71
|
+
return this.mode & 0b00001111_11111111;
|
|
72
|
+
},
|
|
73
|
+
})
|
|
74
|
+
.postDeserialize((object) => {
|
|
75
|
+
if (object.error) {
|
|
76
|
+
throw new Error(AdbSyncStatErrorCode[object.error]);
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
export async function adbSyncLstat(socket, path, v2) {
|
|
80
|
+
const locked = await socket.lock();
|
|
81
|
+
try {
|
|
82
|
+
if (v2) {
|
|
83
|
+
await adbSyncWriteRequest(locked, AdbSyncRequestId.LstatV2, path);
|
|
84
|
+
return await adbSyncReadResponse(locked, AdbSyncResponseId.Lstat2, AdbSyncStatResponse);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
await adbSyncWriteRequest(locked, AdbSyncRequestId.Lstat, path);
|
|
88
|
+
const response = await adbSyncReadResponse(locked, AdbSyncResponseId.Lstat, AdbSyncLstatResponse);
|
|
89
|
+
return {
|
|
90
|
+
mode: response.mode,
|
|
91
|
+
// Convert to `BigInt` to make it compatible with `AdbSyncStatResponse`
|
|
92
|
+
size: BigInt(response.size),
|
|
93
|
+
mtime: BigInt(response.mtime),
|
|
94
|
+
get type() {
|
|
95
|
+
return response.type;
|
|
96
|
+
},
|
|
97
|
+
get permission() {
|
|
98
|
+
return response.permission;
|
|
99
|
+
},
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
finally {
|
|
104
|
+
locked.release();
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
export async function adbSyncStat(socket, path) {
|
|
108
|
+
const locked = await socket.lock();
|
|
109
|
+
try {
|
|
110
|
+
await adbSyncWriteRequest(locked, AdbSyncRequestId.Stat, path);
|
|
111
|
+
return await adbSyncReadResponse(locked, AdbSyncResponseId.Stat, AdbSyncStatResponse);
|
|
112
|
+
}
|
|
113
|
+
finally {
|
|
114
|
+
locked.release();
|
|
115
|
+
}
|
|
116
|
+
}
|
|
105
117
|
//# sourceMappingURL=stat.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stat.js","sourceRoot":"","sources":["../../../src/commands/sync/stat.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"stat.js","sourceRoot":"","sources":["../../../src/commands/sync/stat.ts"],"names":[],"mappings":"AAAA,OAAO,MAAM,EAAE,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AACrE,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAGvE,kGAAkG;AAClG,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACrB,2DAAgB,CAAA;IAChB,iDAAW,CA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B,CAAC,MAAM,EAAE,gBAAgB,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;YAChE,MAAM,QAAQ,GAAG,MAAM,mBAAmB,CACtC,MAAM,EACN,iBAAiB,CAAC,KAAK,EACvB,oBAAoB,CACvB,CAAC;YACF,OAAO;gBACH,IAAI,EAAE,QAAQ,CAAC,IAAI;gBACnB,uEAAuE;gBACvE,IAAI,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;gBAC3B,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC;gBAC7B,IAAI,IAAI;oBACJ,OAAO,QAAQ,CAAC,IAAI,CAAC;gBACzB,CAAC;gBACD,IAAI,UAAU;oBACV,OAAO,QAAQ,CAAC,UAAU,CAAC;gBAC/B,CAAC;aACJ,CAAC;SACL;KACJ;YAAS;QACN,MAAM,CAAC,OAAO,EAAE,CAAC;KACpB;AACL,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,WAAW,CAC7B,MAAqB,EACrB,IAAY;IAEZ,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,IAAI,EAAE,CAAC;IACnC,IAAI;QACA,MAAM,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAC/D,OAAO,MAAM,mBAAmB,CAC5B,MAAM,EACN,iBAAiB,CAAC,IAAI,EACtB,mBAAmB,CACtB,CAAC;KACL;YAAS;QACN,MAAM,CAAC,OAAO,EAAE,CAAC;KACpB;AACL,CAAC"}
|
|
@@ -1,61 +1,66 @@
|
|
|
1
|
-
import { AutoDisposable } from "@yume-chan/event";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
/**
|
|
8
|
-
* A simplified `dirname` function that only handles absolute unix paths.
|
|
9
|
-
* @param path an absolute unix path
|
|
10
|
-
* @returns the directory name of the input path
|
|
11
|
-
*/
|
|
12
|
-
export declare function dirname(path: string): string;
|
|
13
|
-
export
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
* @param
|
|
55
|
-
* @
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
1
|
+
import { AutoDisposable } from "@yume-chan/event";
|
|
2
|
+
import type { Consumable, ReadableStream } from "@yume-chan/stream-extra";
|
|
3
|
+
import type { Adb, AdbSocket } from "../../adb.js";
|
|
4
|
+
import type { AdbSyncEntry } from "./list.js";
|
|
5
|
+
import { AdbSyncSocket } from "./socket.js";
|
|
6
|
+
import type { AdbSyncStat, LinuxFileType } from "./stat.js";
|
|
7
|
+
/**
|
|
8
|
+
* A simplified `dirname` function that only handles absolute unix paths.
|
|
9
|
+
* @param path an absolute unix path
|
|
10
|
+
* @returns the directory name of the input path
|
|
11
|
+
*/
|
|
12
|
+
export declare function dirname(path: string): string;
|
|
13
|
+
export interface AdbSyncWriteOptions {
|
|
14
|
+
filename: string;
|
|
15
|
+
file: ReadableStream<Consumable<Uint8Array>>;
|
|
16
|
+
type?: LinuxFileType;
|
|
17
|
+
permission?: number;
|
|
18
|
+
mtime?: number;
|
|
19
|
+
dryRun?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export declare class AdbSync extends AutoDisposable {
|
|
22
|
+
#private;
|
|
23
|
+
protected _adb: Adb;
|
|
24
|
+
protected _socket: AdbSyncSocket;
|
|
25
|
+
get supportsStat(): boolean;
|
|
26
|
+
get supportsListV2(): boolean;
|
|
27
|
+
get fixedPushMkdir(): boolean;
|
|
28
|
+
get supportsSendReceiveV2(): boolean;
|
|
29
|
+
get needPushMkdirWorkaround(): boolean;
|
|
30
|
+
constructor(adb: Adb, socket: AdbSocket);
|
|
31
|
+
lstat(path: string): Promise<AdbSyncStat>;
|
|
32
|
+
stat(path: string): Promise<{
|
|
33
|
+
id: import("./response.js").AdbSyncResponseId.Stat;
|
|
34
|
+
readonly type: LinuxFileType;
|
|
35
|
+
readonly permission: number;
|
|
36
|
+
error: import("./stat.js").AdbSyncStatErrorCode;
|
|
37
|
+
dev: bigint;
|
|
38
|
+
ino: bigint;
|
|
39
|
+
mode: number;
|
|
40
|
+
nlink: number;
|
|
41
|
+
uid: number;
|
|
42
|
+
gid: number;
|
|
43
|
+
size: bigint;
|
|
44
|
+
atime: bigint;
|
|
45
|
+
mtime: bigint;
|
|
46
|
+
ctime: bigint;
|
|
47
|
+
}>;
|
|
48
|
+
isDirectory(path: string): Promise<boolean>;
|
|
49
|
+
opendir(path: string): AsyncGenerator<AdbSyncEntry, void, void>;
|
|
50
|
+
readdir(path: string): Promise<AdbSyncEntry[]>;
|
|
51
|
+
/**
|
|
52
|
+
* Reads the content of a file on device.
|
|
53
|
+
*
|
|
54
|
+
* @param filename The full path of the file on device to read.
|
|
55
|
+
* @returns A `ReadableStream` that contains the file content.
|
|
56
|
+
*/
|
|
57
|
+
read(filename: string): ReadableStream<Uint8Array>;
|
|
58
|
+
/**
|
|
59
|
+
* Writes a file on device. If the file name already exists, it will be overwritten.
|
|
60
|
+
*
|
|
61
|
+
* @param options The content and options of the file to write.
|
|
62
|
+
*/
|
|
63
|
+
write(options: AdbSyncWriteOptions): Promise<void>;
|
|
64
|
+
dispose(): Promise<void>;
|
|
65
|
+
}
|
|
61
66
|
//# sourceMappingURL=sync.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,
|
|
1
|
+
{"version":3,"file":"sync.d.ts","sourceRoot":"","sources":["../../../src/commands/sync/sync.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE1E,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAInD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAI9C,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAG5D;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAS5C;AAED,MAAM,WAAW,mBAAmB;IAChC,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,cAAc,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAC;IAC7C,IAAI,CAAC,EAAE,aAAa,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CACpB;AAED,qBAAa,OAAQ,SAAQ,cAAc;;IACvC,SAAS,CAAC,IAAI,EAAE,GAAG,CAAC;IACpB,SAAS,CAAC,OAAO,EAAE,aAAa,CAAC;IAQjC,IAAW,YAAY,IAAI,OAAO,CAEjC;IAED,IAAW,cAAc,IAAI,OAAO,CAEnC;IAED,IAAW,cAAc,IAAI,OAAO,CAEnC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