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

to-ssh

v0.5.1

Published

Simple and easy to use Task-Oriented SSH2 wrapper

Downloads

8

Readme

Task-Oriented SSH

Description

Simple and easy to use SSH2 wrapper for node.js.

Why task-oriented? Because each command you want to invoke is being added to the queue as task to run - it's for the sole purpose of giving you the ability to manipulate concurrency.

You can add 5 tasks to queue and run them all in the same time or run them one by one. It's up to you.

Requirements

  • node.js - v0.8.7 or newer ([@todo] - check it - may run on even lower versions)

Features

  • Handles multiple connections to different hosts in the same time
  • Can queue requests or send them in parallel
  • Runs callbacks asynchronously
  • Easy to implement, use and maintain

Installation

$ npm install to-ssh

Examples & API

Initialize

var ToSSH = require('to-ssh');
var ssh = new ToSSH(options);
  • options {object} - required - object with options necessary to establish connection
    • options.host {string} - required - hostname
    • options.username {string} - optional - username; default: "root"
    • options.privateKey {string} - optional - private key or path to your private key; default: null
    • options.port {number} - optional - port; default: 22
    • options.conecurrency {number} - optional - max number of concurrent connections to the host; default: 1
    • options.password {string} - optional - password; default: null
    • options.passphrase {string} - optional - password to the encrypted privateKey; default: null

NOTE: You always have to specify either privateKey or password!

var ssh = new ToSSH({
    host: "http://github.com",
    privateKey: fs.readFileSync({{ path-to-your-key }})
});

ssh.connect([callback])

Connects to the host specified in options.

  • callback {function} - callback to be invoked on connection success/error. If an error occurs while connecting an {string} error will be passed to the callback
ssh.connect(function(error) {
    if(!error) {
        console.log("Connected!"); // -> "Connected!"
    }
});

ssh.addTask(command, [callback])

Adds the tasks to queue and executes if possible.

  • command {string} - command to be executed
  • callback {function} - callback to be invoked after command's execution. Two parameters which will contain the output will be passed to the function: stdout, stderr, both of the {string} type
ssh.addTask('whoami', function(stdout, stderr) {
    if(!stderr) {
        console.log(stdout); // -> "root"
    }
});

ssh.disconnect()

Disconnects from the host.

ssh.disconnect();