@yume-chan/adb
Version:
TypeScript implementation of Android Debug Bridge (ADB) protocol.
38 lines • 1.09 kB
JavaScript
// cspell:ignore mdns
export class MDnsCommands {
#client;
constructor(client) {
this.#client = client;
}
async check() {
const connection = await this.#client.createConnection("host:mdns:check");
try {
const response = await connection.readString();
return !response.startsWith("ERROR:");
}
finally {
await connection.dispose();
}
}
async getServices() {
const connection = await this.#client.createConnection("host:mdns:services");
try {
const response = await connection.readString();
return response
.split("\n")
.filter(Boolean)
.map((line) => {
const parts = line.split("\t");
return {
name: parts[0],
service: parts[1],
address: parts[2],
};
});
}
finally {
await connection.dispose();
}
}
}
//# sourceMappingURL=m-dns.js.map