w-ftp 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -33
- package/dist/w-ftp.umd.js +2 -2
- package/dist/w-ftp.umd.js.map +1 -1
- package/docs/WFtp.mjs.html +208 -89
- package/docs/global.html +345 -182
- package/docs/index.html +2 -2
- package/docs/jsftp.js.html +7 -3
- package/g-download.mjs +26 -10
- package/g-upload.mjs +26 -11
- package/package.json +3 -2
- package/src/WFtp.mjs +206 -87
- package/src/jsftp.js +5 -1
package/docs/WFtp.mjs.html
CHANGED
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
<nav >
|
|
29
29
|
|
|
30
|
-
<h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#
|
|
30
|
+
<h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#conn">conn</a></li><li><a href="global.html#download">download</a></li><li><a href="global.html#isFile">isFile</a></li><li><a href="global.html#isFolder">isFolder</a></li><li><a href="global.html#ls">ls</a></li><li><a href="global.html#quit">quit</a></li><li><a href="global.html#stateFile">stateFile</a></li><li><a href="global.html#syncToLocal">syncToLocal</a></li><li><a href="global.html#syncToRemote">syncToRemote</a></li><li><a href="global.html#upload">upload</a></li><li><a href="global.html#WFtp">WFtp</a></li></ul>
|
|
31
31
|
</nav>
|
|
32
32
|
|
|
33
33
|
<div id="main">
|
|
@@ -64,6 +64,7 @@ import fsTreeFolder from 'wsemi/src/fsTreeFolder.mjs'
|
|
|
64
64
|
import fsIsFolder from 'wsemi/src/fsIsFolder.mjs'
|
|
65
65
|
import fsIsFile from 'wsemi/src/fsIsFile.mjs'
|
|
66
66
|
import fsCreateFolder from 'wsemi/src/fsCreateFolder.mjs'
|
|
67
|
+
import ot from 'dayjs'
|
|
67
68
|
import Jsftp from './jsftp.js'
|
|
68
69
|
|
|
69
70
|
|
|
@@ -104,7 +105,7 @@ import Jsftp from './jsftp.js'
|
|
|
104
105
|
* })
|
|
105
106
|
*
|
|
106
107
|
*/
|
|
107
|
-
async function
|
|
108
|
+
async function conn(opt = {}) {
|
|
108
109
|
return null
|
|
109
110
|
}
|
|
110
111
|
|
|
@@ -143,7 +144,7 @@ async function ftpConn(opt = {}) {
|
|
|
143
144
|
* })
|
|
144
145
|
*
|
|
145
146
|
*/
|
|
146
|
-
async function
|
|
147
|
+
async function ls(fdRemote = '.') {
|
|
147
148
|
return null
|
|
148
149
|
}
|
|
149
150
|
|
|
@@ -179,7 +180,7 @@ async function ftpLs(fdRemote = '.') {
|
|
|
179
180
|
* console.log(err)
|
|
180
181
|
* })
|
|
181
182
|
*/
|
|
182
|
-
async function
|
|
183
|
+
async function quit() {
|
|
183
184
|
return null
|
|
184
185
|
}
|
|
185
186
|
|
|
@@ -217,7 +218,7 @@ async function ftpQuit() {
|
|
|
217
218
|
* console.log(err)
|
|
218
219
|
* })
|
|
219
220
|
*/
|
|
220
|
-
async function
|
|
221
|
+
async function stateFile(fpRemote) {
|
|
221
222
|
return null
|
|
222
223
|
}
|
|
223
224
|
|
|
@@ -243,8 +244,8 @@ async function ftpStateFile(fpRemote) {
|
|
|
243
244
|
* password: st.up.password,
|
|
244
245
|
* })
|
|
245
246
|
*
|
|
246
|
-
* r = await ftp.
|
|
247
|
-
* console.log('ftp.
|
|
247
|
+
* r = await ftp.isFile('./_test_upload_client/DECL_20210805055044.csv')
|
|
248
|
+
* console.log('ftp.isFile', r)
|
|
248
249
|
*
|
|
249
250
|
* r = await ftp.quit()
|
|
250
251
|
* console.log('ftp.quit', r)
|
|
@@ -255,7 +256,45 @@ async function ftpStateFile(fpRemote) {
|
|
|
255
256
|
* console.log(err)
|
|
256
257
|
* })
|
|
257
258
|
*/
|
|
258
|
-
async function
|
|
259
|
+
async function isFile(fpRemote) {
|
|
260
|
+
return null
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* 確認伺服器指定資料夾是否存在
|
|
266
|
+
*
|
|
267
|
+
* @param {String} opt.fpRemote 輸入伺服器上指定資料夾字串
|
|
268
|
+
* @return {Promise} 回傳Promise,resolve回傳指定資料夾是否存在布林值,reject回傳錯誤訊息
|
|
269
|
+
* @example
|
|
270
|
+
* import WFtp from './src/WFtp.mjs'
|
|
271
|
+
*
|
|
272
|
+
* async function test() {
|
|
273
|
+
* let r
|
|
274
|
+
*
|
|
275
|
+
* let ftp = WFtp()
|
|
276
|
+
* // console.log('ftp', ftp)
|
|
277
|
+
*
|
|
278
|
+
* await ftp.conn({
|
|
279
|
+
* hostname: st.up.hostname,
|
|
280
|
+
* port: st.up.port,
|
|
281
|
+
* username: st.up.username,
|
|
282
|
+
* password: st.up.password,
|
|
283
|
+
* })
|
|
284
|
+
*
|
|
285
|
+
* r = await ftp.isFolder('./_test_upload_client')
|
|
286
|
+
* console.log('ftp.isFolder', r)
|
|
287
|
+
*
|
|
288
|
+
* r = await ftp.quit()
|
|
289
|
+
* console.log('ftp.quit', r)
|
|
290
|
+
*
|
|
291
|
+
* }
|
|
292
|
+
* test()
|
|
293
|
+
* .catch((err) => {
|
|
294
|
+
* console.log(err)
|
|
295
|
+
* })
|
|
296
|
+
*/
|
|
297
|
+
async function isFolder(fpRemote) {
|
|
259
298
|
return null
|
|
260
299
|
}
|
|
261
300
|
|
|
@@ -297,7 +336,7 @@ async function ftpCheckFile(fpRemote) {
|
|
|
297
336
|
* console.log(err)
|
|
298
337
|
* })
|
|
299
338
|
*/
|
|
300
|
-
async function
|
|
339
|
+
async function download(fpRemote, fpLocal, cbProcess = null) {
|
|
301
340
|
return null
|
|
302
341
|
}
|
|
303
342
|
|
|
@@ -339,7 +378,7 @@ async function ftpDownload(fpRemote, fpLocal, cbProcess = null) {
|
|
|
339
378
|
* console.log(err)
|
|
340
379
|
* })
|
|
341
380
|
*/
|
|
342
|
-
async function
|
|
381
|
+
async function upload(fpLocal, fpRemote, cbProcess) {
|
|
343
382
|
return null
|
|
344
383
|
}
|
|
345
384
|
|
|
@@ -381,7 +420,7 @@ async function ftpUpload(fpLocal, fpRemote, cbProcess) {
|
|
|
381
420
|
* console.log(err)
|
|
382
421
|
* })
|
|
383
422
|
*/
|
|
384
|
-
async function
|
|
423
|
+
async function syncToLocal(fdRemote, fdLocal, cbProcess) {
|
|
385
424
|
return null
|
|
386
425
|
}
|
|
387
426
|
|
|
@@ -423,7 +462,7 @@ async function ftpSyncToLocal(fdRemote, fdLocal, cbProcess) {
|
|
|
423
462
|
* console.log(err)
|
|
424
463
|
* })
|
|
425
464
|
*/
|
|
426
|
-
async function
|
|
465
|
+
async function syncToRemote(fdLocal, fdRemote, cbProcess) {
|
|
427
466
|
return null
|
|
428
467
|
}
|
|
429
468
|
|
|
@@ -431,11 +470,11 @@ async function ftpSyncToRemote(fdLocal, fdRemote, cbProcess) {
|
|
|
431
470
|
/**
|
|
432
471
|
* 操作FTP,包含連線、下載、資料夾內檔案同步下載、上傳、資料夾內檔案同步上傳等功能
|
|
433
472
|
*
|
|
434
|
-
* @returns {Object} 回傳FTP操作物件,包含conn、ls、stateFile、
|
|
473
|
+
* @returns {Object} 回傳FTP操作物件,包含conn、ls、stateFile、isFile、download、syncToLocal、syncToRemote、upload、quit。
|
|
435
474
|
* @example
|
|
436
475
|
* import WFtp from './src/WFtp.mjs'
|
|
437
476
|
*
|
|
438
|
-
* async function
|
|
477
|
+
* async function test_dw() {
|
|
439
478
|
* let r
|
|
440
479
|
*
|
|
441
480
|
* let ftp = WFtp()
|
|
@@ -448,46 +487,73 @@ async function ftpSyncToRemote(fdLocal, fdRemote, cbProcess) {
|
|
|
448
487
|
* password: `{password}`,
|
|
449
488
|
* })
|
|
450
489
|
*
|
|
451
|
-
*
|
|
452
|
-
* console.log('ftp.ls', fps[0], fps.length)
|
|
490
|
+
* async function core() {
|
|
453
491
|
*
|
|
454
|
-
*
|
|
455
|
-
* console.log('ftp.
|
|
456
|
-
* })
|
|
457
|
-
* console.log('ftp.upload', r)
|
|
492
|
+
* let fps = await ftp.ls('.')
|
|
493
|
+
* console.log('ftp.ls', fps[0], fps.length)
|
|
458
494
|
*
|
|
459
|
-
*
|
|
460
|
-
*
|
|
461
|
-
*
|
|
462
|
-
*
|
|
495
|
+
* r = await ftp.download('./DECL_20210805055044.csv', './_test_download_client/DECL_20210805055044.csv', (p) => {
|
|
496
|
+
* console.log('ftp.download p', p.name, p.progress)
|
|
497
|
+
* })
|
|
498
|
+
* console.log('ftp.download', r)
|
|
499
|
+
*
|
|
500
|
+
* r = await ftp.syncToLocal('.', './_test_download_client', (p) => {
|
|
501
|
+
* console.log('ftp.syncToLocal p', p.name, p.progress)
|
|
502
|
+
* })
|
|
503
|
+
* console.log('ftp.syncToLocal', r)
|
|
504
|
+
*
|
|
505
|
+
* }
|
|
506
|
+
* await core()
|
|
507
|
+
* .catch((err) => {
|
|
508
|
+
* console.log(err)
|
|
509
|
+
* })
|
|
463
510
|
*
|
|
464
511
|
* r = await ftp.quit()
|
|
465
512
|
* console.log('ftp.quit', r)
|
|
466
513
|
*
|
|
467
514
|
* }
|
|
468
|
-
*
|
|
515
|
+
* test_dw()
|
|
469
516
|
* .catch((err) => {
|
|
470
517
|
* console.log(err)
|
|
471
518
|
* })
|
|
472
519
|
* // ftp.ls {
|
|
473
520
|
* // name: 'DECL_202108.csv',
|
|
474
521
|
* // type: 0,
|
|
475
|
-
* // time:
|
|
522
|
+
* // time: 1658302140000,
|
|
476
523
|
* // size: '218690',
|
|
477
524
|
* // owner: 'ftp',
|
|
478
525
|
* // group: 'ftp',
|
|
479
526
|
* // userPermissions: { read: true, write: true, exec: false },
|
|
480
527
|
* // groupPermissions: { read: true, write: true, exec: false },
|
|
481
528
|
* // otherPermissions: { read: true, write: true, exec: false }
|
|
482
|
-
* // }
|
|
483
|
-
* // ftp.
|
|
484
|
-
* //
|
|
485
|
-
* // ftp.
|
|
486
|
-
* // ftp.
|
|
487
|
-
* // ftp.
|
|
529
|
+
* // } 74
|
|
530
|
+
* // ftp.download p DECL_20210805055044.csv 4.7320871554333515
|
|
531
|
+
* // ftp.download p DECL_20210805055044.csv 9.464174310866703
|
|
532
|
+
* // ftp.download p DECL_20210805055044.csv 14.196261466300053
|
|
533
|
+
* // ftp.download p DECL_20210805055044.csv 18.928348621733406
|
|
534
|
+
* // ftp.download p DECL_20210805055044.csv 23.660435777166754
|
|
535
|
+
* // ftp.download p DECL_20210805055044.csv 28.392522932600105
|
|
536
|
+
* // ftp.download p DECL_20210805055044.csv 33.12461008803346
|
|
537
|
+
* // ftp.download p DECL_20210805055044.csv 37.85669724346681
|
|
538
|
+
* // ftp.download p DECL_20210805055044.csv 42.58878439890016
|
|
539
|
+
* // ftp.download p DECL_20210805055044.csv 47.32087155433351
|
|
540
|
+
* // ftp.download p DECL_20210805055044.csv 52.05295870976686
|
|
541
|
+
* // ftp.download p DECL_20210805055044.csv 56.78504586520021
|
|
542
|
+
* // ftp.download p DECL_20210805055044.csv 61.517133020633565
|
|
543
|
+
* // ftp.download p DECL_20210805055044.csv 66.24922017606691
|
|
544
|
+
* // ftp.download p DECL_20210805055044.csv 70.98130733150026
|
|
545
|
+
* // ftp.download p DECL_20210805055044.csv 75.71339448693362
|
|
546
|
+
* // ftp.download p DECL_20210805055044.csv 80.44548164236697
|
|
547
|
+
* // ftp.download p DECL_20210805055044.csv 85.17756879780032
|
|
548
|
+
* // ftp.download p DECL_20210805055044.csv 89.90965595323367
|
|
549
|
+
* // ftp.download p DECL_20210805055044.csv 94.64174310866701
|
|
550
|
+
* // ftp.download p DECL_20210805055044.csv 99.37383026410038
|
|
551
|
+
* // ftp.download p DECL_20210805055044.csv 100
|
|
552
|
+
* // ftp.download ok
|
|
553
|
+
* // ftp.syncToLocal { num: 0, files: [] }
|
|
488
554
|
* // ftp.quit { code: 221, text: '221 Goodbye.', isMark: false, isError: false }
|
|
489
555
|
*
|
|
490
|
-
* async function
|
|
556
|
+
* async function test_up() {
|
|
491
557
|
* let r
|
|
492
558
|
*
|
|
493
559
|
* let ftp = WFtp()
|
|
@@ -500,76 +566,65 @@ async function ftpSyncToRemote(fdLocal, fdRemote, cbProcess) {
|
|
|
500
566
|
* password: `{password}`,
|
|
501
567
|
* })
|
|
502
568
|
*
|
|
503
|
-
*
|
|
504
|
-
* console.log('ftp.ls', fps[0], fps.length)
|
|
569
|
+
* async function core() {
|
|
505
570
|
*
|
|
506
|
-
*
|
|
507
|
-
* console.log('ftp.
|
|
508
|
-
* })
|
|
509
|
-
* console.log('ftp.download', r)
|
|
571
|
+
* let fps = await ftp.ls('.')
|
|
572
|
+
* console.log('ftp.ls', fps[0], fps.length)
|
|
510
573
|
*
|
|
511
|
-
*
|
|
512
|
-
*
|
|
513
|
-
*
|
|
514
|
-
*
|
|
574
|
+
* r = await ftp.upload('./_test_upload_client/DECL_20210805055044.csv', './DECL_20210805055044.csv', (p) => {
|
|
575
|
+
* console.log('ftp.upload p', p.name, p.progress)
|
|
576
|
+
* })
|
|
577
|
+
* console.log('ftp.upload', r)
|
|
578
|
+
*
|
|
579
|
+
* r = await ftp.syncToRemote('./_test_upload_client', '.', (p) => {
|
|
580
|
+
* console.log('ftp.syncToRemote p', p.name, p.progress)
|
|
581
|
+
* })
|
|
582
|
+
* console.log('ftp.syncToRemote', r)
|
|
583
|
+
*
|
|
584
|
+
* }
|
|
585
|
+
* await core()
|
|
586
|
+
* .catch((err) => {
|
|
587
|
+
* console.log(err)
|
|
588
|
+
* })
|
|
515
589
|
*
|
|
516
590
|
* r = await ftp.quit()
|
|
517
591
|
* console.log('ftp.quit', r)
|
|
518
592
|
*
|
|
519
593
|
* }
|
|
520
|
-
*
|
|
594
|
+
* test_up()
|
|
521
595
|
* .catch((err) => {
|
|
522
596
|
* console.log(err)
|
|
523
597
|
* })
|
|
524
598
|
* // ftp.ls {
|
|
525
599
|
* // name: 'DECL_202108.csv',
|
|
526
600
|
* // type: 0,
|
|
527
|
-
* // time:
|
|
601
|
+
* // time: 1658366760000,
|
|
528
602
|
* // size: '218690',
|
|
529
603
|
* // owner: 'ftp',
|
|
530
604
|
* // group: 'ftp',
|
|
531
605
|
* // userPermissions: { read: true, write: true, exec: false },
|
|
532
606
|
* // groupPermissions: { read: true, write: true, exec: false },
|
|
533
607
|
* // otherPermissions: { read: true, write: true, exec: false }
|
|
534
|
-
* // }
|
|
535
|
-
* // ftp.
|
|
536
|
-
* // ftp.
|
|
537
|
-
* // ftp.
|
|
538
|
-
* // ftp.
|
|
539
|
-
* // ftp.download p DECL_20210805055044.csv 23.660435777166754
|
|
540
|
-
* // ftp.download p DECL_20210805055044.csv 28.392522932600105
|
|
541
|
-
* // ftp.download p DECL_20210805055044.csv 33.12461008803346
|
|
542
|
-
* // ftp.download p DECL_20210805055044.csv 37.85669724346681
|
|
543
|
-
* // ftp.download p DECL_20210805055044.csv 42.58878439890016
|
|
544
|
-
* // ftp.download p DECL_20210805055044.csv 47.32087155433351
|
|
545
|
-
* // ftp.download p DECL_20210805055044.csv 52.05295870976686
|
|
546
|
-
* // ftp.download p DECL_20210805055044.csv 56.78504586520021
|
|
547
|
-
* // ftp.download p DECL_20210805055044.csv 61.517133020633565
|
|
548
|
-
* // ftp.download p DECL_20210805055044.csv 66.24922017606691
|
|
549
|
-
* // ftp.download p DECL_20210805055044.csv 70.98130733150026
|
|
550
|
-
* // ftp.download p DECL_20210805055044.csv 75.71339448693362
|
|
551
|
-
* // ftp.download p DECL_20210805055044.csv 80.44548164236697
|
|
552
|
-
* // ftp.download p DECL_20210805055044.csv 85.17756879780032
|
|
553
|
-
* // ftp.download p DECL_20210805055044.csv 89.90965595323367
|
|
554
|
-
* // ftp.download p DECL_20210805055044.csv 94.64174310866701
|
|
555
|
-
* // ftp.download p DECL_20210805055044.csv 99.37383026410038
|
|
556
|
-
* // ftp.download p DECL_20210805055044.csv 100
|
|
557
|
-
* // ftp.download ok
|
|
558
|
-
* // ftp.syncToLocal { num: 0, files: [] }
|
|
608
|
+
* // } 73
|
|
609
|
+
* // ftp.upload p DECL_20210805055044.csv 75.71339448693362
|
|
610
|
+
* // ftp.upload p DECL_20210805055044.csv 100
|
|
611
|
+
* // ftp.upload ok
|
|
612
|
+
* // ftp.syncToRemote { num: 0, files: [] }
|
|
559
613
|
* // ftp.quit { code: 221, text: '221 Goodbye.', isMark: false, isError: false }
|
|
560
614
|
*
|
|
561
615
|
*/
|
|
562
616
|
function WFtp() {
|
|
563
617
|
let doc = {
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
618
|
+
doc_conn: conn,
|
|
619
|
+
doc_ls: ls,
|
|
620
|
+
doc_quit: quit,
|
|
621
|
+
doc_stateFile: stateFile,
|
|
622
|
+
doc_isFile: isFile,
|
|
623
|
+
doc_isFolder: isFolder,
|
|
624
|
+
doc_download: download,
|
|
625
|
+
doc_upload: upload,
|
|
626
|
+
doc_syncToLocal: syncToLocal,
|
|
627
|
+
doc_syncToRemote: syncToRemote,
|
|
573
628
|
}
|
|
574
629
|
|
|
575
630
|
function WFtpCore() {
|
|
@@ -644,6 +699,12 @@ function WFtp() {
|
|
|
644
699
|
pm.reject(err)
|
|
645
700
|
}
|
|
646
701
|
else {
|
|
702
|
+
res = map(res, (v) => {
|
|
703
|
+
let d = ot(v.time) //jsfpt解析時間係基於ls, 其檔案變更時間精度只至分而沒有秒, 故無法提供精確的檔案變更時間
|
|
704
|
+
v.ctime = d.format('YYYY-MM-DDTHH:mm:ssZ') //添加UTC時間
|
|
705
|
+
v.isFolder = ftpIsFolderCore(v)
|
|
706
|
+
return v
|
|
707
|
+
})
|
|
647
708
|
pm.resolve(res)
|
|
648
709
|
}
|
|
649
710
|
})
|
|
@@ -696,13 +757,56 @@ function WFtp() {
|
|
|
696
757
|
}
|
|
697
758
|
|
|
698
759
|
|
|
699
|
-
|
|
760
|
+
function ftpIsFolderCore(file) {
|
|
761
|
+
|
|
762
|
+
//check
|
|
763
|
+
if (!iseobj(file)) {
|
|
764
|
+
return false
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
//type
|
|
768
|
+
let type = get(file, 'type', -1)
|
|
769
|
+
|
|
770
|
+
//b
|
|
771
|
+
let b = type === 1
|
|
772
|
+
|
|
773
|
+
return b
|
|
774
|
+
}
|
|
775
|
+
|
|
776
|
+
|
|
777
|
+
function ftpIsFileCore(file) {
|
|
778
|
+
|
|
779
|
+
//check
|
|
780
|
+
if (!iseobj(file)) {
|
|
781
|
+
return false
|
|
782
|
+
}
|
|
783
|
+
|
|
784
|
+
//type
|
|
785
|
+
let type = get(file, 'type', -1)
|
|
786
|
+
|
|
787
|
+
//b
|
|
788
|
+
let b = type === 0
|
|
789
|
+
|
|
790
|
+
return b
|
|
791
|
+
}
|
|
792
|
+
|
|
793
|
+
|
|
794
|
+
async function ftpIsFolder(fpRemote) {
|
|
700
795
|
|
|
701
796
|
//ftpStateFile
|
|
702
797
|
let file = await ftpStateFile(fpRemote)
|
|
703
798
|
|
|
704
|
-
//
|
|
705
|
-
let b =
|
|
799
|
+
//ftpIsFolderCore
|
|
800
|
+
let b = ftpIsFolderCore(file)
|
|
801
|
+
|
|
802
|
+
return b
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
|
|
806
|
+
async function ftpIsFile(fpRemote) {
|
|
807
|
+
|
|
808
|
+
//ftpIsFileCore
|
|
809
|
+
let b = await ftpIsFileCore(fpRemote)
|
|
706
810
|
|
|
707
811
|
return b
|
|
708
812
|
}
|
|
@@ -743,6 +847,22 @@ function WFtp() {
|
|
|
743
847
|
let file = await ftpStateFile(fpRemote)
|
|
744
848
|
// console.log('file', file)
|
|
745
849
|
|
|
850
|
+
//ftpIsFileCore
|
|
851
|
+
let b = await ftpIsFileCore(file)
|
|
852
|
+
// console.log('b', b)
|
|
853
|
+
|
|
854
|
+
//check
|
|
855
|
+
if (!b) {
|
|
856
|
+
pm.reject(`fpRemote[${fpRemote}] is not a file`)
|
|
857
|
+
return pm
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
//check
|
|
861
|
+
if (!iseobj(file)) {
|
|
862
|
+
pm.reject(`fpRemote[${fpRemote}] does not have information`)
|
|
863
|
+
return pm
|
|
864
|
+
}
|
|
865
|
+
|
|
746
866
|
//fileSize
|
|
747
867
|
let fileSize = get(file, 'size')
|
|
748
868
|
|
|
@@ -906,11 +1026,9 @@ function WFtp() {
|
|
|
906
1026
|
|
|
907
1027
|
//ftpLs
|
|
908
1028
|
let fsRemote = await ftpLs(fdRemote)
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
// return v
|
|
913
|
-
// })
|
|
1029
|
+
fsRemote = filter(fsRemote, (v) => {
|
|
1030
|
+
return !v.isFolder
|
|
1031
|
+
})
|
|
914
1032
|
// console.log('fsRemote', fsRemote)
|
|
915
1033
|
|
|
916
1034
|
//check fdLocal
|
|
@@ -1083,7 +1201,8 @@ function WFtp() {
|
|
|
1083
1201
|
conn: ftpConn,
|
|
1084
1202
|
ls: ftpLs,
|
|
1085
1203
|
stateFile: ftpStateFile,
|
|
1086
|
-
|
|
1204
|
+
isFile: ftpIsFile,
|
|
1205
|
+
isFolder: ftpIsFolder,
|
|
1087
1206
|
download: ftpDownload,
|
|
1088
1207
|
syncToLocal: ftpSyncToLocal,
|
|
1089
1208
|
syncToRemote: ftpSyncToRemote,
|
|
@@ -1111,7 +1230,7 @@ export default WFtp
|
|
|
1111
1230
|
<br class="clear">
|
|
1112
1231
|
|
|
1113
1232
|
<footer>
|
|
1114
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.10</a> on
|
|
1233
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.10</a> on Sun Jul 24 2022 12:32:49 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
1115
1234
|
</footer>
|
|
1116
1235
|
|
|
1117
1236
|
<script>prettyPrint();</script>
|