npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details


  • User packages



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.


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




`Reader` and `Writer` streams for Microsoft WAVE audio files





Reader and Writer streams for Microsoft WAVE audio files

Build Status

This module offers streams to help work with Microsoft WAVE files.


Install through npm:

$ npm install wav


Here's how you would play a standard PCM WAVE file out of the speakers using node-wav and node-speaker:

var fs = require('fs');
var wav = require('wav');
var Speaker = require('speaker');

var file = fs.createReadStream('track01.wav');
var reader = new wav.Reader();

// the "format" event gets emitted at the end of the WAVE header
reader.on('format', function (format) {

  // the WAVE header is stripped from the output of the reader
  reader.pipe(new Speaker(format));

// pipe the WAVE file to the Reader instance



The Reader class accepts a WAV audio file written to it and outputs the raw audio data with the WAV header stripped (most of the time, PCM audio data will be output, depending on the audioFormat property).

A "format" event gets emitted after the WAV header has been parsed.


The Writer class accepts raw audio data written to it (only PCM audio data is currently supported), and outputs a WAV file with a valid WAVE header at the beginning specifying the formatting information of the audio stream.

Note that there's an interesting problem, because the WAVE header also specifies the total byte length of the audio data in the file, and there's no way that we can know this ahead of time. Therefore the WAVE header will contain a byte-length if 0 initially, which most WAVE decoders will know means to just read until EOF.

Optionally, if you are in a situation where you can seek back to the beginning of the destination of the WAVE file (like writing to a regular file, for example), then you may listen for the "header" event which will be emitted after all the data has been written, and you can go back and rewrite the new header with proper audio byte length into the beginning of the destination (though if your destination is a regular file, you should use the the FileWriter class instead).

Default options:

  "channels": 2,
  "sampleRate": 44100,
  "bitDepth": 16

FileWriter(path, options)

The FileWriter class is, essentially, a combination of fs.createWriteStream() and the above Writer() class, except it automatically corrects the header after the file is written. Options are passed to both Writer() and fs.createWriteStream().

Example usage with mic:

var FileWriter = require('wav').FileWriter;
var mic = require('mic'); // requires arecord or sox, see

var micInstance = mic({
  rate: '16000',
  channels: '1',
  debug: true

var micInputStream = micInstance.getAudioStream();

var outputFileStream = new FileWriter('./test.wav', {
  sampleRate: 16000,
  channels: 1



setTimeout(function() {
}, 5000);