Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
A tool for FTP(FTP, SFTP).
To view documentation or get support, visit docs.
Note:
w-ftp
is mainly dependent on the fork ofjsftp
,ssh2-sftp-client
,lodash
andwsemi
.
npm i w-ftp
Link: [dev source code]
import path from 'path'
import fs from 'fs'
import WFtp from './src/WFtp.mjs'
// import WFtp from './dist/w-ftp.umd.js'
//st
let fp = path.resolve('../', './_data', 'settings.json')
let j = fs.readFileSync(fp, 'utf8')
let st = JSON.parse(j)
console.log(st)
async function test_dw() {
let r
let ftp = WFtp({
transportation: 'FTP',
hostname: st.FTP.dw.hostname,
port: st.FTP.dw.port,
username: st.FTP.dw.username,
password: st.FTP.dw.password,
})
// console.log('ftp', ftp)
await ftp.conn()
async function core() {
let fps = await ftp.ls('.')
console.log('ftp.ls', fps[0], fps.length)
r = await ftp.isFile('./DECL_20210805055044.csv')
console.log('ftp.isFile', r)
r = await ftp.isFile('./test/DECL_20210805055044.csv')
console.log('ftp.isFile', r)
r = await ftp.isFolder('./DECL_20210805055044.csv')
console.log('ftp.isFolder', r)
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)
}
await core()
.catch((err) => {
console.log(err)
})
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: 1692318720000,
// 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 },
// ctime: '2023-08-18T08:32:00+08:00',
// isFolder: false
// } 5
// ftp.isFile true
// ftp.isFile true
// ftp.isFolder false
// 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 p DECL_202108.csv 29.967533952169738
// ftp.syncToLocal p DECL_202108.csv 59.935067904339476
// ftp.syncToLocal p DECL_202108.csv 89.90260185650921
// ftp.syncToLocal p DECL_202108.csv 100
// ftp.syncToLocal p DECL_20210805055629.csv 4.709754616437716
// ftp.syncToLocal p DECL_20210805055629.csv 9.419509232875432
// ftp.syncToLocal p DECL_20210805055629.csv 14.129263849313148
// ftp.syncToLocal p DECL_20210805055629.csv 18.839018465750865
// ftp.syncToLocal p DECL_20210805055629.csv 23.548773082188582
// ftp.syncToLocal p DECL_20210805055629.csv 28.258527698626295
// ftp.syncToLocal p DECL_20210805055629.csv 32.968282315064016
// ftp.syncToLocal p DECL_20210805055629.csv 37.67803693150173
// ftp.syncToLocal p DECL_20210805055629.csv 42.38779154793944
// ftp.syncToLocal p DECL_20210805055629.csv 47.097546164377164
// ftp.syncToLocal p DECL_20210805055629.csv 51.80730078081488
// ftp.syncToLocal p DECL_20210805055629.csv 56.51705539725259
// ftp.syncToLocal p DECL_20210805055629.csv 61.22681001369031
// ftp.syncToLocal p DECL_20210805055629.csv 65.93656463012803
// ftp.syncToLocal p DECL_20210805055629.csv 70.64631924656575
// ftp.syncToLocal p DECL_20210805055629.csv 75.35607386300346
// ftp.syncToLocal p DECL_20210805055629.csv 80.06582847944118
// ftp.syncToLocal p DECL_20210805055629.csv 84.77558309587889
// ftp.syncToLocal p DECL_20210805055629.csv 89.4853377123166
// ftp.syncToLocal p DECL_20210805055629.csv 94.19509232875433
// ftp.syncToLocal p DECL_20210805055629.csv 98.90484694519203
// ftp.syncToLocal p DECL_20210805055629.csv 100
// ftp.syncToLocal p DECL_202109.csv 30.538818913415255
// ftp.syncToLocal p DECL_202109.csv 61.07763782683051
// ftp.syncToLocal p DECL_202109.csv 91.61645674024575
// ftp.syncToLocal p DECL_202109.csv 100
// ftp.syncToLocal p DECL_202108.csv 29.967533952169738
// ftp.syncToLocal p DECL_202108.csv 59.935067904339476
// ftp.syncToLocal p DECL_202108.csv 89.90260185650921
// ftp.syncToLocal p DECL_202108.csv 100
// ftp.syncToLocal p DECL_20210805055044.csv 4.7320871554333515
// ftp.syncToLocal p DECL_20210805055044.csv 9.464174310866703
// ftp.syncToLocal p DECL_20210805055044.csv 14.196261466300053
// ftp.syncToLocal p DECL_20210805055044.csv 18.928348621733406
// ftp.syncToLocal p DECL_20210805055044.csv 23.660435777166754
// ftp.syncToLocal p DECL_20210805055044.csv 28.392522932600105
// ftp.syncToLocal p DECL_20210805055044.csv 33.12461008803346
// ftp.syncToLocal p DECL_20210805055044.csv 37.85669724346681
// ftp.syncToLocal p DECL_20210805055044.csv 42.58878439890016
// ftp.syncToLocal p DECL_20210805055044.csv 47.32087155433351
// ftp.syncToLocal p DECL_20210805055044.csv 52.05295870976686
// ftp.syncToLocal p DECL_20210805055044.csv 56.78504586520021
// ftp.syncToLocal p DECL_20210805055044.csv 61.517133020633565
// ftp.syncToLocal p DECL_20210805055044.csv 66.24922017606691
// ftp.syncToLocal p DECL_20210805055044.csv 70.98130733150026
// ftp.syncToLocal p DECL_20210805055044.csv 75.71339448693362
// ftp.syncToLocal p DECL_20210805055044.csv 80.44548164236697
// ftp.syncToLocal p DECL_20210805055044.csv 85.17756879780032
// ftp.syncToLocal p DECL_20210805055044.csv 89.90965595323367
// ftp.syncToLocal p DECL_20210805055044.csv 94.64174310866701
// ftp.syncToLocal p DECL_20210805055044.csv 99.37383026410038
// ftp.syncToLocal p DECL_20210805055044.csv 100
// ftp.syncToLocal {
// num: 5,
// files: [
// { path: './DECL_202108.csv', reason: 'no local file' },
// { path: './DECL_20210805055629.csv', reason: 'no local file' },
// { path: './DECL_202109.csv', reason: 'no local file' },
// { path: './test/DECL_202108.csv', reason: 'no local file' },
// { path: './test/DECL_20210805055044.csv', reason: 'no local file' }
// ]
// }
// ftp.quit { code: 221, text: '221 Goodbye.', isMark: false, isError: false }
Link: [dev source code]
import path from 'path'
import fs from 'fs'
import WFtp from './src/WFtp.mjs'
// import WFtp from './dist/w-ftp.umd.js'
//st
let fp = path.resolve('../', './_data', 'settings.json')
let j = fs.readFileSync(fp, 'utf8')
let st = JSON.parse(j)
console.log(st)
async function test_up() {
let r
let ftp = WFtp({
transportation: 'FTP',
hostname: st.FTP.up.hostname,
port: st.FTP.up.port,
username: st.FTP.up.username,
password: st.FTP.up.password,
})
// console.log('ftp', ftp)
await ftp.conn()
async function core() {
let fps = await ftp.ls('.')
console.log('ftp.ls', fps[0], fps.length) //_test_upload_srv預先建置test2資料夾, 故fps.length=1
r = await ftp.isFile('./DECL_20210805055044.csv')
console.log('ftp.isFile', r)
r = await ftp.isFile('./L1-DECL_20210805055044.csv')
console.log('ftp.isFile', r)
r = await ftp.isFile('./test/DECL_20210805055044.csv')
console.log('ftp.isFile', r)
r = await ftp.isFile('./test/L2-DECL_20210805055044.csv')
console.log('ftp.isFile', r)
r = await ftp.isFolder('./DECL_20210805055044.csv')
console.log('ftp.isFolder', r)
r = await ftp.isFolder('./test2')
console.log('ftp.isFolder', r)
r = await ftp.upload('./_test_upload_client/L1-DECL_20210805055044.csv', './L1-DECL_20210805055044.csv', (p) => {
console.log('ftp.upload p', p.name, p.progress)
})
console.log('ftp.upload', r)
r = await ftp.upload('./_test_upload_client/test/test2/L3-DECL_202108.csv', './test/test2/L3-DECL_202108.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)
}
await core()
.catch((err) => {
console.log(err)
})
r = await ftp.quit()
console.log('ftp.quit', r)
}
test_up()
.catch((err) => {
console.log(err)
})
// ftp.ls {
// name: 'L1-DECL_20210805055044.csv',
// type: 0,
// time: 1692501180000,
// size: 1384928,
// 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 },
// ctime: '2023-08-20T11:13:00+08:00',
// isFolder: false
// } 3
// ftp.isFile false
// ftp.isFile true
// ftp.isFile false
// ftp.isFile false
// ftp.isFolder false
// ftp.isFolder true
// ftp.upload p L1-DECL_20210805055044.csv 75.71339448693362
// ftp.upload p L1-DECL_20210805055044.csv 100
// ftp.upload ok
// ftp.upload p L3-DECL_202108.csv 100
// ftp.upload ok
// ftp.syncToRemote p L1-DECL_202108.csv 100
// ftp.syncToRemote p L2-DECL_202108.csv 100
// ftp.syncToRemote p L2-DECL_20210805055044.csv 75.71339448693362
// ftp.syncToRemote p L2-DECL_20210805055044.csv 100
// ftp.syncToRemote p L3-DECL_20210805055044.csv 75.71339448693362
// ftp.syncToRemote p L3-DECL_20210805055044.csv 100
// ftp.syncToRemote {
// num: 4,
// files: [
// { name: './L1-DECL_202108.csv', reason: 'no Remote file' },
// { name: './test/L2-DECL_202108.csv', reason: 'no Remote file' },
// {
// name: './test/L2-DECL_20210805055044.csv',
// reason: 'no Remote file'
// },
// {
// name: './test/test2/L3-DECL_20210805055044.csv',
// reason: 'no Remote file'
// }
// ]
// }
// ftp.quit { code: 221, text: '221 Goodbye.', isMark: false, isError: false }
Link: [dev source code]
import path from 'path'
import fs from 'fs'
import WFtp from './src/WFtp.mjs'
// import WFtp from './dist/w-ftp.umd.js'
//st
let fp = path.resolve('../', './_data', 'settings.json')
let j = fs.readFileSync(fp, 'utf8')
let st = JSON.parse(j)
console.log(st)
async function test_dw() {
let r
let ftp = WFtp({
transportation: 'SFTP',
hostname: st.SFTP.hostname,
port: st.SFTP.port,
username: st.SFTP.username,
password: st.SFTP.password,
})
// console.log('ftp', ftp)
await ftp.conn()
async function core() {
let fps = await ftp.ls('./_test_download_srv')
console.log('ftp.ls', fps[0], fps.length)
r = await ftp.isFile('./_test_download_srv/DECL_20210805055044.csv')
console.log('ftp.isFile', r)
r = await ftp.isFile('./_test_download_srv/test/DECL_20210805055044.csv')
console.log('ftp.isFile', r)
r = await ftp.isFolder('./_test_download_srv/DECL_20210805055044.csv')
console.log('ftp.isFolder', r)
r = await ftp.download('./_test_download_srv/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.download('./_test_download_srv/test/DECL_202108.csv', './_test_download_client/test/DECL_202108.csv', (p) => {
console.log('ftp.download p', p.name, p.progress)
})
console.log('ftp.download', r)
r = await ftp.syncToLocal('./_test_download_srv', './_test_download_client', (p) => {
console.log('ftp.syncToLocal p', p.name, p.progress)
})
console.log('ftp.syncToLocal', r)
}
await core()
.catch((err) => {
console.log(err)
})
r = await ftp.quit()
console.log('ftp.quit', r)
}
test_dw()
.catch((err) => {
console.log(err)
})
// ftp.ls {
// type: '-',
// name: 'DECL_202108.csv',
// size: 218690,
// modifyTime: 1692347520000,
// accessTime: 1692517558000,
// rights: { user: 'rw', group: '***', other: '***' },
// owner: 0,
// group: 0,
// longname: '-rw-****** 1 - - 218690 Aug 18 16:32 DECL_202108.csv',
// ctime: '2023-08-18T16:32:00+08:00',
// atime: '2023-08-20T15:45:58+08:00',
// isFolder: false
// } 5
// ftp.isFile true
// ftp.isFile true
// ftp.isFolder false
// ftp.download p DECL_20210805055044.csv 2.3660435777166757
// ftp.download p DECL_20210805055044.csv 4.7320871554333515
// ftp.download p DECL_20210805055044.csv 7.098130733150026
// ftp.download p DECL_20210805055044.csv 9.464174310866703
// ftp.download p DECL_20210805055044.csv 11.830217888583377
// ftp.download p DECL_20210805055044.csv 14.196261466300053
// ftp.download p DECL_20210805055044.csv 16.56230504401673
// ftp.download p DECL_20210805055044.csv 18.928348621733406
// ftp.download p DECL_20210805055044.csv 21.29439219945008
// ftp.download p DECL_20210805055044.csv 23.660435777166754
// ftp.download p DECL_20210805055044.csv 26.02647935488343
// ftp.download p DECL_20210805055044.csv 28.392522932600105
// ftp.download p DECL_20210805055044.csv 30.758566510316783
// ftp.download p DECL_20210805055044.csv 33.12461008803346
// ftp.download p DECL_20210805055044.csv 35.49065366575013
// ftp.download p DECL_20210805055044.csv 37.85669724346681
// ftp.download p DECL_20210805055044.csv 40.222740821183486
// ftp.download p DECL_20210805055044.csv 42.58878439890016
// ftp.download p DECL_20210805055044.csv 44.95482797661683
// ftp.download p DECL_20210805055044.csv 47.32087155433351
// ftp.download p DECL_20210805055044.csv 49.68691513205019
// ftp.download p DECL_20210805055044.csv 52.05295870976686
// ftp.download p DECL_20210805055044.csv 54.41900228748354
// ftp.download p DECL_20210805055044.csv 56.78504586520021
// ftp.download p DECL_20210805055044.csv 59.15108944291689
// ftp.download p DECL_20210805055044.csv 61.517133020633565
// ftp.download p DECL_20210805055044.csv 63.883176598350246
// ftp.download p DECL_20210805055044.csv 66.24922017606691
// ftp.download p DECL_20210805055044.csv 68.6152637537836
// ftp.download p DECL_20210805055044.csv 70.98130733150026
// ftp.download p DECL_20210805055044.csv 73.34735090921694
// ftp.download p DECL_20210805055044.csv 75.71339448693362
// ftp.download p DECL_20210805055044.csv 78.0794380646503
// ftp.download p DECL_20210805055044.csv 80.44548164236697
// ftp.download p DECL_20210805055044.csv 82.81152522008365
// ftp.download p DECL_20210805055044.csv 85.17756879780032
// ftp.download p DECL_20210805055044.csv 87.543612375517
// ftp.download p DECL_20210805055044.csv 89.90965595323367
// ftp.download p DECL_20210805055044.csv 92.27569953095035
// ftp.download p DECL_20210805055044.csv 94.64174310866701
// ftp.download p DECL_20210805055044.csv 97.0077866863837
// ftp.download p DECL_20210805055044.csv 99.37383026410038
// ftp.download p DECL_20210805055044.csv 100
// ftp.download ok
// ftp.download p DECL_202108.csv 14.983766976084869
// ftp.download p DECL_202108.csv 29.967533952169738
// ftp.download p DECL_202108.csv 44.951300928254604
// ftp.download p DECL_202108.csv 59.935067904339476
// ftp.download p DECL_202108.csv 74.91883488042434
// ftp.download p DECL_202108.csv 89.90260185650921
// ftp.download p DECL_202108.csv 100
// ftp.download ok
// ftp.syncToLocal p DECL_202108.csv 14.983766976084869
// ftp.syncToLocal p DECL_202108.csv 29.967533952169738
// ftp.syncToLocal p DECL_202108.csv 44.951300928254604
// ftp.syncToLocal p DECL_202108.csv 59.935067904339476
// ftp.syncToLocal p DECL_202108.csv 74.91883488042434
// ftp.syncToLocal p DECL_202108.csv 89.90260185650921
// ftp.syncToLocal p DECL_202108.csv 100
// ftp.syncToLocal p DECL_20210805055629.csv 2.354877308218858
// ftp.syncToLocal p DECL_20210805055629.csv 4.709754616437716
// ftp.syncToLocal p DECL_20210805055629.csv 7.064631924656574
// ftp.syncToLocal p DECL_20210805055629.csv 9.419509232875432
// ftp.syncToLocal p DECL_20210805055629.csv 11.774386541094291
// ftp.syncToLocal p DECL_20210805055629.csv 14.129263849313148
// ftp.syncToLocal p DECL_20210805055629.csv 16.484141157532008
// ftp.syncToLocal p DECL_20210805055629.csv 18.839018465750865
// ftp.syncToLocal p DECL_20210805055629.csv 21.19389577396972
// ftp.syncToLocal p DECL_20210805055629.csv 23.548773082188582
// ftp.syncToLocal p DECL_20210805055629.csv 25.90365039040744
// ftp.syncToLocal p DECL_20210805055629.csv 28.258527698626295
// ftp.syncToLocal p DECL_20210805055629.csv 30.613405006845156
// ftp.syncToLocal p DECL_20210805055629.csv 32.968282315064016
// ftp.syncToLocal p DECL_20210805055629.csv 35.323159623282876
// ftp.syncToLocal p DECL_20210805055629.csv 37.67803693150173
// ftp.syncToLocal p DECL_20210805055629.csv 40.03291423972059
// ftp.syncToLocal p DECL_20210805055629.csv 42.38779154793944
// ftp.syncToLocal p DECL_20210805055629.csv 44.7426688561583
// ftp.syncToLocal p DECL_20210805055629.csv 47.097546164377164
// ftp.syncToLocal p DECL_20210805055629.csv 49.45242347259602
// ftp.syncToLocal p DECL_20210805055629.csv 51.80730078081488
// ftp.syncToLocal p DECL_20210805055629.csv 54.162178089033745
// ftp.syncToLocal p DECL_20210805055629.csv 56.51705539725259
// ftp.syncToLocal p DECL_20210805055629.csv 58.87193270547145
// ftp.syncToLocal p DECL_20210805055629.csv 61.22681001369031
// ftp.syncToLocal p DECL_20210805055629.csv 63.58168732190917
// ftp.syncToLocal p DECL_20210805055629.csv 65.93656463012803
// ftp.syncToLocal p DECL_20210805055629.csv 68.29144193834689
// ftp.syncToLocal p DECL_20210805055629.csv 70.64631924656575
// ftp.syncToLocal p DECL_20210805055629.csv 73.0011965547846
// ftp.syncToLocal p DECL_20210805055629.csv 75.35607386300346
// ftp.syncToLocal p DECL_20210805055629.csv 77.71095117122232
// ftp.syncToLocal p DECL_20210805055629.csv 80.06582847944118
// ftp.syncToLocal p DECL_20210805055629.csv 82.42070578766003
// ftp.syncToLocal p DECL_20210805055629.csv 84.77558309587889
// ftp.syncToLocal p DECL_20210805055629.csv 87.13046040409776
// ftp.syncToLocal p DECL_20210805055629.csv 89.4853377123166
// ftp.syncToLocal p DECL_20210805055629.csv 91.84021502053547
// ftp.syncToLocal p DECL_20210805055629.csv 94.19509232875433
// ftp.syncToLocal p DECL_20210805055629.csv 96.54996963697319
// ftp.syncToLocal p DECL_20210805055629.csv 98.90484694519203
// ftp.syncToLocal p DECL_20210805055629.csv 100
// ftp.syncToLocal p DECL_202109.csv 15.269409456707628
// ftp.syncToLocal p DECL_202109.csv 30.538818913415255
// ftp.syncToLocal p DECL_202109.csv 45.808228370122876
// ftp.syncToLocal p DECL_202109.csv 61.07763782683051
// ftp.syncToLocal p DECL_202109.csv 76.34704728353813
// ftp.syncToLocal p DECL_202109.csv 91.61645674024575
// ftp.syncToLocal p DECL_202109.csv 100
// ftp.syncToLocal p DECL_20210805055044.csv 2.3660435777166757
// ftp.syncToLocal p DECL_20210805055044.csv 4.7320871554333515
// ftp.syncToLocal p DECL_20210805055044.csv 7.098130733150026
// ftp.syncToLocal p DECL_20210805055044.csv 9.464174310866703
// ftp.syncToLocal p DECL_20210805055044.csv 11.830217888583377
// ftp.syncToLocal p DECL_20210805055044.csv 14.196261466300053
// ftp.syncToLocal p DECL_20210805055044.csv 16.56230504401673
// ftp.syncToLocal p DECL_20210805055044.csv 18.928348621733406
// ftp.syncToLocal p DECL_20210805055044.csv 21.29439219945008
// ftp.syncToLocal p DECL_20210805055044.csv 23.660435777166754
// ftp.syncToLocal p DECL_20210805055044.csv 26.02647935488343
// ftp.syncToLocal p DECL_20210805055044.csv 28.392522932600105
// ftp.syncToLocal p DECL_20210805055044.csv 30.758566510316783
// ftp.syncToLocal p DECL_20210805055044.csv 33.12461008803346
// ftp.syncToLocal p DECL_20210805055044.csv 35.49065366575013
// ftp.syncToLocal p DECL_20210805055044.csv 37.85669724346681
// ftp.syncToLocal p DECL_20210805055044.csv 40.222740821183486
// ftp.syncToLocal p DECL_20210805055044.csv 42.58878439890016
// ftp.syncToLocal p DECL_20210805055044.csv 44.95482797661683
// ftp.syncToLocal p DECL_20210805055044.csv 47.32087155433351
// ftp.syncToLocal p DECL_20210805055044.csv 49.68691513205019
// ftp.syncToLocal p DECL_20210805055044.csv 52.05295870976686
// ftp.syncToLocal p DECL_20210805055044.csv 54.41900228748354
// ftp.syncToLocal p DECL_20210805055044.csv 56.78504586520021
// ftp.syncToLocal p DECL_20210805055044.csv 59.15108944291689
// ftp.syncToLocal p DECL_20210805055044.csv 61.517133020633565
// ftp.syncToLocal p DECL_20210805055044.csv 63.883176598350246
// ftp.syncToLocal p DECL_20210805055044.csv 66.24922017606691
// ftp.syncToLocal p DECL_20210805055044.csv 68.6152637537836
// ftp.syncToLocal p DECL_20210805055044.csv 70.98130733150026
// ftp.syncToLocal p DECL_20210805055044.csv 73.34735090921694
// ftp.syncToLocal p DECL_20210805055044.csv 75.71339448693362
// ftp.syncToLocal p DECL_20210805055044.csv 78.0794380646503
// ftp.syncToLocal p DECL_20210805055044.csv 80.44548164236697
// ftp.syncToLocal p DECL_20210805055044.csv 82.81152522008365
// ftp.syncToLocal p DECL_20210805055044.csv 85.17756879780032
// ftp.syncToLocal p DECL_20210805055044.csv 87.543612375517
// ftp.syncToLocal p DECL_20210805055044.csv 89.90965595323367
// ftp.syncToLocal p DECL_20210805055044.csv 92.27569953095035
// ftp.syncToLocal p DECL_20210805055044.csv 94.64174310866701
// ftp.syncToLocal p DECL_20210805055044.csv 97.0077866863837
// ftp.syncToLocal p DECL_20210805055044.csv 99.37383026410038
// ftp.syncToLocal p DECL_20210805055044.csv 100
// ftp.syncToLocal {
// num: 4,
// files: [
// {
// path: './_test_download_srv/DECL_202108.csv',
// reason: 'no local file'
// },
// {
// path: './_test_download_srv/DECL_20210805055629.csv',
// reason: 'no local file'
// },
// {
// path: './_test_download_srv/DECL_202109.csv',
// reason: 'no local file'
// },
// {
// path: './_test_download_srv/test/DECL_20210805055044.csv',
// reason: 'no local file'
// }
// ]
// }
// ftp.quit ok
Link: [dev source code]
import path from 'path'
import fs from 'fs'
import WFtp from './src/WFtp.mjs'
// import WFtp from './dist/w-ftp.umd.js'
//st
let fp = path.resolve('../', './_data', 'settings.json')
let j = fs.readFileSync(fp, 'utf8')
let st = JSON.parse(j)
console.log(st)
async function test_up() {
let r
let ftp = WFtp({
transportation: 'SFTP',
hostname: st.SFTP.hostname,
port: st.SFTP.port,
username: st.SFTP.username,
password: st.SFTP.password,
})
// console.log('ftp', ftp)
await ftp.conn()
async function core() {
let fps = await ftp.ls('./_test_download_srv')
console.log('ftp.ls', fps[0], fps.length)
r = await ftp.isFile('./_test_upload_srv/DECL_20210805055044.csv')
console.log('ftp.isFile', r)
r = await ftp.isFile('./_test_upload_srv/L1-DECL_20210805055044.csv')
console.log('ftp.isFile', r)
r = await ftp.isFile('./_test_upload_srv/test/DECL_20210805055044.csv')
console.log('ftp.isFile', r)
r = await ftp.isFile('./_test_upload_srv/test/L2-DECL_20210805055044.csv')
console.log('ftp.isFile', r)
r = await ftp.isFolder('./_test_upload_srv/DECL_20210805055044.csv')
console.log('ftp.isFolder', r)
r = await ftp.isFolder('./_test_upload_srv/test2')
console.log('ftp.isFolder', r)
r = await ftp.upload('./_test_upload_client/L1-DECL_20210805055044.csv', './_test_upload_srv/L1-DECL_20210805055044.csv', (p) => {
console.log('ftp.upload p', p.name, p.progress)
})
console.log('ftp.upload', r)
r = await ftp.upload('./_test_upload_client/test/test2/L3-DECL_202108.csv', './_test_upload_srv/test/test2/L3-DECL_202108.csv', (p) => {
console.log('ftp.upload p', p.name, p.progress)
})
console.log('ftp.upload', r)
r = await ftp.syncToRemote('./_test_upload_client', './_test_upload_srv', (p) => {
console.log('ftp.syncToRemote p', p.name, p.progress)
})
console.log('ftp.syncToRemote', r)
}
await core()
.catch((err) => {
console.log(err)
})
r = await ftp.quit()
console.log('ftp.quit', r)
}
test_up()
.catch((err) => {
console.log(err)
})
// ftp.ls {
// type: '-',
// name: 'DECL_202108.csv',
// size: 218690,
// modifyTime: 1692347520000,
// accessTime: 1692517558000,
// rights: { user: 'rw', group: '***', other: '***' },
// owner: 0,
// group: 0,
// longname: '-rw-****** 1 - - 218690 Aug 18 16:32 DECL_202108.csv',
// ctime: '2023-08-18T16:32:00+08:00',
// atime: '2023-08-20T15:45:58+08:00',
// isFolder: false
// } 5
// ftp.isFile false
// ftp.isFile false
// ftp.isFile false
// ftp.isFile false
// ftp.isFolder false
// ftp.isFolder true
// ftp.upload p L1-DECL_20210805055044.csv 2.3660435777166757
// ftp.upload p L1-DECL_20210805055044.csv 4.7320871554333515
// ftp.upload p L1-DECL_20210805055044.csv 7.098130733150026
// ftp.upload p L1-DECL_20210805055044.csv 9.464174310866703
// ftp.upload p L1-DECL_20210805055044.csv 11.830217888583377
// ftp.upload p L1-DECL_20210805055044.csv 14.196261466300053
// ftp.upload p L1-DECL_20210805055044.csv 16.56230504401673
// ftp.upload p L1-DECL_20210805055044.csv 18.928348621733406
// ftp.upload p L1-DECL_20210805055044.csv 21.29439219945008
// ftp.upload p L1-DECL_20210805055044.csv 23.660435777166754
// ftp.upload p L1-DECL_20210805055044.csv 26.02647935488343
// ftp.upload p L1-DECL_20210805055044.csv 28.392522932600105
// ftp.upload p L1-DECL_20210805055044.csv 30.758566510316783
// ftp.upload p L1-DECL_20210805055044.csv 33.12461008803346
// ftp.upload p L1-DECL_20210805055044.csv 35.49065366575013
// ftp.upload p L1-DECL_20210805055044.csv 37.85669724346681
// ftp.upload p L1-DECL_20210805055044.csv 40.222740821183486
// ftp.upload p L1-DECL_20210805055044.csv 42.58878439890016
// ftp.upload p L1-DECL_20210805055044.csv 44.95482797661683
// ftp.upload p L1-DECL_20210805055044.csv 47.32087155433351
// ftp.upload p L1-DECL_20210805055044.csv 49.68691513205019
// ftp.upload p L1-DECL_20210805055044.csv 52.05295870976686
// ftp.upload p L1-DECL_20210805055044.csv 54.41900228748354
// ftp.upload p L1-DECL_20210805055044.csv 56.78504586520021
// ftp.upload p L1-DECL_20210805055044.csv 59.15108944291689
// ftp.upload p L1-DECL_20210805055044.csv 61.517133020633565
// ftp.upload p L1-DECL_20210805055044.csv 63.883176598350246
// ftp.upload p L1-DECL_20210805055044.csv 66.24922017606691
// ftp.upload p L1-DECL_20210805055044.csv 68.6152637537836
// ftp.upload p L1-DECL_20210805055044.csv 70.98130733150026
// ftp.upload p L1-DECL_20210805055044.csv 73.34735090921694
// ftp.upload p L1-DECL_20210805055044.csv 75.71339448693362
// ftp.upload p L1-DECL_20210805055044.csv 78.0794380646503
// ftp.upload p L1-DECL_20210805055044.csv 80.44548164236697
// ftp.upload p L1-DECL_20210805055044.csv 82.81152522008365
// ftp.upload p L1-DECL_20210805055044.csv 85.17756879780032
// ftp.upload p L1-DECL_20210805055044.csv 87.543612375517
// ftp.upload p L1-DECL_20210805055044.csv 89.90965595323367
// ftp.upload p L1-DECL_20210805055044.csv 92.27569953095035
// ftp.upload p L1-DECL_20210805055044.csv 94.64174310866701
// ftp.upload p L1-DECL_20210805055044.csv 97.0077866863837
// ftp.upload p L1-DECL_20210805055044.csv 99.37383026410038
// ftp.upload p L1-DECL_20210805055044.csv 100
// ftp.upload ok
// ftp.upload p L3-DECL_202108.csv 14.983766976084869
// ftp.upload p L3-DECL_202108.csv 29.967533952169738
// ftp.upload p L3-DECL_202108.csv 44.951300928254604
// ftp.upload p L3-DECL_202108.csv 59.935067904339476
// ftp.upload p L3-DECL_202108.csv 74.91883488042434
// ftp.upload p L3-DECL_202108.csv 89.90260185650921
// ftp.upload p L3-DECL_202108.csv 100
// ftp.upload ok
// ftp.syncToRemote p L1-DECL_202108.csv 14.983766976084869
// ftp.syncToRemote p L1-DECL_202108.csv 29.967533952169738
// ftp.syncToRemote p L1-DECL_202108.csv 44.951300928254604
// ftp.syncToRemote p L1-DECL_202108.csv 59.935067904339476
// ftp.syncToRemote p L1-DECL_202108.csv 74.91883488042434
// ftp.syncToRemote p L1-DECL_202108.csv 89.90260185650921
// ftp.syncToRemote p L1-DECL_202108.csv 100
// ftp.syncToRemote p L2-DECL_202108.csv 14.983766976084869
// ftp.syncToRemote p L2-DECL_202108.csv 29.967533952169738
// ftp.syncToRemote p L2-DECL_202108.csv 44.951300928254604
// ftp.syncToRemote p L2-DECL_202108.csv 59.935067904339476
// ftp.syncToRemote p L2-DECL_202108.csv 74.91883488042434
// ftp.syncToRemote p L2-DECL_202108.csv 89.90260185650921
// ftp.syncToRemote p L2-DECL_202108.csv 100
// ftp.syncToRemote p L2-DECL_20210805055044.csv 2.3660435777166757
// ftp.syncToRemote p L2-DECL_20210805055044.csv 4.7320871554333515
// ftp.syncToRemote p L2-DECL_20210805055044.csv 7.098130733150026
// ftp.syncToRemote p L2-DECL_20210805055044.csv 9.464174310866703
// ftp.syncToRemote p L2-DECL_20210805055044.csv 11.830217888583377
// ftp.syncToRemote p L2-DECL_20210805055044.csv 14.196261466300053
// ftp.syncToRemote p L2-DECL_20210805055044.csv 16.56230504401673
// ftp.syncToRemote p L2-DECL_20210805055044.csv 18.928348621733406
// ftp.syncToRemote p L2-DECL_20210805055044.csv 21.29439219945008
// ftp.syncToRemote p L2-DECL_20210805055044.csv 23.660435777166754
// ftp.syncToRemote p L2-DECL_20210805055044.csv 26.02647935488343
// ftp.syncToRemote p L2-DECL_20210805055044.csv 28.392522932600105
// ftp.syncToRemote p L2-DECL_20210805055044.csv 30.758566510316783
// ftp.syncToRemote p L2-DECL_20210805055044.csv 33.12461008803346
// ftp.syncToRemote p L2-DECL_20210805055044.csv 35.49065366575013
// ftp.syncToRemote p L2-DECL_20210805055044.csv 37.85669724346681
// ftp.syncToRemote p L2-DECL_20210805055044.csv 40.222740821183486
// ftp.syncToRemote p L2-DECL_20210805055044.csv 42.58878439890016
// ftp.syncToRemote p L2-DECL_20210805055044.csv 44.95482797661683
// ftp.syncToRemote p L2-DECL_20210805055044.csv 47.32087155433351
// ftp.syncToRemote p L2-DECL_20210805055044.csv 49.68691513205019
// ftp.syncToRemote p L2-DECL_20210805055044.csv 52.05295870976686
// ftp.syncToRemote p L2-DECL_20210805055044.csv 54.41900228748354
// ftp.syncToRemote p L2-DECL_20210805055044.csv 56.78504586520021
// ftp.syncToRemote p L2-DECL_20210805055044.csv 59.15108944291689
// ftp.syncToRemote p L2-DECL_20210805055044.csv 61.517133020633565
// ftp.syncToRemote p L2-DECL_20210805055044.csv 63.883176598350246
// ftp.syncToRemote p L2-DECL_20210805055044.csv 66.24922017606691
// ftp.syncToRemote p L2-DECL_20210805055044.csv 68.6152637537836
// ftp.syncToRemote p L2-DECL_20210805055044.csv 70.98130733150026
// ftp.syncToRemote p L2-DECL_20210805055044.csv 73.34735090921694
// ftp.syncToRemote p L2-DECL_20210805055044.csv 75.71339448693362
// ftp.syncToRemote p L2-DECL_20210805055044.csv 78.0794380646503
// ftp.syncToRemote p L2-DECL_20210805055044.csv 80.44548164236697
// ftp.syncToRemote p L2-DECL_20210805055044.csv 82.81152522008365
// ftp.syncToRemote p L2-DECL_20210805055044.csv 85.17756879780032
// ftp.syncToRemote p L2-DECL_20210805055044.csv 87.543612375517
// ftp.syncToRemote p L2-DECL_20210805055044.csv 89.90965595323367
// ftp.syncToRemote p L2-DECL_20210805055044.csv 92.27569953095035
// ftp.syncToRemote p L2-DECL_20210805055044.csv 94.64174310866701
// ftp.syncToRemote p L2-DECL_20210805055044.csv 97.0077866863837
// ftp.syncToRemote p L2-DECL_20210805055044.csv 99.37383026410038
// ftp.syncToRemote p L2-DECL_20210805055044.csv 100
// ftp.syncToRemote p L3-DECL_20210805055044.csv 2.3660435777166757
// ftp.syncToRemote p L3-DECL_20210805055044.csv 4.7320871554333515
// ftp.syncToRemote p L3-DECL_20210805055044.csv 7.098130733150026
// ftp.syncToRemote p L3-DECL_20210805055044.csv 9.464174310866703
// ftp.syncToRemote p L3-DECL_20210805055044.csv 11.830217888583377
// ftp.syncToRemote p L3-DECL_20210805055044.csv 14.196261466300053
// ftp.syncToRemote p L3-DECL_20210805055044.csv 16.56230504401673
// ftp.syncToRemote p L3-DECL_20210805055044.csv 18.928348621733406
// ftp.syncToRemote p L3-DECL_20210805055044.csv 21.29439219945008
// ftp.syncToRemote p L3-DECL_20210805055044.csv 23.660435777166754
// ftp.syncToRemote p L3-DECL_20210805055044.csv 26.02647935488343
// ftp.syncToRemote p L3-DECL_20210805055044.csv 28.392522932600105
// ftp.syncToRemote p L3-DECL_20210805055044.csv 30.758566510316783
// ftp.syncToRemote p L3-DECL_20210805055044.csv 33.12461008803346
// ftp.syncToRemote p L3-DECL_20210805055044.csv 35.49065366575013
// ftp.syncToRemote p L3-DECL_20210805055044.csv 37.85669724346681
// ftp.syncToRemote p L3-DECL_20210805055044.csv 40.222740821183486
// ftp.syncToRemote p L3-DECL_20210805055044.csv 42.58878439890016
// ftp.syncToRemote p L3-DECL_20210805055044.csv 44.95482797661683
// ftp.syncToRemote p L3-DECL_20210805055044.csv 47.32087155433351
// ftp.syncToRemote p L3-DECL_20210805055044.csv 49.68691513205019
// ftp.syncToRemote p L3-DECL_20210805055044.csv 52.05295870976686
// ftp.syncToRemote p L3-DECL_20210805055044.csv 54.41900228748354
// ftp.syncToRemote p L3-DECL_20210805055044.csv 56.78504586520021
// ftp.syncToRemote p L3-DECL_20210805055044.csv 59.15108944291689
// ftp.syncToRemote p L3-DECL_20210805055044.csv 61.517133020633565
// ftp.syncToRemote p L3-DECL_20210805055044.csv 63.883176598350246
// ftp.syncToRemote p L3-DECL_20210805055044.csv 66.24922017606691
// ftp.syncToRemote p L3-DECL_20210805055044.csv 68.6152637537836
// ftp.syncToRemote p L3-DECL_20210805055044.csv 70.98130733150026
// ftp.syncToRemote p L3-DECL_20210805055044.csv 73.34735090921694
// ftp.syncToRemote p L3-DECL_20210805055044.csv 75.71339448693362
// ftp.syncToRemote p L3-DECL_20210805055044.csv 78.0794380646503
// ftp.syncToRemote p L3-DECL_20210805055044.csv 80.44548164236697
// ftp.syncToRemote p L3-DECL_20210805055044.csv 82.81152522008365
// ftp.syncToRemote p L3-DECL_20210805055044.csv 85.17756879780032
// ftp.syncToRemote p L3-DECL_20210805055044.csv 87.543612375517
// ftp.syncToRemote p L3-DECL_20210805055044.csv 89.90965595323367
// ftp.syncToRemote p L3-DECL_20210805055044.csv 92.27569953095035
// ftp.syncToRemote p L3-DECL_20210805055044.csv 94.64174310866701
// ftp.syncToRemote p L3-DECL_20210805055044.csv 97.0077866863837
// ftp.syncToRemote p L3-DECL_20210805055044.csv 99.37383026410038
// ftp.syncToRemote p L3-DECL_20210805055044.csv 100
// ftp.syncToRemote {
// num: 4,
// files: [
// {
// name: './_test_upload_srv/L1-DECL_202108.csv',
// reason: 'no Remote file'
// },
// {
// name: './_test_upload_srv/test/L2-DECL_202108.csv',
// reason: 'no Remote file'
// },
// {
// name: './_test_upload_srv/test/L2-DECL_20210805055044.csv',
// reason: 'no Remote file'
// },
// {
// name: './_test_upload_srv/test/test2/L3-DECL_20210805055044.csv',
// reason: 'no Remote file'
// }
// ]
// }
// ftp.quit ok
FAQs
A tool for FTP(FTP, SFTP).
The npm package w-ftp receives a total of 0 weekly downloads. As such, w-ftp popularity was classified as not popular.
We found that w-ftp demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.