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 🙏

© 2024 – Pkg Stats / Ryan Hefner

yellow-stream

v0.0.14

Published

Provides stream utilties, such as multi-plexing and generalized receivers.

Downloads

146

Readme

YellowStream

YellowStream is a Node.js library for managing streams. The basic core goal of YellowStream is to do to streams what Jquery did to DOM code.

This module is published under the MIT license.

Installation Instructions

Local Directory

In the directory in question, run this command:

npm install yellow-stream

Global

Assuming you have the rights to do so, run this command:

npm install -g yellow-stream

Usage instructions

consolidator

Consolidator is basically a utility function, that takes a stream, takes all of the content from that stream, and when the content is all received, allows a function to be performed with the completed content. It's pretty much a "Stream to String" feature.

Consolidators take a streaming object, and output a similar object. Consolidators have two events: "error" and "end". Error will usually have an error object as a callback parameter. "end" will always have a callback parameter, which is the value of the string in the buffer.

The received streaming object must be capable of emitting "error", "data", and "end"; in the ususual ways.

consolidator example

var https = require("https");
var yellow = require("yellow-stream");
https.get("https://www.google.com", function(raw){
  var stream = new yellow.consolidator(raw);
  stream.on("error", function(e){
    console.log(e);
  });
  stream.on("end", function(value){
    console.log(value);
  });
});

FrameStreams

FrameStreams are intended for services like VOIP services, which have a continuous stream, and need the data segmented. The problem is that, usually, TCP sends packets of a certain regular size, which may or may not be the size of the data frames the developer needs. This takes an arbitrary stream, and converts its data emission into a format some human might want.

FrameStreams take a streaming object, and output a streaming object. FrameStreams have 3 events: "error", "data", and "end". "error" is for errors in the usual way. "data" is a dataframe of a garunteed size. "end" is emitted when the source stream closes. "end"'s callback function has a parameter that is the data left over in the buffer.

The received streaming object must be capable of emitting "error", "data", and "end"; in the ususual ways.

FrameStream Example

var https = require("https");
var yellow = require("yellow-stream");
https.get("https://www.google.com", function(raw){
    var stream = new yellow.toFrameStream(raw);
    stream.frameSize = 32;
    stream.on("error", function(e){
        console.log(e);
    });
    stream.on("data", function(value){
        console.log(value);
    });
    stream.on("end", function(value){
        console.log(value);
    });
});

NewLineStreams

NewLineStreams are intended for services such as IM systems, consoles, and certain database systems where one may need to break a stream up by lines.

NewLineStreams take a streaming object, and output a streaming object. NewLineStreams have 3 events: "error", "data", and "end". "error" is for errors in the usual way. "data" is a dataframe. "end" is emitted when the source stream closes. "end"'s callback function has a parameter that is the data left over in the buffer.

The received streaming object must be capable of emitting "error", "data", and "end"; in the ususual ways.

NewLineStream Example

var https = require("https");
var yellow = require("yellow-stream");
http.get("http://www.uglydress.com/", function(raw){
    var stream = new yellow.breakByLine(raw, true, true, true, true);
    stream.on("error", function(e){
        console.log(e);
    });
    stream.on("data", function(value){
        console.log(value);
        console.log("\n");
    });
    stream.on("end", function(value){
        console.log(value);
    });
});

SplitStreams

SplitStreams are for when one wants to break up a stream by certain phrases. This is useful in things like database clients.

SplitStreams take a streaming object, and output a streaming object. SplitStreams have 3 events: "error", "data", and "end". "error" is for errors in the usual way. "data" is a dataframe. "end" is emitted when the source stream closes. "end"'s callback function has a parameter that is the data left over in the buffer.

The received streaming object must be capable of emitting "error", "data", and "end"; in the ususual ways.

SplitStream Example

var http = require("http");
http.get("http://www.uglydress.com/", function(raw){
    var stream = new yellow.splitStream(raw, "\n");
    stream.on("error", function(e){
        console.log(e);
    });
    stream.on("data", function(value){
        console.log(value);
        console.log("\n");
    });
    stream.on("end", function(value){
        console.log(value);
    });
});