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 🙏

© 2025 – Pkg Stats / Ryan Hefner

turtles

v0.0.1

Published

adds stream passing support to dnode callbacks

Downloads

14

Readme

Build Status

turtles

turtles: callback streams for dnode

adds stream passing support for dnode callbacks. i use it with dnode on top of shoe.

readable/writeable/duplex stream support in one!

examples

pipe a file


var t1 = turtles({
  lines:function(cb){
    var stream = fs.createReadStream('file.txt')
      .pipe(linestream())// parse it to lines of text
      .pipe(this.stream());

    cb(false,stream);
  }
});

t2 = turtles();

t2.on('remote',function(remote){
    remote.lines(function(err,stream){
      stream.on('data',function(line){
        console.log('a line:',line);
      })
    });
});

t2.pipe(t1).pipe(t2);

api

the api extends dnode with exactlly one method

turtles.stream()

  • returns a duplex stream
  • a stream is not cleaned up until both sides close. if you dont use one side it will be closed automatically for you.
  • if you only read from this stream and it ends is will close the write side for you and cleanup the stream.
  • if you only write from this stream and it ends is will close the read side for you and cleanup the stream.
  • you may pass these as data arguments to callbacks

the api reserves the name of one callback _turtles

thanks

@substack for making awesome stuff!

inception!

dnode over dnode

var turtles = require('turtles');

var value;

var oneTurtle = turtles({
  setValue:function(v){
    value = v;
  },
  moarTurtles:function(cb){
    var dnode = turtles({
      dnodeOnDnode:function(cb){
        cb(false,value)
      }
    });

    var stream = this.stream();

    stream.pipe(dnode).pipe(stream);

    dnode.on('remote',function(remote){
      remote.twoTurtleJiveTime(function(err,data){
        console.log(data);
        //
        // prints 'got the two turtle jive!'
        //
      });
    });

    cb(false,stream);

  }
})

var twoTurtle = turtles({});

twoTurtle.on('remote',function(remote){

  var firstTurtle = remote;

  remote.moarTurtles(function(err,stream){
    var dnode = turtles({
      twoTurtleJiveTime:function(cb){
        cb(false,'got the two turtle jive!');
      }
    });


    dnode.on('remote',function(remote){
      firstTurtle.setValue('ballerz')
      remote.dnodeOnDnode(function(err,data){
        console.log(data);
        //
        // prints 'ballerz'
        //
      });
    }); 

    dnode.pipe(stream).pipe(dnode);

  });
});

oneTurtle.pipe(twoTurtle).pipe(oneTurtle);