Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

basic-sftp

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

basic-sftp

🤹🏻‍♀️ A basic promise-based SFTP Client

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
19
Maintainers
1
Weekly downloads
 
Created
Source

Basic SFTP

🤹🏻‍♀️ A basic promise-based SFTP Client

Install

   npm i basic-sftp

Usage

Import
  • ES Modules

    import { Client } from 'basic-sftp';
    
  • CommonJS

    const { Client } = require('basic-sftp');
    

Connect
const sftp = new Client();

await sftp.connect({
   host: '',
   port: 22,
   username: '',
   password: '',
});
  • The connection access extends all the ssh2 options
Reconnect
await sftp.reconnect();
Close Connection
await sftp.end();

Methods

ls
  • Lists the contents of a directory

    await sftp.ls(path);
    
is
  • Get the type from path: File | Directory | null

    await sftp.is(path);
    
    • File means that the remote path is a file
    • Directory means that the remote path is a directory
    • null means that the remote path doesn't exist
ensureDir
  • Creates the path recursively, if it does not exist

    await sftp.ensureDir(path);
    
uploadFile
  • Uploads a local file to the remote server

    await sftp.uploadFile(localPath, remotePath);
    
downloadFile
  • Downloads a remote file to the local workspace

    await sftp.downloadFile(remotePath, localPath);
    
  • Remove all files and directories from a directory, including the directory itself, if it exists

    await sftp.unlink(path);
    
getConnection
  • Brings up the original ssh2.sftp methods

    sftp.getConnection();
    


Credits

ContributionsGitHub
Authorwellwelwel

Keywords

FAQs

Package last updated on 08 Apr 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc