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

ni-visa

v0.0.2

Published

Node.js bindings for NI-VISA

Readme

ni-visa

ni-visa is a Node.js library that allows you to interface with instruments using the NI-VISA standard. It provides an easy-to-use API for managing VISA resources and communicating with instruments. The library expects that RsVisa is installed on your system. Alternatively, you can provide the path to your own dynamic library that supports the NI-VISA standard.

Features

  • Resource Management: List and filter VISA resources.
  • Instrument Communication: Open an instrument and send queries.
  • Graceful Cleanup: Automatically handles closing of instruments and resource managers.
  • Customizable: Option to specify a custom dynamic library path.

Requirements

  • RsVisa: The library is built to work with RsVisa.
  • Custom Dynamic Library: If RsVisa is not used, you can specify a custom path to a dynamic library that supports NI-VISA.
  • Node.js 23+: The examples and type stripping support require Node.js version 23 or later.

Installation

Install the library using npm:

npm install ni-visa

Usage

Below is a usage example demonstrating how to list VISA resources, filter for USB resources, open an instrument, query its identity, and then properly close all connections:

import { VisaInstrument, VisaResourceManager } from 'ni-visa';

const rm = new VisaResourceManager();

try {
  console.log('Listing resources...');
  const resources = rm.listResources();
  console.log(`Resources: ${resources}`);

  const usbResources = resources.filter((resource) => resource.startsWith('USB'));
  console.log(`USB resources: ${usbResources}...`);

  const selectedResource = usbResources[0];
  if (!selectedResource) {
    throw new Error('No USB resources found');
  }

  console.log(`Opening instrument: ${selectedResource}...`);
  const instr = rm.open(selectedResource);

  try {
    await onInstrumentOpened(instr);
  } finally {
    console.log('Closing instrument...');
    instr.close();
  }

} catch (error) {
  console.error(error);
} finally {
  console.log('Closing default resource manager...');
  rm.close();
}

async function onInstrumentOpened(instr: VisaInstrument) {
  const response = instr.query('*IDN?');
  console.log(`\nInstrument ID: ${response}\n`);
}

Custom Dynamic Library Path

If you want to use your own dynamic library that supports the NI-VISA standard, you can specify its path when initializing the VisaResourceManager:

const rm = new VisaResourceManager('/path/to/your/library');

Running the Examples

The example above is provided in the examples directory and can be run directly using Node.js 23+ (which supports TypeScript type stripping). Simply navigate to the example directory and run:

npm install
node example.ts

API Reference

VisaResourceManager

  • listResources(): string[]
    Lists all available VISA resources.
  • open(resource: string): VisaInstrument
    Opens a connection to the specified VISA resource.
  • close(): void
    Closes the resource manager and cleans up resources.

VisaInstrument

  • write(data: Buffer | string): void
    Writes data to the instrument.
  • query(command: string): string
    Sends a query command to the instrument and returns its response.
  • queryBinary(command: string, bufferSize = 1024): Buffer
    Sends a query command to the instrument and returns its response as a binary buffer.
  • close(): void
    Closes the instrument connection.

Contributing

Contributions are welcome! If you find any issues or have suggestions, please open an issue or submit a pull request on GitHub.

License

This project is licensed under the MIT License.

Support

If you have any questions or need further assistance, please open an issue on the GitHub repository.