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

rf-touchstone

v0.0.6

Published

A Javascript/TypeScript library for reading, manipulating, and writing Touchstone files (.snp files) used in radio frequency (RF) and microwave engineering.

Readme

RF-Touchstone

A Javascript/TypeScript library for reading, manipulating, and writing Touchstone files (.snp files) used in radio frequency (RF) and microwave engineering.

Tests Coverage

Overview

RF-Touchstone provides a complete solution for working with S-parameters and other network parameters in JavaScript/TypeScript environments. This library allows you to:

  • Read and parse Touchstone files (.s1p, .s2p, .s3p, etc.)
  • Manipulate network parameter data
  • Write data back to Touchstone format
  • Convert between different parameter representations (RI, MA, DB)

What is a Touchstone File?

Touchstone files are an industry-standard ASCII text format for representing network parameters of electrical circuits. Each file contains:

  • Comments (lines starting with !)
  • Option line (starts with #) specifying frequency units, parameter type, and data format
  • Network parameter data organized by frequency points

RF-Touchstone currently supports versions 1.0 and 1.1 of the Touchstone specification.

Key Features

  • Full support for Touchstone file format (v1.0 and v1.1)
  • Parameter type support: S, Y, Z, G, H
  • Format conversions: RI (Real/Imaginary), MA (Magnitude/Angle), DB (Decibel/Angle)
  • TypeScript implementation with strong typing
  • Comprehensive test suite
  • Published on NPM: rf-touchstone

Installation

Via NPM/Yarn

npm install rf-touchstone
# or
yarn add rf-touchstone

Via CDN (Browser)

<!-- Using unpkg -->
<script src="https://unpkg.com/rf-touchstone"></script>

<!-- Or using jsDelivr -->
<script src="https://cdn.jsdelivr.net/npm/rf-touchstone"></script>

<script>
  // Access via global variable
  const { Touchstone } = window.Touchstone
</script>

Quick Start

import { Touchstone } from 'rf-touchstone'

// Read from a URL (nports automatically determined from .s2p)
const touchstone = await Touchstone.fromUrl('https://example.com/device.s2p')
console.log(touchstone.name) // 'device' - automatically extracted from filename

// Or from a File object (e.g., from a file input)
const touchstoneFromFile = await Touchstone.fromFile(file)
console.log(touchstoneFromFile.name) // Filename without extension

// Or from a raw text string with optional name
const touchstoneFromText = Touchstone.fromText(fileContent, 2, 'my_measurement')

// Access data
console.log(touchstone.frequency.f_scaled)
console.log(touchstone.matrix)

// The name property is useful for plot legends and default filenames
touchstone.name = 'modified_network' // Can be modified

// Write back to Touchstone format
const newContent = touchstone.writeContent()

Online Demo

Experience the library in action with our Touchstone Converter (React). It allows you to:

  • Load local or remote .snp files
  • Inspect metadata and network data
  • Convert formats and units on the fly
  • Download modified Touchstone files

Examples

This repository includes examples to demonstrate the usage of rf-touchstone in different contexts.

  • React Example: A complete web application (using Vite and TypeScript) that showcases how to build a Touchstone file viewer/converter. You can try the Live Demo.

Documentation

For detailed documentation, please visit:

Development

For information on setting up a development environment and contributing to the project, see development.md.

Credits and Acknowledgments

This project uses test data files (e.g., .sNp files) sourced from or generated by scikit-rf.

  • scikit-rf License: The test files are used under the terms of the BSD 3-Clause License.
  • The original copyright and "Created with skrf (http://scikit-rf.org)" headers in these files have been preserved as required by the license.

We thank the scikit-rf contributors for their excellent work in providing these resources to the RF community. Additionally, we use scikit-rf as a reference to validate our library's parsing and manipulation results, ensuring cross-platform consistency and accuracy.

License

This project is licensed under the MIT License - see the LICENSE file for details.