Skip to content

Commit 24d9e7c

Browse files
committed
Add details & example to the README
1 parent 638e408 commit 24d9e7c

File tree

1 file changed

+33
-2
lines changed

1 file changed

+33
-2
lines changed

README.md

+33-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,33 @@
1-
# usbmux-client
2-
A pure-js Node.js library for communicating with iPhones over USB via usbmux
1+
# Usbmux-Client [![Build Status](https://github.com/httptoolkit/usbmux-client/workflows/CI/badge.svg)](https://github.com/httptoolkit/usbmux-client/actions) [![Available on NPM](https://img.shields.io/npm/v/usbmux-client.svg)](https://npmjs.com/package/usbmux-client)
2+
3+
> _Part of [HTTP Toolkit](https://httptoolkit.com): powerful tools for building, testing & debugging HTTP(S)_
4+
5+
A pure-js Node.js library for communicating with iPhones over USB via usbmux, with a pure-JS solution for Node.js that works on all platforms.
6+
7+
This provides fully cross-platform access to iOS devices, supporting the usbmuxd daemon built into iTunes on Windows & Mac, and the libimobiledevice implementation on Linux.
8+
9+
This is used within HTTP Toolkit to connect to TCP ports on a connected iPhone via USB, primarily to communicate with Frida using [Frida-JS](https://github.com/httptoolkit/frida-js/). It's currently focused on the core features required for that use case, but PRs to add support for more features are welcome. Right now it supports:
10+
11+
* Monitoring the list of connected devices
12+
* Querying the metadata for any connected device (to get the device name, device type, UDID, architecture, etc)
13+
* Opening a direct connection to any port on the device itself
14+
15+
## Example
16+
17+
```javascript
18+
import { UsbmuxClient } from 'usbmux-client';
19+
20+
const client = new UsbmuxClient();
21+
22+
const devices = await client.getDevices();
23+
// Returns a map from id to basic data like {
24+
// "1": { ConnectionType: "USB", DeviceId: "1", ... }
25+
// }
26+
27+
const firstDeviceId = Object.keys(devices)[0];
28+
const deviceMetadata = await client.queryAllDeviceValues(firstDeviceId);
29+
// Returns detailed data like { DeviceClass: "iPhone", DeviceName: "Alice's iPhone", ... }
30+
31+
// Returns a net.Socket connected to the given port on the target device:
32+
const conn = await client.createDeviceTunnel(firstDeviceId, 1234);
33+
```

0 commit comments

Comments
 (0)