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

libshout-js

v1.0.1

Published

Native Node.js bindings for the libshout library

Readme

libshout-js

Native Node.js Libshout bindings for libshout 2.4.1 (latest).

Libshout is a C library for streaming audio to icecast or shoutcast-compatible servers. It supports four audio formats and four protocols. It handles the networking and communication to the server, allowing users to focus on programmatic control.

More information: http://icecast.org

Usage

To use libshout-js, you must first install the libshout library. Consult your OS documentation on how to install libshout, for example:

yum install libshout
apt-get install libshout    
brew install libshout

Install nodeshout with yarn or npm:

yarn install libshout-js

Use as follows:

    // Import
    const Libshout = require('libshout-js')

    // Create the instance. Specify path to the .so/.dll/.dylib file. 
    // If no path is set, it will attempt to load the standard dll locations.
    const ls = new Libshout('path/to/libshout.so')

    // Configure the connection
    const ls = new Libshout('/usr/local/lib/libls')
    ls.setHost('localhost')
    ls.setPort(8000)
    ls.setUser('user')
    ls.setPassword('pass')
    ls.setMount('mountpoint')

    // Set stream metadata
    ls.setMeta('description', 'A lovely stream')

    // Some constants are defined for you.
    ls.setFormat(Libshout.CONST.FORMATS.SHOUT_FORMAT_MP3)

    // ls.setAudioInfo('bitrate', '192')
    // ls.setAudioInfo('samplerate', '44100')
    // ls.setAudioInfo('channels', '2')
    ls.setAudioInfo({
        bitrate: '192',
        samplerate: '44100',
        channels: '2',
    })

Open the connection.

    try {
        ls.open()
    } catch (err) {
        console.warn(err)
    }

If connection is successful, .open() will return string SHOUT_ERR_SUCCESS, otherwise it will throw an error. After successful connection, you can pipe audio data through the provided writeStream stream, or manually send data.

    const fileStream = new fs.createReadStream('song.mp3')
    fileStream.pipe(ls.writeStream)
    ls.writeStream.on('finish', () => console.log('Song finished'))

    // or,
    ls.send(buffer, bufferLen)

If sending data manually, there are two ways to synchronize it. .sync() will block the thread until ready. .getDelay() will return the time in ms you should wait before sending the next chunk.

Metadata

Icecast only supports track metadata for MP3 streams. Vorbis streams are expected to embed metadata as vorbis comments in the audio stream.

// Create a metadata instance
const metadata = Libshout.createMetadata()

// Set the metadata within the object. Supported values are defined in constants.
metadata.add('title', 'A Love Supreme Pt. I – Acknowledgement')

// Then, you must apply the metadata to the server connection object.
ls.setMetadata(metadata);

More information

The C code is heavily documented in the comments for constants.js and bindings.js. Look there for more Libshout specific information.