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

c3docker

v0.1.0

Published

The aim of c3docker is to create a simple means of communication from nodejs to docker and vise versa.

Downloads

3

Readme

c3docker

The aim of c3docker is to give a simple means of communication from nodejs to docker and vise versa. It will not fork all the docker functionality to nodejs. c3docker is just there for talking.

c3docker uses c3io to transfer data from docker to node and back.

WORK IN PROGRESS - NOT STABLE

Basic usage

var c3docker = require('c3docker')

c3docker({Cmd: ['/data/simple.js']}).then(function(container) {
  container.c3io
    .on('message', function(msg) {
      // input request
      if ( msg.stdin ) {
        // send message [string]
        this.stdin = 'Hello World'
      }
      // stderr stream
      else if ( msg.stderr ) {
        console.log('stderr', msg.toString('utf8'))
      }
      // stdout stream
      else {
        console.log('stdout', msg.toString('utf8'))
      }
    })

  container.start({Binds: [__dirname+':/data']}, function(err, exec) {
    // do stuff
  })
}).done()
  • dokerode is used to remote control docker. Please refer there for more information to control docker.
  • How the communication works between c3docker and the docker itself please visit c3io.

Firstly c3docker takes some options (see dockerode - createContainer). Then it returns a promise. If successful the requested container will be passed over. With that you can do stuff. Hopefully.

If you want to extend c3docker range of commands you just can do that like this..

c3io.r2d2.kil = function(_data) {
  this.container.kill(function(err) {
    // container killed
  })
}

use case: casperjs

NOTE

c3io works only with phatomjs as engine for casperjs. As long slimerjs has not implemented (see issue) system.stdin, this module will only be able to communicate one way, casper to node!

Notice: First run could be slow if its necessary to pull image

... see latter example