1.2.1 • Published 8 years ago

ab-ftp v1.2.1

Weekly downloads
8
License
MIT
Repository
github
Last release
8 years ago

ab-ftp

FTP service wrapper using ES6 Promises.

Based on node-ftp package

Installation

npm install ab-ftp

Usage

Import the module const ftp = require('ab-ftp') and get a reference to work.

Create a client instance with your settings let client = new ftp(user, password, host)

Then you can operate with a basic set of methods

UPLOAD

let client = new ftp(user, password, host)
client.connect()
    .then(() => {
        const fs = require('fs')
        fs.readFile('./test/test.js', (err, data) => {
            client.postFile(data, 'test.js')
                .then(() => assert(true))
                .catch(err => console.error(err))
        })
    })
    .catch(err => console.error(err))

DOWNLOAD

let client = new ftp(user, password, host)
client.connect()
    .then(() => {
        client.getFile('test.js')
            .then(() => assert(true))
            .catch(err => console.error(err))
    })
    .catch(err => console.error(err))

LIST DIRECTORY

let client = new ftp(user, password, host)
client.connect()
    .then(() => {
        client.listDirectory('test')
            .then(result => console.log(`items: ${result.length}`))
            .catch(err => console.error(err))
    })
    .catch(err => console.error(err))

REMOVE

let client = new ftp(user, password, host)
client.connect()
    .then(() => {
        client.deleteFile('test.js')
            .then(() => assert(true))
            .catch(err => console.error(err))
    })
    .catch(err => console.error(err))

Road map

Operational methods can accept a single connection More operations to wrap

Licence

The MIT License (MIT)

Copyright (c) 2016 Àgora Binaria

1.2.1

8 years ago

1.2.0

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago

0.1.3

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago