{"id":13671439,"url":"https://github.com/mceSystems/libijs","last_synced_at":"2025-04-27T18:31:17.002Z","repository":{"id":57154398,"uuid":"107957939","full_name":"mceSystems/libijs","owner":"mceSystems","description":"A node.js library for communicating with iOS devices over USB","archived":false,"fork":false,"pushed_at":"2018-07-12T20:14:30.000Z","size":91,"stargazers_count":46,"open_issues_count":7,"forks_count":9,"subscribers_count":7,"default_branch":"master","last_synced_at":"2025-04-20T10:07:54.302Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mceSystems.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-23T09:07:10.000Z","updated_at":"2025-04-18T16:11:19.000Z","dependencies_parsed_at":"2022-09-07T08:40:29.776Z","dependency_job_id":null,"html_url":"https://github.com/mceSystems/libijs","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mceSystems%2Flibijs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mceSystems%2Flibijs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mceSystems%2Flibijs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mceSystems%2Flibijs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mceSystems","download_url":"https://codeload.github.com/mceSystems/libijs/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251187116,"owners_count":21549585,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T09:01:09.709Z","updated_at":"2025-04-27T18:31:16.631Z","avatar_url":"https://github.com/mceSystems.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# libijs \nA node.js library for communicating with iOS devices over USB.\n\nThis is a pure javascript implementation of [libimobiledevice](https://github.com/libimobiledevice/libimobiledevice), implementing everything needed for communicating with iOS device services through usbmuxd (the dameon\\service responsible for communication with iOS devices over USB).\nOur goal is to evantually provide most of libimobiledevice's functionality, in an API suitable for node.js.\n\n**Note that libijs is still an early proof of concept, and is not ready for production yet.**\n\n## Features\n* Provides a convenient node.js API for communicating with iOS devices and their services over usbmuxd.\n* Provides base classes for implementing more services, like the *PropertyListService* class.\n* Implements several ready to use command line tools.\n\n## Current status\n* **usbmux (client)**: All known functionality is implemented\n* **lockdownd**:\n\t* Implemented commands:\n\t\t* QueryType\n\t\t* StartSession\\StopSession\n\t\t* StartService\n\t\t* GetValue\\SetValue\\RemoveValue\n\t* Pairing, which is handled by usbmuxd, is not implemented (yet).\n* Implemented Services:\n\t* **afc:**\n\t\t* Multiplexes requests over a single connection to the afc service. Combined with node's async nature, this introduces a major performance improvment over libimobiledevice's afc client.\n\t\t* Provides a convient native interface:\n\t\t\t* node.js stream interface for reading\\writing remote files\n\t\t\t* Walking remote dirs\n\t* **diagnostics_relay**\n\t* **installation_proxy**\n\t* **MCInstall**\n\t* **mobileactivationd**\n\t* **mobilebackup2**\n\t* **notification_proxy**\n\t* **springboardservices**\n\t* **syslog_relay**\n* Tools:\n\t*  **apps**: similar to ideviceinstaller. Currently supports listing, installing (excluding ipcc) and uninstalling apps\n\t*  **backup**: similar to libimobiledevice's idevicebackup2.c, currently supports only backup \u0026 restore operations\n\t*  **diagnostics**: similar to libimobiledevice's idevicediagnostics\n\t*  **info**: similar to libimobiledevice's ideviceinfo\n\t*  **syslog**: similar to libimobiledevice's idevicesyslog\n\n## Installation\nSimply install using npm\\yarn:\n```\nnpm install libijs\n```\nor\n```\nyarn add libijs\n```\n\n## Implementation Details\n* The deviceManager uses one permanent usbmuxd connection for device listing and monitoring. Thus, the deviceManager will always maintain an updated list of connected devices, reducing the overhead of querying usbmuxd each time a device list is needed.\n* AFC implementation uses the \"packet number\" to track requests\\responses, enabling it to send multiple requests simultaneously. For example, when downloading a remote folder, \"download file\" requests are sent while \"walking\" the remote folder, which seems to greatly improve performance.\n* We use our own implementations for the usbmux client and binary plist handling.\n* Instead of using Promises and EventEmitters, we use our internal [JarvisEmitter](https://github.com/mceSystems/jarvis-emitter).\n\n## Usage\\API examples\nTODO\n\n### Examples\n* Connect to lockdownd and query a value:\n\t```javascript\n\tconst libijs = require(\"libijs\");\n\tconst meaco = require(\"meaco\");\n\t\n\tconst udid = ...;\n\t\n\tconst queryDeviceVersion = function queryDevice(device) {\n\t\treturn meaco(function* doQueryDevice() {\n\t\t\t// Connect to lockdownd\n\t\t\tconst lockdownClient = yield libijs.lockdownd.getClient(device);\n\t\t\t\n\t\t\t// Query the device type and iOS version\n\t\t\tconst productType = yield lockdownClient.getValue(null, \"ProductType\");\n\t\t\tconst iosVersion = yield lockdownClient.getValue(null, \"ProductVersion\");\n\t\t\tconsole.log(`${productType} device running iOS ${iosVersion}`);\n\t\t\t\n\t\t\tyield lockdownClient.close();\n\t\t});\n\t};\n\t\n\tconst deviceManager = libijs.createClient().deviceManager;\n\tdeviceManager.ready(() =\u003e {\n\t\tconst device = deviceManager.getDevice(udid);\n\t\tif (device) {\n\t\t\tqueryDeviceVersion(device);\n\t\t} else {\n\t\t\tconsole.log(\"Couldn't find device\");\n\t\t}\n\t});\n\t```\n\n* Download a file using the AFC stream API:\n\t```javascript\n\tconst libijs = require(\"libijs\");\n\tconst meaco = require(\"meaco\");\n\tconst JarvisEmitter = require(\"jarvis-emitter\");\n\tconst fs = require(\"fs\");\n\n\tconst udid = ...;\n\n\tconst afcExample = function afcExample(afcClient) {\n\t\treturn meaco(function* doAfcExample() {\n\t\t\t// List a remote dir\n\t\t\tyield afcClient.walk(\"/\", false, true)\n\t\t\t\t.item((item) =\u003e { console.log(`${item.relativeToRoot} - ${item.stats.st_size} bytes`); });\n\n\t\t\t// Download a file\n\t\t\tyield afcClient.downloadFile(\"DCIM/100APPLE/IMG_0001.JPG\", \"./IMG_0001.JPG\");\n\n\t\t\t// Use the stream api to read a file\n\t\t\tconsole.log(\"\\nVoiceMemos.plist:\");\n\t\t\tconst remoteFile = yield afcClient.openFileAsReadableStream(\"iTunes_Control/iTunes/VoiceMemos.plist\");\n\t\t\tconst fileReadDone = new JarvisEmitter();\n\t\t\tremoteFile\n\t\t\t\t.on(\"data\", (data) =\u003e {\n\t\t\t\t\tconsole.log(data.toString());\n\t\t\t\t})\n\t\t\t\t.on(\"end\", () =\u003e {\n\t\t\t\t\tfileReadDone.callDone();\n\t\t\t\t});\n\t\t\tyield fileReadDone;\n\n\t\t\t// Disconnect from the afcd service\n\t\t\tyield afcClient.close();\n\t\t});\n\t};\n\n\tconst deviceManager = libijs.createClient().deviceManager;\n\tdeviceManager.ready(() =\u003e {\n\t\tconst device = deviceManager.getDevice();\n\t\tlibijs.services.getService(device, \"afc\").done(afcExample);\n\t});\n\t```\n\n# Legal\n```\nRefer to the LICENSE file for libijs licensing terms.\nApple, iTunes, iPhone, iPad, Apple Watch, iPod, and iPod Touch are trademarks of Apple Inc.\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FmceSystems%2Flibijs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FmceSystems%2Flibijs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FmceSystems%2Flibijs/lists"}