azlyth / react-native-ssh

a library that enables React Native apps to execute commands over SSH -
https://ptrvldz.me/react-native-ssh/
71 stars 15 forks source link

react-native-ssh npm version

A library that allows a React Native app to run commands over SSH.

Usage

This library provides a single method: SSH.execute. Given SSH credentials and a command, a promise is returned. This promise resolves to the command's output as an array of strings.

import SSH from 'react-native-ssh';

config = {user: 'bob', host: 'example.com', password: 'p4$$w0rd'};
command = 'ls ~';

SSH.execute(config, command).then(
  result => console.log(result),
  error =>  console.log('Error:', error)
);

// A successful run would output:
// ['file1.txt', 'server.py', 'script.sh']

Installation

Android

iOS