Skip to content

iDeviceJS Functions

Sam Neale edited this page Jan 17, 2024 · 7 revisions

Get Properties

const properties = await idevice.getProperties(deviceSerial, options);

This will return a series of properties from the device's plist (although represented as JSON/Object).

Options are represented in an object. The only option currently available is domain, which can accept the following values:

  • com.apple.disk_usage
  • com.apple.disk_usage.factory
  • com.apple.mobile.battery
  • com.apple.iqagent
  • com.apple.purplebuddy
  • com.apple.PurpleBuddy
  • com.apple.mobile.chaperone
  • com.apple.mobile.third_party_termination
  • com.apple.mobile.lockdownd
  • com.apple.mobile.lockdown_cache
  • com.apple.xcode.developerdomain (REMOVED iOS 17)
  • com.apple.international
  • com.apple.mobile.data_sync
  • com.apple.mobile.tethered_sync
  • com.apple.mobile.mobile_application_usage
  • com.apple.mobile.backup
  • com.apple.mobile.nikita
  • com.apple.mobile.restriction
  • com.apple.mobile.user_preferences
  • com.apple.mobile.sync_data_class
  • com.apple.mobile.software_behavior
  • com.apple.mobile.iTunes.SQLMusicLibraryPostProcessCommands
  • com.apple.mobile.iTunes.accessories
  • com.apple.mobile.internal
  • com.apple.mobile.wireless_lockdown
  • com.apple.fairplay
  • com.apple.iTunes
  • com.apple.mobile.iTunes.store
  • com.apple.mobile.iTunes
  • com.apple.fmip
  • com.apple.Accessibility

Get Packages

const packages = await idevice.getPackages(deviceSerial, options);

This will return an array of package names installed on the device in the form of strings.

Options are represented in an object. The only option currently available is list, which can accept the following values:

  • user (Those installed by the user) (Default)
  • systems (Those installed by iOS)
  • all

Get Diagnostics

const diagnostics = await idevice.diagnostics(deviceSerial);

Similar to get properties. No options available.

Get Screen Resolution

const resolution = await idevice.getResolution(deviceSerial);

Returns an object with various details about the device's screen. Returned in the format:

{
    width: number,
    height: number,
    scale: number,
    points: {
        width: number|null,
        height: number|null
    }
}

Read/Set Device Name

const name = await idevice.name(deviceSerial, newName);

Allows you to read or set the name of the iOS device. Leave the newName argument as undefined to return a string with the device's name. If the newName argument is set, it will return a confirmation string, includes some filler text from iOS, not just its new name.

Reboot Device

idevice.reboot(deviceSerial);

Command the device to reboot.

Important

This function's promise may resolve before device has restarted.

Shutdown Device

idevice.shutdown(deviceSerial);

Command the device to shutdown.

Important

This function's promise may resolve before device has shutdown.

Enter Recovery Mode

idevice.enterRecovery(deviceSerial);

Command the device to enter recovery mode.

Important

This function's promise may resolve before the device has entered recovery mode

Exit Recovery Mode

idevice.exitRecovery(deviceSerial);

Command the device to exit recovery mode.

Important

This function's promise may resolve before the device has exited recovery mode

Get Device Storage

const storage = await idevice.getStorage(deviceSerial);

Will retrieve information about the device's storage and resolve in the following format:

{
  size: number (bytes),
  used: number (bytes),
  free: number (bytes),
  free_percent: float (%)
}

Get Battery

const battery = await idevice.getBattery(deviceSerial);

Will retrieve information about the device's battery and resolve them in the following format:

{
  BatteryCurrentCapacity: number (percent),
  BatteryIsCharging: boolean,
  ExternalChargeCapable: boolean,
  ExternalConnected: boolean,
  FullyCharged: boolean,
  GasGaugeCapability: boolean,
  HasBattery: boolean,
  level: number
}

Get logs

const tmpDir = await idevice.logs(deviceSerial);

This function will retrieve the logs from your device and transfer them to the Mac, it will place them in a temporary directory generated by the filesystem. The function resolves the path to this directory.