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

gifsockets

v0.1.2

Published

Stream never-ending animated GIFs

Readme

gifsockets Build status

Stream never-ending animated GIFs

This is part of the gifsockets project. It creates a mediator for streams to subscribe to as new GIF frames are written.

Want to see gifsockets in action? See the demo:

http://gifsockets.twolfson.com/

Getting Started

Install the module with: npm install gifsockets

// Pass any writable stream as a listener to gifsocket
var gifsocket = new require('gifsockets');
gifsocket.addListener(stream, function (err) {
  // Write a new GIF frame to the stream
  // WARNING: YOUR DATA WILL BE MUTATED.
  // PLEASE CLONE IT BEFORE HAND IF YOU ARE WORRIED ABOUT IT.
  var rgbPixels = [0, 0, 0, /*, ...*/];
  gifsocket.writeRgbFrame(rgbPixels, function (err) {
    // Close the stream
    gifsocket.closeAll();
  });
});

Documentation

gifsockets exposes a constructor Gifsocket function as its module.exports.

new Gifsocket(options)

Constructor for a Gifsocket

  • options Object
    • options.width Number - Width of the output GIF
    • options.height Number - Height of the output GIF

gifsocket.addListener(stream, [cb])

Subscribe a writable stream to the stream of outgoing GIF frames

  • stream WritableStream - Writable stream to write GIF information to
  • cb Function - Optional error-first callback to run once the stream has received the GIF header
    • Signature should look like function (err) {}

gifsocket.writeRgbFrame(rgbPixels, [cb])

Write a new RGB based frame to all of the current subscribers

IF YOU USE THIS METHOD, IT WILL MUTATE rgbPixels.

PLEASE CLONE YOUR DATA IF YOU ARE WORRIED ABOUT CORRUPTION.

  • rgbPixels Number[] - Array of rgb pixels of the new frame
    • This should be the the same length as width * height * 3
    • [0, 10, 20, 30, 40, 50] represents 2 pixels; the first, r: 0, g: 10, b: 20; the second, r: 30, g: 40, b: 50
  • cb Function - Optional error-first callback to run once the frame has been drawn to all listeners
    • Signature should look like function (err) {}

gifsocket.writeRgbaFrame(rgbaPixels, [cb])

Write a new RGBA based frame to all subscribers

  • rgbaPixels Number[] - Array of rgba pixels for the next frame
    • Length should be width * height * 4
    • [0, 10, 20, 30, 40, 50, 60, 70] represents 2 pixels; the first, r: 0, g: 10, b: 20, a: 30; the second, r: 40, g: 50, b: 60, a: 70

gifsocket.closeAll([cb])

Write GIF footer to all open listeners and close them

  • cb Function - Optional error-first callback to run once the footer has written to all listeners
    • Signature should look like function (err) {}

Frequently asked questions

Why is this not on streams?

A streaming interface does not quite line up with what happens here. gifsockets that are receiving their first frame will not receive the same data as their second frame counterparts. As a result, a data event or read does not make sense as all listeners/readers are indistinguishable.

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint via grunt and test via npm test.

Donating

Support this project and others by twolfson via gittip.

Support via Gittip

Unlicense

As of Nov 18 2013, Todd Wolfson has released this repository and its contents to the public domain.

It has been released under the UNLICENSE.