UNPKG

@octalmage/node-appletv

Version:

A Node.js library for communicating with an Apple TV

35 lines (32 loc) 1.25 kB
import { Credentials } from './lib/credentials'; import { AppleTV } from './lib/appletv'; import { Browser } from './lib/browser'; import { NowPlayingInfo } from './lib/now-playing-info'; import { Message } from './lib/message'; import { SupportedCommand } from './lib/supported-command'; /** * A convenience function to scan for AppleTVs on the local network. * @param uniqueIdentifier An optional identifier for the AppleTV to scan for. The AppleTV advertises this via Bonjour. * @param timeout An optional timeout value (in seconds) to give up the search after. * @returns A promise that resolves to an array of AppleTV objects. If you provide a `uniqueIdentifier` the array is guaranteed to only contain one object. */ export function scan(uniqueIdentifier?: string, timeout?: number): Promise<AppleTV[]> { let browser = new Browser(); return browser.scan(uniqueIdentifier, timeout); } /** * A convenience function to parse a credentials string into a Credentials object. * @param text The credentials string. * @returns A credentials object. */ export function parseCredentials(text: string): Credentials { return Credentials.parse(text); } export { AppleTV, Browser, NowPlayingInfo, Credentials, Message, SupportedCommand };