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-switcher

v3.2.0

Published

Switcher Node Addon

Downloads

5

Readme

Node-Switcher

Node-Switcher is the native NodeJS add-on for Switcher. It acts as a thin wrapper around Switcher's C++ API, allowing it to be included in Javascript applications. In the context of the Scenic stack, Node-Switcher is the link allowing Scenic Core to communicate with Switcher.

Node-Switcher is currently developed by the Société des Arts Technologiques [SAT], a non-profit artistic entity based in Montreal, CA. The current version of Node-Switcher has been tested with Ubuntu 18.04.

Installation

Dependencies

IMPORTANT: Take note that Node-Switcher 3.2.x is only compatible with Switcher 2.1.24 and up. Use Node-Switcher 3.1.2 if you plan to use a version of Switcher lower than 2.1.24.

| Name | Version | Command | Description | |----------------------------------|-------------|---------|-----------------------------------------------------------------------| | G++/GCC | >= 8 | sudo apt-get install gcc-8 g++-8 | GNU project C and C++ compiler | | libicu-dev | latest | sudo apt install libicu-dev | Development library for handling of unicode characters | | Git | latest | sudo apt-get install git | Distributed version control system used to get Node-Switcher source code | | NodeJS | >= 10.15.3 | See NodeJS installation instructions | JavaScript runtime which helps to build the Scenic engine | | NPM | >= 5.6.0 | Included with the NodeJS installation | JavaScript package manager used to build internal dependencies | | Shmdata | >= 1.3.32 | See Shmdata documentation | Library to share flows of data frames between processes via shared memory | | Switcher | >= 2.1.24 | See Switcher documentation | C++ engine allowing the streaming of data over IP networks |

Install with Scenic Core

Node-Switcher is specified as a dependency in Scenic Core's package.json. This means that Node-Switcher will be automatically downloaded, built and installed as part of Scenic Core's install process.

See Scenic Core's installation procedure for more information.

Install from Source

| Step | Command |------------------------------------|------------------------- | Clone the Node-Switcher repository | git clone [email protected]:sat-mtl/telepresence/node-switcher.git | Move into Node Switcher folder | cd node-switcher | Build the app | npm install

Additional Scripts

Additional NPM scripts are available to build the add-on:

node-gyp configure # configure node-gyp (optionnal)

npm run build
npm run build:debug # build for debug
npm run rebuild
npm run rebuild:debug # rebuild for debug

Install from Docker

The default Docker configuration uses the images built from Switcher. Docker-compose will fetch the develop branches from shmdata, switcher and node-switcher.

# Build the whole stack
docker-compose -f container/docker-compose.yml up

Build a Docker image

To build a Docker image of Node-Switcher, you'll need to build the Shmdata and Switcher images beforehand..

# Build node-switcher's image
docker build -t "node-switcher:develop" .

The node-switcher image uses [mutli-stage builds][docker-multi-stage] with 4 stages : dependencies, nodejs, build and clean. Theses stages use some build arguments :

| arguments | stages | description | default | |-----------------|---------------------|------------------------------------------|-----------------| | SWITCHER_IMAGE | dependencies | The switcher base image | registry.gitlab.com/sat-metalab/switcher | SWITCHER_TAG | dependencies | The tag of the switcher base image | develop | NODEJS_VERSION | nodejs | NodeJS version to use | 10 | NODEJS_DOWNLOAD | nodejs | Link to the NodeJS binary | https://deb.nodesource.com/setup_${NODEJS_VERSION}.x | BUILD_DIR | build and clean | Where node-switcher source is copied | /opt/node-switcher

The node-switcher instance could be executed directly with its REPL :

docker run -ti node-switcher:develop node-switcher-repl

Usage

Javascript Scripting

Node-Switcher allows you to write JavaScript scripts to control Switcher. For example, you can use it to create quiddities, change a quiddity's properties, establish SIP communication with others, etc.

Example:

const Switcher = require('node-switcher').Switcher

const sw = new Switcher('debug', console.log)

// create a new quiddity `jacksrc`
sw.create('jacksrc')

You can see all examples in the folder example.

REPL Interface

You can also use a Read-Eval-Print Loop (REPL) in order to test Node-Switcher in the terminal. Type the following command in your terminal to do so:

# Inside node-switcher/
./bin/repl.js

Debugging

The following Visual Studio Code debug task can help you debug Node-Switcher. lldb and the vadimcn.vscode-lldb VSCode extension must be installed before running this task.

{
  "configurations": [{
    "name": "Node Switcher (lldb)",
    "type": "lldb",
    "request": "launch",
    "program": "${env:HOME}/.bin/node",
    "args": [
      "${workspaceFolder:node-switcher}/examples/debug.js"
    ],
    "preLaunchTask": "npm: build:dev"
  }]
}

Technologies

This add-on uses C++ 17 and NodeJS >= 10.

The SAT uses Ubuntu 18.04, so testing priority is given to this version.

Documentation

The NodeJs API is documented with source comments into cpp files. The documentation can be generated with JSDoc by running the command :

npm run doc

Contributing

Check out our Contributing Guide to get started!

Versioning

SemVer is used for versioning. For the versions available, see the tags on this repository.

Authors

See here.

License

This project is licensed under the GNU General Public License version 3 - see the LICENSE file for details.

Acknowledgments

This project was made possible by the Société des Arts Technologiques [SAT].