npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

node-ios-device-fork

v0.4.1

Published

iOS device library

Downloads

58

Readme

node-ios-device Build Status

Queries connected iOS devices and installs apps.

NPM

Prerequisites

node-ios-device is currently compatible with the following versions:

  • Node.js
    • 0.8.x (module API v1)
    • 0.10.x (module API v11)
    • 0.12.x (module API v14)
  • io.js
    • 1.0.x (module API v42)
    • ^1.1.0 (module API v43)
    • 2.x (module API v44)

Only Mac OS X is supported.

Installation

From NPM:

npm install node-ios-device

From GitHub:

npm install git://github.com/appcelerator/node-ios-device.git

From Source:

git clone https://github.com/appcelerator/node-ios-device.git
cd node-ios-device
npm install
make

Example

var iosDevice = require('node-ios-device');

// get all connected iOS devices
iosDevice.devices(function (err, devices) {
	console.log('Connected devices:');
	console.log(devices);
});

// continuously watch for devices to be conected or disconnected
iosDevice.trackDevices(function (err, devices) {
	console.log('Connected devices:');
	console.log(devices);
});

// install an iOS app
iosDevice.installApp('<device udid>', '/path/to/my.app', function (err) {
	if (err) {
		console.error(err);
	} else {
		console.log('Success!');
	}
});

// dump the syslog output to the console
iosDevice.log('<device udid>', function (msg) {
	console.log(msg);
});

API

devices(callback)

Retrieves an array of all connected iOS devices.

  • {function} callback(err, devices) - A function to call with the connected devices
    • {null|Error} err - An Error if there was a problem, otherwise null
    • {Array<Object>} devices - An array of Device objects

Device objects contain the following information:

  • udid - The device's unique device id (e.g. "a4cbe14c0441a2bf87f397602653a4ac71eb0336")
  • name - The name of the device (e.g. "My iPhone")
  • buildVersion - The build version (e.g. "10B350")
  • cpuArchitecture - The CPU architecture (e.g. "armv7s")
  • deviceClass - The type of device (e.g. "iPhone", "iPad")
  • deviceColor - The color of the device (e.g. "black", "white")
  • hardwareModel - The device module (e.g. "N41AP")
  • modelNumber - The model number (e.g. "MD636")
  • productType - The product type or model id (e.g. "iPhone5,1")
  • productVersion - The iOS version (e.g. "6.1.4")
  • serialNumber - The device serial number (e.g. "XXXXXXXXXXXX")

There is more data that could have been retrieved from the device, but the properties above seemed the most reasonable.

trackDevices(callback)

Continuously retrieves an array of all connected iOS devices. Whenever a device is connected or disconnected, the specified callback is fired.

  • {Function} callback(err, devices) - A function to call with the connected devices
    • {null|Error} err - An Error if there was a problem, otherwise null
    • {Array<Object>} devices - An array of Device objects

Returns a function to discontinue tracking:

var off = iosDevice.trackDevices(function (err, devices) {
	console.log('Connected devices:');
	console.log(devices);
});

setTimeout(function () {
	// turn off tracking after 1 minute
	off();
}, 60000);

installApp(udid, appPath, callback)

Installs an iOS app on the specified device.

  • {String} udid - The devices udid
  • {String} appPath - The path to the iOS .app
  • {Function} callback(err) - A function to call when the install finishes
    • {null|Error} err - An Error if there was a problem, otherwise null

Currently, an appPath that begins with ~ is not supported.

The appPath must resolve to an iOS .app, not the .ipa file.

log(udid, callback)

Relays the iOS device's syslog line-by-line to the specified callback. The callback is fired for every line. Empty lines are omitted.

  • {String} udid - The devices udid
  • {Function} callback(msg) - A function to call with each line from the syslog
    • {String} msg - The line from the syslog

Returns a function to discontinue relaying the log output:

var off = iosDevice.log('<device udid>', function (msg) {
	console.log(msg);
});

setTimeout(function () {
	// turn off logging after 1 minute
	off();
}, 60000);

After calling log(), it will print out several older messages. If you are only interested in new messages, then you'll have to have use a timer and some sort of ready flag like this:

var ready = false;
var timer = null;

iosDevice.log('<device udid>', function (msg) {
	if (ready) {
		console.log(msg);
	} else {
		clearTimeout(timer);
		timer = setTimeout(function () {
			ready = true;
		}, 500);
	}
});

License

This project is open source and provided under the Apache Public License (version 2). Please make sure you see the LICENSE file included in this distribution for more details on the license. Also, please take notice of the privacy notice at the end of the file.

This project contains mobiledevice.h from https://bitbucket.org/tristero/mobiledeviceaccess and is available under public domain.

(C) Copyright 2012-2015, Appcelerator Inc. All Rights Reserved.