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 🙏

© 2026 – Pkg Stats / Ryan Hefner

touch-sprite-remote

v0.2.1

Published

Touch script remote API for Node.js

Readme

touch-sprite-remote

Build Status License

Touch script remote API for Node.js

Table of Contents

Installation

npm install touch-sprite-remote

Getting Started

import { fetchAuth, run, status } from 'touch-sprite-remote';

(async function () {
  const { auth } = await fetchAuth({
    key: '<my_key>',
    devices: ['<my_device_id>'],
  });
  const runResult = await run('192.168.1.23', { auth });
  console.log('run:', runResult); /* "ok" or "fail" */

  const statusResult = await status('192.168.1.23', { auth });
  console.log('status:', statusResult); /* "f00", "f01" or "f02" */
}());

API Reference

fetchAuth(options)

Fetch auth / access token.

Options
  • key (String): Developer access key
  • devices: ([String]): Devices IDs
  • expiresIn (Number): Expires in seconds. Defaults to 3600
Returns
{
  status: 200,
  message: 'error message if status is not 200',
  time: 1422930265, // current unix timestamp
  auth: 'auth / access token',
  expiresIn: 3600, // expires in second
  remainderToken: 4, // remainder token
}

getDeviceName(target)

Get device name.

Arguments
  • target (String): Device host target. eg: '192.168.1.23'
Returns

(String): Device name.


status(target[, options])

Get status.

Arguments
  • target (String): Device host target. eg: '192.168.1.23'
  • options (Object): Defines options.auth for access token (required)
Returns

(String): Returns one of these string:

  • f00: Free
  • f01: In running scripts
  • f02: In recording screen

run(target[, options])

Run script.

Arguments
  • target (String): Device host target. eg: '192.168.1.23'
  • options (Object): Defines options.auth for access token (required)
Returns

(String): ok or fail


stop(target[, options])

Stop script.

Arguments
  • target (String): Device host target. eg: '192.168.1.23'
  • options (Object): Defines options.auth for access token (required)
Returns

(String): ok or fail


upload(target[, options])

Upload file.

Arguments
  • target (String): Device host target. eg: '192.168.1.23'
  • options (Object):
    • auth (String): Access token (required)
    • file (String): Local file path
    • remoteFile (String): Remote file path
    • type (String): Defining root type. One of lua, res, log or plugin is supported. By default, if file ext is .lua, .luac or .txt, it would be lua, otherwise, it would be res
Returns

(String): ok or fail


TSRemote

TSRemote class. A TSRemote instance by calling new TSRemote(options) provides all methods above, but could only get and set auth once.

The options is almost the same with fetchAuth(options), but also provides these two auth cache getter and setter functions:

  • async getAuth(): Will call when calling any api needs auth. It's useful to get auth from your cache system
  • async setAuth(authObject): Will call when getAuth() doesn't return auth. The authObject is the same with the result of fetchAuth(). It's useful to save the auth to your cache system
Example
import TSRemote from 'touch-sprite-remote';

let cache;

(async function () {
  const tsr = new TSRemote({
    key: '<my_key>',
    devices: ['<my_device_id>'],

    /* add `getAuth()` and `setAuth()` functions */
    getAuth: async () => cache,
    setAuth: async ({ auth, expiresIn }) => (cache = auth),
  });

  /* no need `auth` option */
  const runResult = await tsr.run('192.168.1.23');
  const statusResult = await tsr.status('192.168.1.23');
}());
Additional instance methods
  • refreshToken(): Force refresh token
  • addDevices(device[, ...device]): Add device. Will refresh token
  • removeDevices(device[, ...device]): Add device. Will refresh token

License

MIT