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

@bsdavidson/oink

v0.1.1

Published

A module for interacting with Onkyo recievers

Downloads

2

Readme

Oink

Build Status GitHub license

Oink is a Node library for controlling Onkyo receivers. This was inspired by the Python onkyo-eiscp library. Oink also makes use of a customized version of onkyo-eiscp's YAML file for code generation.

Oink provides:

  • A device class to communicate with receivers, and the ability to automatically discover receivers on a local network.
  • An HTTP handler to provide a REST API to communicate with a device.
  • A generated module of helper functions to make it easier to send commands to a device.

Installation

yarn add @bsdavidson/oink

Example

const http = require("http");
const {createDeviceHandler, discover} = require("oink");

async function main() {
  // Oink's discover method will search for devices on the network and return
  // an array of DiscoveredDevice objects.
  let discovered;
  do {
    discovered = await discover({deviceLimit: 1});
  } while (!discovered.length);

  // If you already know the host and port of your reciever,
  // you can call new Device() to create a Device instance
  // manually, rather than use discovery. For example:
  //
  //     const device = new Device("10.0.0.120", 60128, "1");
  //
  // But in this case, since we used discovery, you can call toDevice() on a
  // DiscoveredDevice instance to create a Device instance that can be used to
  // communicate with the receiver.
  const device = discovered[0].toDevice();

  // Device instances emit a data event for packets from the receiver.
  // Each incoming packet is a Packet instance containing the
  // command (e.g. PWR, MVL, ...), a parameter (e.g. "01", "somestring", ...),
  // and the device type (typically "1")
  device.on("data", packet => {
    console.log(packet);
  });

  // Call connect on a device to establish a persistant connection.
  await device.connect();

  // Send a command to a device by creating a command packet and passing it to
  // the send() method.
  //
  // Send an UP command to the Main Volume Level (MVL)
  const response = await device.sendCommand("MVL", "UP");
  console.log(response); // Packet { command: 'MVL', parameter: '1F', deviceType: '1' }

  // Oink also provides a way to create a standard HTTP handler which provides a
  // simple REST API to send and recieve commands to a device. For example,
  // to query the current master volume level (MVL), make a GET request like the
  // following:
  //
  //    $ curl http://127.0.0.1:3000/MVL
  //    {"command":"MVL","parameter":"1F","deviceType":"1"}
  http.createServer(createDeviceHandler(device)).listen(3000);
}

main();

Oink.