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

w-ftp

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

w-ftp

A tool for ftp.

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
13
increased by8.33%
Maintainers
1
Weekly downloads
 
Created
Source

w-ftp

A tool for ftp.

language npm version license gzip file size npm download jsdelivr download

Documentation

To view documentation or get support, visit docs.

Installation

Using npm(ES6 module):

Note: w-ftp is mainly dependent on the fork of jsftp, lodash and wsemi.

npm i w-ftp
Example for download:

Link: [dev source code]

import path from 'path'
import fs from 'fs'
import WFtp from './src/WFtp.mjs'


async function test_up() {
    let r

    let ftp = WFtp()
    // console.log('ftp', ftp)

    await ftp.conn({
        hostname: `hostname`,
        port: `port`,
        username: `username`,
        password: `password`,
    })

    let fps = await ftp.ls('.')
    console.log('ftp.ls', fps[0], fps.length)

    r = await ftp.upload('./_test_upload_client/DECL_20210805055044.csv', './DECL_20210805055044.csv', (p) => {
        console.log('ftp.upload p', p.name, p.progress)
    })
    console.log('ftp.upload', r)

    r = await ftp.syncToRemote('./_test_upload_client', '.', (p) => {
        console.log('ftp.syncToRemote p', p.name, p.progress)
    })
    console.log('ftp.syncToRemote', r)

    r = await ftp.quit()
    console.log('ftp.quit', r)

}
test_up()
    .catch((err) => {
        console.log(err)
    })
// ftp.ls {
//   name: 'DECL_202108.csv',
//   type: 0,
//   time: 1658366760000,
//   size: '218690',
//   owner: 'ftp',
//   group: 'ftp',
//   userPermissions: { read: true, write: true, exec: false },
//   groupPermissions: { read: true, write: true, exec: false },
//   otherPermissions: { read: true, write: true, exec: false }
// } 73
// ftp.upload p DECL_20210805055044.csv 75.71339448693362
// drain
// ftp.upload p DECL_20210805055044.csv 100
// ftp.upload ok
// ftp.syncToRemote { num: 0, files: [] }
// ftp.quit { code: 221, text: '221 Goodbye.', isMark: false, isError: false }

Example for upload:

Link: [dev source code]

import path from 'path'
import fs from 'fs'
import WFtp from './src/WFtp.mjs'


async function test_dw() {
    let r

    let ftp = WFtp()
    // console.log('ftp', ftp)

    await ftp.conn({
        hostname: `hostname`,
        port: `port`,
        username: `username`,
        password: `password`,
    })

    let fps = await ftp.ls('.')
    console.log('ftp.ls', fps[0], fps.length)

    r = await ftp.download('./DECL_20210805055044.csv', './_test_download_client/DECL_20210805055044.csv', (p) => {
        console.log('ftp.download p', p.name, p.progress)
    })
    console.log('ftp.download', r)

    r = await ftp.syncToLocal('.', './_test_download_client', (p) => {
        console.log('ftp.syncToLocal p', p.name, p.progress)
    })
    console.log('ftp.syncToLocal', r)

    r = await ftp.quit()
    console.log('ftp.quit', r)

}
test_dw()
    .catch((err) => {
        console.log(err)
    })
// ftp.ls {
//   name: 'DECL_202108.csv',
//   type: 0,
//   time: 1658302140000,
//   size: '218690',
//   owner: 'ftp',
//   group: 'ftp',
//   userPermissions: { read: true, write: true, exec: false },
//   groupPermissions: { read: true, write: true, exec: false },
//   otherPermissions: { read: true, write: true, exec: false }
// } 74
// ftp.download p DECL_20210805055044.csv 4.7320871554333515
// ftp.download p DECL_20210805055044.csv 9.464174310866703
// ftp.download p DECL_20210805055044.csv 14.196261466300053
// ftp.download p DECL_20210805055044.csv 18.928348621733406
// ftp.download p DECL_20210805055044.csv 23.660435777166754
// ftp.download p DECL_20210805055044.csv 28.392522932600105
// ftp.download p DECL_20210805055044.csv 33.12461008803346
// ftp.download p DECL_20210805055044.csv 37.85669724346681
// ftp.download p DECL_20210805055044.csv 42.58878439890016
// ftp.download p DECL_20210805055044.csv 47.32087155433351
// ftp.download p DECL_20210805055044.csv 52.05295870976686
// ftp.download p DECL_20210805055044.csv 56.78504586520021
// ftp.download p DECL_20210805055044.csv 61.517133020633565
// ftp.download p DECL_20210805055044.csv 66.24922017606691
// ftp.download p DECL_20210805055044.csv 70.98130733150026
// ftp.download p DECL_20210805055044.csv 75.71339448693362
// ftp.download p DECL_20210805055044.csv 80.44548164236697
// ftp.download p DECL_20210805055044.csv 85.17756879780032
// ftp.download p DECL_20210805055044.csv 89.90965595323367
// ftp.download p DECL_20210805055044.csv 94.64174310866701
// ftp.download p DECL_20210805055044.csv 99.37383026410038
// ftp.download p DECL_20210805055044.csv 100
// ftp.download ok
// ftp.syncToLocal { num: 0, files: [] }
// ftp.quit { code: 221, text: '221 Goodbye.', isMark: false, isError: false }

Keywords

FAQs

Package last updated on 23 Jul 2022

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