ssh-url

0.1.5 • Public • Published

ssh-url NPM version Build Status Dependency Status

Utilities to resolute and parse ssh url including scp-like syntax SSH protocol.

Installation

$ npm install ssh-url --save

Usage

var url = require('ssh-url');
 
var parsed = url.parse('git@github.com:kaelzhang/node-ssh-url.git');
// -> {
//   protocol: null,
//   user: 'git',
//   hostname: 'github.com',
//   pathname: '/kaelzhang/node-ssh-url.git'
// }
 
url.format(parsed);
// -> git@github.com:kaelzhang/node-ssh-url.git

url.parse(urlStr)

Takes a SSH URL string, and returns an object.

urlObj

For now, urlObj only contains four properties.

  • protocol null|String if null, indicates that urlStr uses scp-like syntax.
  • user String
  • hostname String for now, there's no port.
  • pathname String starts with '/'

url.format(urlObj)

Takes a parsed SSH URL object, and returns a formatted URL string.

Readme

Keywords

Package Sidebar

Install

npm i ssh-url

Weekly Downloads

199

Version

0.1.5

License

MIT

Last publish

Collaborators

  • kael