Skip to content

A random access storage compliant interface for SFTP files random access.

License

Notifications You must be signed in to change notification settings

little-core-labs/random-access-sftp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

random-access-sftp

A random access storage compliant interface for SFTP files random access.

Installation

$ npm install random-access-sftp

Usage

const sftp = require('random-access-sftp')
cont file = sftp(`sftp://user:password@hostname:9000/path/to/file`)

file.open((err) => {
  file.stat((err, stats) => {
    file.write(0, Buffer.from('hello'), (err) => {
      file.read(0, 5, console.log)
    })
  })
})

API

file = require('random-access-sftp')(uri[, opts])

Creates a random-access-storage interface to a SFTP file where uri is a valid URL string or WHATWG URL and opts is an optional options object that is merged into the parsed URL() object that uri is given to. In other words, uri can contain all of the properties needed to create a SFTP connection and point to the file that will be randomly accessed.

const file = sftp({
  pathname: '/path/to/file',
  host: 'example.com',
  password: 'password',
  username: 'alice',
  port: 9000
})

Or with a valid URL

const file = sftp('sftp://alice:password@example.com:9000/path/to/file')

License

MIT

About

A random access storage compliant interface for SFTP files random access.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published