w-ftp 1.0.1 → 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/docs/global.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#WFtp">WFtp</a></li></ul>
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">
@@ -124,7 +124,7 @@
124
124
 
125
125
 
126
126
 
127
- <h4 class="name" id="WFtp"><span class="type-signature"></span>WFtp<span class="signature">(fp, opt<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
127
+ <h4 class="name" id="conn"><span class="type-signature">(async) </span>conn<span class="signature">(opt<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
128
128
 
129
129
 
130
130
 
@@ -136,7 +136,7 @@
136
136
 
137
137
  <dt class="tag-source">Source:</dt>
138
138
  <dd class="tag-source"><ul class="dummy"><li>
139
- <a href="WFtp.mjs.html">WFtp.mjs</a>, <a href="WFtp.mjs.html#line71">line 71</a>
139
+ <a href="WFtp.mjs.html">WFtp.mjs</a>, <a href="WFtp.mjs.html#line64">line 64</a>
140
140
  </li></ul></dd>
141
141
 
142
142
 
@@ -176,7 +176,7 @@
176
176
 
177
177
 
178
178
  <div class="description usertext">
179
- <p>指定FTP伺服器資料夾內檔案並自動同步至本機,只能用於Windows作業系統</p>
179
+ <p>連線至FPT伺服器</p>
180
180
  </div>
181
181
 
182
182
 
@@ -189,7 +189,7 @@
189
189
 
190
190
  <h5>Example</h5>
191
191
 
192
- <pre class="prettyprint"><code>import WFtp from './src/WFtp.mjs'
193
192
  //fp
194
193
  let fp = './g.mseed'
195
194
  //WFtp
196
195
  let r = await WFtp(fp)
197
196
  console.log(r)
198
197
  // [
199
198
  // {
200
199
  // name: 'SE.RST01.00.HNE.D.2020-09-17T013552.000000.csv',
201
200
  // path: null,
202
201
  // data: { heads: [Object], records: [Array] }
203
202
  // },
204
203
  // {
205
204
  // name: 'SE.RST01.00.HNN.D.2020-09-17T013552.000000.csv',
206
205
  // path: null,
207
206
  // data: { heads: [Object], records: [Array] }
208
207
  // },
209
208
  // {
210
209
  // name: 'SE.RST01.00.HNZ.D.2020-09-17T013552.000000.csv',
211
210
  // path: null,
212
211
  // data: { heads: [Object], records: [Array] }
213
212
  // }
214
213
  // ]
215
214
  .catch((err) => {
216
215
  console.log('catch', err)
217
216
  })</code></pre>
217
+ <pre class="prettyprint"><code>import WFtp from './src/WFtp.mjs'
218
218
  let r
219
219
  let ftp = WFtp()
220
220
  // console.log('ftp', ftp)
221
221
  await ftp.conn({
222
222
  hostname: st.up.hostname,
223
223
  port: st.up.port,
224
224
  username: st.up.username,
225
225
  password: st.up.password,
226
226
  })
227
227
  //actions
228
228
  r = await ftp.quit()
229
229
  console.log('ftp.quit', r)
230
230
  .catch((err) => {
231
231
  console.log(err)
232
232
  })</code></pre>
233
233
 
234
234
 
235
235
 
@@ -221,41 +221,6 @@
221
221
  <tbody>
222
222
 
223
223
 
224
- <tr>
225
-
226
- <td class="name"><code>fp</code></td>
227
-
228
-
229
- <td class="type">
230
-
231
-
232
- <span class="param-type">String</span>
233
-
234
-
235
-
236
- </td>
237
-
238
-
239
- <td class="attributes">
240
-
241
-
242
-
243
-
244
-
245
- </td>
246
-
247
-
248
-
249
- <td class="default">
250
-
251
- </td>
252
-
253
-
254
- <td class="description last"><p>輸入檔案路徑字串</p></td>
255
- </tr>
256
-
257
-
258
-
259
224
  <tr>
260
225
 
261
226
  <td class="name"><code>opt</code></td>
@@ -304,8 +269,6 @@
304
269
  <th>Type</th>
305
270
 
306
271
 
307
- <th>Attributes</th>
308
-
309
272
 
310
273
 
311
274
  <th>Default</th>
@@ -320,7 +283,7 @@
320
283
 
321
284
  <tr>
322
285
 
323
- <td class="name"><code>ver</code></td>
286
+ <td class="name"><code>hostname</code></td>
324
287
 
325
288
 
326
289
  <td class="type">
@@ -333,26 +296,103 @@
333
296
  </td>
334
297
 
335
298
 
336
- <td class="attributes">
299
+
300
+
301
+ <td class="default">
337
302
 
338
- &lt;optional><br>
303
+ <code>''</code>
304
+
305
+ </td>
306
+
307
+
308
+ <td class="description last"><p>輸入hostname字串</p></td>
309
+ </tr>
310
+
311
+
312
+
313
+ <tr>
314
+
315
+ <td class="name"><code>port</code></td>
316
+
317
+
318
+ <td class="type">
319
+
320
+
321
+ <span class="param-type">Number</span>
322
+
323
+
324
+
325
+ </td>
326
+
327
+
328
+
329
+
330
+ <td class="default">
339
331
 
332
+ <code>''</code>
333
+
334
+ </td>
335
+
336
+
337
+ <td class="description last"><p>輸入port正整數</p></td>
338
+ </tr>
339
+
340
+
341
+
342
+ <tr>
343
+
344
+ <td class="name"><code>username</code></td>
345
+
340
346
 
347
+ <td class="type">
348
+
341
349
 
350
+ <span class="param-type">String</span>
351
+
352
+
353
+
354
+ </td>
355
+
356
+
342
357
 
358
+
359
+ <td class="default">
360
+
361
+ <code>''</code>
343
362
 
344
363
  </td>
345
364
 
346
365
 
366
+ <td class="description last"><p>輸入帳號字串</p></td>
367
+ </tr>
368
+
369
+
370
+
371
+ <tr>
372
+
373
+ <td class="name"><code>password</code></td>
374
+
375
+
376
+ <td class="type">
377
+
378
+
379
+ <span class="param-type">String</span>
380
+
381
+
382
+
383
+ </td>
384
+
385
+
386
+
347
387
 
348
388
  <td class="default">
349
389
 
350
- <code>'4.8'</code>
390
+ <code>''</code>
351
391
 
352
392
  </td>
353
393
 
354
394
 
355
- <td class="description last"><p>輸入調用windows程序之Net Framework版本字串,可有'4.5'、'4.6'、'4.7.2'與'4.8',預設'4.8'</p></td>
395
+ <td class="description last"><p>輸入密碼字串</p></td>
356
396
  </tr>
357
397
 
358
398
 
@@ -407,6 +447,1898 @@
407
447
 
408
448
 
409
449
 
450
+
451
+
452
+
453
+
454
+ <h4 class="name" id="download"><span class="type-signature">(async) </span>download<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
455
+
456
+
457
+
458
+
459
+
460
+
461
+ <dl class="details">
462
+
463
+
464
+ <dt class="tag-source">Source:</dt>
465
+ <dd class="tag-source"><ul class="dummy"><li>
466
+ <a href="WFtp.mjs.html">WFtp.mjs</a>, <a href="WFtp.mjs.html#line295">line 295</a>
467
+ </li></ul></dd>
468
+
469
+
470
+
471
+
472
+
473
+
474
+
475
+
476
+
477
+
478
+
479
+
480
+
481
+
482
+
483
+
484
+
485
+
486
+
487
+
488
+
489
+
490
+
491
+
492
+
493
+
494
+
495
+
496
+
497
+
498
+
499
+ </dl>
500
+
501
+
502
+
503
+
504
+
505
+ <div class="description usertext">
506
+ <p>下載伺服器指定檔案至本機</p>
507
+ </div>
508
+
509
+
510
+
511
+
512
+
513
+
514
+
515
+
516
+
517
+ <h5>Example</h5>
518
+
519
+ <pre class="prettyprint"><code>import WFtp from './src/WFtp.mjs'
410
520
  let r
411
521
  let ftp = WFtp()
412
522
  // console.log('ftp', ftp)
413
523
  await ftp.conn({
414
524
  hostname: st.up.hostname,
415
525
  port: st.up.port,
416
526
  username: st.up.username,
417
527
  password: st.up.password,
418
528
  })
419
529
  r = await ftp.download('./DECL_20210805055044.csv', './_test_download_client/DECL_20210805055044.csv', (p) => {
420
530
  console.log('ftp.download p', p.name, p.progress)
421
531
  })
422
532
  console.log('ftp.download', r)
423
533
  r = await ftp.quit()
424
534
  console.log('ftp.quit', r)
425
535
  .catch((err) => {
426
536
  console.log(err)
427
537
  })</code></pre>
538
+
539
+
540
+
541
+
542
+ <h5>Parameters:</h5>
543
+
544
+
545
+ <table class="params">
546
+ <thead>
547
+ <tr>
548
+
549
+ <th>Name</th>
550
+
551
+
552
+ <th>Type</th>
553
+
554
+
555
+ <th>Attributes</th>
556
+
557
+
558
+
559
+ <th>Default</th>
560
+
561
+
562
+ <th class="last">Description</th>
563
+ </tr>
564
+ </thead>
565
+
566
+ <tbody>
567
+
568
+
569
+ <tr>
570
+
571
+ <td class="name"><code>opt.fpRemote</code></td>
572
+
573
+
574
+ <td class="type">
575
+
576
+
577
+ <span class="param-type">String</span>
578
+
579
+
580
+
581
+ </td>
582
+
583
+
584
+ <td class="attributes">
585
+
586
+
587
+
588
+
589
+
590
+ </td>
591
+
592
+
593
+
594
+ <td class="default">
595
+
596
+ </td>
597
+
598
+
599
+ <td class="description last"><p>輸入伺服器上指定檔案字串</p></td>
600
+ </tr>
601
+
602
+
603
+
604
+ <tr>
605
+
606
+ <td class="name"><code>opt.fpLocal</code></td>
607
+
608
+
609
+ <td class="type">
610
+
611
+
612
+ <span class="param-type">String</span>
613
+
614
+
615
+
616
+ </td>
617
+
618
+
619
+ <td class="attributes">
620
+
621
+
622
+
623
+
624
+
625
+ </td>
626
+
627
+
628
+
629
+ <td class="default">
630
+
631
+ </td>
632
+
633
+
634
+ <td class="description last"><p>輸入本機指定檔案字串</p></td>
635
+ </tr>
636
+
637
+
638
+
639
+ <tr>
640
+
641
+ <td class="name"><code>opt.cbProcess</code></td>
642
+
643
+
644
+ <td class="type">
645
+
646
+
647
+ <span class="param-type">function</span>
648
+
649
+
650
+
651
+ </td>
652
+
653
+
654
+ <td class="attributes">
655
+
656
+ &lt;optional><br>
657
+
658
+
659
+
660
+
661
+
662
+ </td>
663
+
664
+
665
+
666
+ <td class="default">
667
+
668
+ <code>null</code>
669
+
670
+ </td>
671
+
672
+
673
+ <td class="description last"><p>輸入回調進度函數</p></td>
674
+ </tr>
675
+
676
+
677
+ </tbody>
678
+ </table>
679
+
680
+
681
+
682
+
683
+
684
+
685
+
686
+
687
+
688
+
689
+
690
+
691
+
692
+
693
+
694
+
695
+ <h5>Returns:</h5>
696
+
697
+
698
+ <div class="param-desc">
699
+ <p>回傳Promise,resolve回傳成功訊息,reject回傳錯誤訊息</p>
700
+ </div>
701
+
702
+
703
+
704
+ <dl class="param-type">
705
+ <dt>
706
+ Type
707
+ </dt>
708
+ <dd>
709
+
710
+ <span class="param-type">Promise</span>
711
+
712
+
713
+ </dd>
714
+ </dl>
715
+
716
+
717
+
718
+
719
+
720
+
721
+
722
+
723
+
724
+
725
+ <h4 class="name" id="isFile"><span class="type-signature">(async) </span>isFile<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
726
+
727
+
728
+
729
+
730
+
731
+
732
+ <dl class="details">
733
+
734
+
735
+ <dt class="tag-source">Source:</dt>
736
+ <dd class="tag-source"><ul class="dummy"><li>
737
+ <a href="WFtp.mjs.html">WFtp.mjs</a>, <a href="WFtp.mjs.html#line215">line 215</a>
738
+ </li></ul></dd>
739
+
740
+
741
+
742
+
743
+
744
+
745
+
746
+
747
+
748
+
749
+
750
+
751
+
752
+
753
+
754
+
755
+
756
+
757
+
758
+
759
+
760
+
761
+
762
+
763
+
764
+
765
+
766
+
767
+
768
+
769
+
770
+ </dl>
771
+
772
+
773
+
774
+
775
+
776
+ <div class="description usertext">
777
+ <p>確認伺服器指定檔案是否存在</p>
778
+ </div>
779
+
780
+
781
+
782
+
783
+
784
+
785
+
786
+
787
+
788
+ <h5>Example</h5>
789
+
790
+ <pre class="prettyprint"><code>import WFtp from './src/WFtp.mjs'
428
791
  let r
429
792
  let ftp = WFtp()
430
793
  // console.log('ftp', ftp)
431
794
  await ftp.conn({
432
795
  hostname: st.up.hostname,
433
796
  port: st.up.port,
434
797
  username: st.up.username,
435
798
  password: st.up.password,
436
799
  })
437
800
  r = await ftp.isFile('./_test_upload_client/DECL_20210805055044.csv')
438
801
  console.log('ftp.isFile', r)
439
802
  r = await ftp.quit()
440
803
  console.log('ftp.quit', r)
441
804
  .catch((err) => {
442
805
  console.log(err)
443
806
  })</code></pre>
807
+
808
+
809
+
810
+
811
+ <h5>Parameters:</h5>
812
+
813
+
814
+ <table class="params">
815
+ <thead>
816
+ <tr>
817
+
818
+ <th>Name</th>
819
+
820
+
821
+ <th>Type</th>
822
+
823
+
824
+
825
+
826
+
827
+ <th class="last">Description</th>
828
+ </tr>
829
+ </thead>
830
+
831
+ <tbody>
832
+
833
+
834
+ <tr>
835
+
836
+ <td class="name"><code>opt.fpRemote</code></td>
837
+
838
+
839
+ <td class="type">
840
+
841
+
842
+ <span class="param-type">String</span>
843
+
844
+
845
+
846
+ </td>
847
+
848
+
849
+
850
+
851
+
852
+ <td class="description last"><p>輸入伺服器上指定檔案字串</p></td>
853
+ </tr>
854
+
855
+
856
+ </tbody>
857
+ </table>
858
+
859
+
860
+
861
+
862
+
863
+
864
+
865
+
866
+
867
+
868
+
869
+
870
+
871
+
872
+
873
+
874
+ <h5>Returns:</h5>
875
+
876
+
877
+ <div class="param-desc">
878
+ <p>回傳Promise,resolve回傳指定檔案是否存在布林值,reject回傳錯誤訊息</p>
879
+ </div>
880
+
881
+
882
+
883
+ <dl class="param-type">
884
+ <dt>
885
+ Type
886
+ </dt>
887
+ <dd>
888
+
889
+ <span class="param-type">Promise</span>
890
+
891
+
892
+ </dd>
893
+ </dl>
894
+
895
+
896
+
897
+
898
+
899
+
900
+
901
+
902
+
903
+
904
+ <h4 class="name" id="isFolder"><span class="type-signature">(async) </span>isFolder<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
905
+
906
+
907
+
908
+
909
+
910
+
911
+ <dl class="details">
912
+
913
+
914
+ <dt class="tag-source">Source:</dt>
915
+ <dd class="tag-source"><ul class="dummy"><li>
916
+ <a href="WFtp.mjs.html">WFtp.mjs</a>, <a href="WFtp.mjs.html#line253">line 253</a>
917
+ </li></ul></dd>
918
+
919
+
920
+
921
+
922
+
923
+
924
+
925
+
926
+
927
+
928
+
929
+
930
+
931
+
932
+
933
+
934
+
935
+
936
+
937
+
938
+
939
+
940
+
941
+
942
+
943
+
944
+
945
+
946
+
947
+
948
+
949
+ </dl>
950
+
951
+
952
+
953
+
954
+
955
+ <div class="description usertext">
956
+ <p>確認伺服器指定資料夾是否存在</p>
957
+ </div>
958
+
959
+
960
+
961
+
962
+
963
+
964
+
965
+
966
+
967
+ <h5>Example</h5>
968
+
969
+ <pre class="prettyprint"><code>import WFtp from './src/WFtp.mjs'
444
970
  let r
445
971
  let ftp = WFtp()
446
972
  // console.log('ftp', ftp)
447
973
  await ftp.conn({
448
974
  hostname: st.up.hostname,
449
975
  port: st.up.port,
450
976
  username: st.up.username,
451
977
  password: st.up.password,
452
978
  })
453
979
  r = await ftp.isFolder('./_test_upload_client')
454
980
  console.log('ftp.isFolder', r)
455
981
  r = await ftp.quit()
456
982
  console.log('ftp.quit', r)
457
983
  .catch((err) => {
458
984
  console.log(err)
459
985
  })</code></pre>
986
+
987
+
988
+
989
+
990
+ <h5>Parameters:</h5>
991
+
992
+
993
+ <table class="params">
994
+ <thead>
995
+ <tr>
996
+
997
+ <th>Name</th>
998
+
999
+
1000
+ <th>Type</th>
1001
+
1002
+
1003
+
1004
+
1005
+
1006
+ <th class="last">Description</th>
1007
+ </tr>
1008
+ </thead>
1009
+
1010
+ <tbody>
1011
+
1012
+
1013
+ <tr>
1014
+
1015
+ <td class="name"><code>opt.fpRemote</code></td>
1016
+
1017
+
1018
+ <td class="type">
1019
+
1020
+
1021
+ <span class="param-type">String</span>
1022
+
1023
+
1024
+
1025
+ </td>
1026
+
1027
+
1028
+
1029
+
1030
+
1031
+ <td class="description last"><p>輸入伺服器上指定資料夾字串</p></td>
1032
+ </tr>
1033
+
1034
+
1035
+ </tbody>
1036
+ </table>
1037
+
1038
+
1039
+
1040
+
1041
+
1042
+
1043
+
1044
+
1045
+
1046
+
1047
+
1048
+
1049
+
1050
+
1051
+
1052
+
1053
+ <h5>Returns:</h5>
1054
+
1055
+
1056
+ <div class="param-desc">
1057
+ <p>回傳Promise,resolve回傳指定資料夾是否存在布林值,reject回傳錯誤訊息</p>
1058
+ </div>
1059
+
1060
+
1061
+
1062
+ <dl class="param-type">
1063
+ <dt>
1064
+ Type
1065
+ </dt>
1066
+ <dd>
1067
+
1068
+ <span class="param-type">Promise</span>
1069
+
1070
+
1071
+ </dd>
1072
+ </dl>
1073
+
1074
+
1075
+
1076
+
1077
+
1078
+
1079
+
1080
+
1081
+
1082
+
1083
+ <h4 class="name" id="ls"><span class="type-signature">(async) </span>ls<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1084
+
1085
+
1086
+
1087
+
1088
+
1089
+
1090
+ <dl class="details">
1091
+
1092
+
1093
+ <dt class="tag-source">Source:</dt>
1094
+ <dd class="tag-source"><ul class="dummy"><li>
1095
+ <a href="WFtp.mjs.html">WFtp.mjs</a>, <a href="WFtp.mjs.html#line103">line 103</a>
1096
+ </li></ul></dd>
1097
+
1098
+
1099
+
1100
+
1101
+
1102
+
1103
+
1104
+
1105
+
1106
+
1107
+
1108
+
1109
+
1110
+
1111
+
1112
+
1113
+
1114
+
1115
+
1116
+
1117
+
1118
+
1119
+
1120
+
1121
+
1122
+
1123
+
1124
+
1125
+
1126
+
1127
+
1128
+ </dl>
1129
+
1130
+
1131
+
1132
+
1133
+
1134
+ <div class="description usertext">
1135
+ <p>遍歷伺服器上指定資料夾內檔案清單資訊</p>
1136
+ </div>
1137
+
1138
+
1139
+
1140
+
1141
+
1142
+
1143
+
1144
+
1145
+
1146
+ <h5>Example</h5>
1147
+
1148
+ <pre class="prettyprint"><code>import WFtp from './src/WFtp.mjs'
460
1149
  let r
461
1150
  let ftp = WFtp()
462
1151
  // console.log('ftp', ftp)
463
1152
  await ftp.conn({
464
1153
  hostname: st.up.hostname,
465
1154
  port: st.up.port,
466
1155
  username: st.up.username,
467
1156
  password: st.up.password,
468
1157
  })
469
1158
  let fps = await ftp.ls('.')
470
1159
  console.log('ftp.ls', fps[0], fps.length)
471
1160
  r = await ftp.quit()
472
1161
  console.log('ftp.quit', r)
473
1162
  .catch((err) => {
474
1163
  console.log(err)
475
1164
  })</code></pre>
1165
+
1166
+
1167
+
1168
+
1169
+ <h5>Parameters:</h5>
1170
+
1171
+
1172
+ <table class="params">
1173
+ <thead>
1174
+ <tr>
1175
+
1176
+ <th>Name</th>
1177
+
1178
+
1179
+ <th>Type</th>
1180
+
1181
+
1182
+
1183
+
1184
+
1185
+ <th class="last">Description</th>
1186
+ </tr>
1187
+ </thead>
1188
+
1189
+ <tbody>
1190
+
1191
+
1192
+ <tr>
1193
+
1194
+ <td class="name"><code>opt.fdRemote</code></td>
1195
+
1196
+
1197
+ <td class="type">
1198
+
1199
+
1200
+ <span class="param-type">String</span>
1201
+
1202
+
1203
+
1204
+ </td>
1205
+
1206
+
1207
+
1208
+
1209
+
1210
+ <td class="description last"><p>輸入伺服器上指定資料夾字串</p></td>
1211
+ </tr>
1212
+
1213
+
1214
+ </tbody>
1215
+ </table>
1216
+
1217
+
1218
+
1219
+
1220
+
1221
+
1222
+
1223
+
1224
+
1225
+
1226
+
1227
+
1228
+
1229
+
1230
+
1231
+
1232
+ <h5>Returns:</h5>
1233
+
1234
+
1235
+ <div class="param-desc">
1236
+ <p>回傳Promise,resolve回傳檔案清單資訊,reject回傳錯誤訊息</p>
1237
+ </div>
1238
+
1239
+
1240
+
1241
+ <dl class="param-type">
1242
+ <dt>
1243
+ Type
1244
+ </dt>
1245
+ <dd>
1246
+
1247
+ <span class="param-type">Promise</span>
1248
+
1249
+
1250
+ </dd>
1251
+ </dl>
1252
+
1253
+
1254
+
1255
+
1256
+
1257
+
1258
+
1259
+
1260
+
1261
+
1262
+ <h4 class="name" id="quit"><span class="type-signature">(async) </span>quit<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1263
+
1264
+
1265
+
1266
+
1267
+
1268
+
1269
+ <dl class="details">
1270
+
1271
+
1272
+ <dt class="tag-source">Source:</dt>
1273
+ <dd class="tag-source"><ul class="dummy"><li>
1274
+ <a href="WFtp.mjs.html">WFtp.mjs</a>, <a href="WFtp.mjs.html#line139">line 139</a>
1275
+ </li></ul></dd>
1276
+
1277
+
1278
+
1279
+
1280
+
1281
+
1282
+
1283
+
1284
+
1285
+
1286
+
1287
+
1288
+
1289
+
1290
+
1291
+
1292
+
1293
+
1294
+
1295
+
1296
+
1297
+
1298
+
1299
+
1300
+
1301
+
1302
+
1303
+
1304
+
1305
+
1306
+
1307
+ </dl>
1308
+
1309
+
1310
+
1311
+
1312
+
1313
+ <div class="description usertext">
1314
+ <p>關閉與伺服器連線</p>
1315
+ </div>
1316
+
1317
+
1318
+
1319
+
1320
+
1321
+
1322
+
1323
+
1324
+
1325
+ <h5>Example</h5>
1326
+
1327
+ <pre class="prettyprint"><code>import WFtp from './src/WFtp.mjs'
476
1328
  let r
477
1329
  let ftp = WFtp()
478
1330
  // console.log('ftp', ftp)
479
1331
  await ftp.conn({
480
1332
  hostname: st.up.hostname,
481
1333
  port: st.up.port,
482
1334
  username: st.up.username,
483
1335
  password: st.up.password,
484
1336
  })
485
1337
  //actions
486
1338
  r = await ftp.quit()
487
1339
  console.log('ftp.quit', r)
488
1340
  .catch((err) => {
489
1341
  console.log(err)
490
1342
  })</code></pre>
1343
+
1344
+
1345
+
1346
+
1347
+
1348
+
1349
+
1350
+
1351
+
1352
+
1353
+
1354
+
1355
+
1356
+
1357
+
1358
+
1359
+
1360
+
1361
+ <h5>Returns:</h5>
1362
+
1363
+
1364
+ <div class="param-desc">
1365
+ <p>回傳Promise,resolve回傳成功訊息,reject回傳錯誤訊息</p>
1366
+ </div>
1367
+
1368
+
1369
+
1370
+ <dl class="param-type">
1371
+ <dt>
1372
+ Type
1373
+ </dt>
1374
+ <dd>
1375
+
1376
+ <span class="param-type">Promise</span>
1377
+
1378
+
1379
+ </dd>
1380
+ </dl>
1381
+
1382
+
1383
+
1384
+
1385
+
1386
+
1387
+
1388
+
1389
+
1390
+
1391
+ <h4 class="name" id="stateFile"><span class="type-signature">(async) </span>stateFile<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1392
+
1393
+
1394
+
1395
+
1396
+
1397
+
1398
+ <dl class="details">
1399
+
1400
+
1401
+ <dt class="tag-source">Source:</dt>
1402
+ <dd class="tag-source"><ul class="dummy"><li>
1403
+ <a href="WFtp.mjs.html">WFtp.mjs</a>, <a href="WFtp.mjs.html#line177">line 177</a>
1404
+ </li></ul></dd>
1405
+
1406
+
1407
+
1408
+
1409
+
1410
+
1411
+
1412
+
1413
+
1414
+
1415
+
1416
+
1417
+
1418
+
1419
+
1420
+
1421
+
1422
+
1423
+
1424
+
1425
+
1426
+
1427
+
1428
+
1429
+
1430
+
1431
+
1432
+
1433
+
1434
+
1435
+
1436
+ </dl>
1437
+
1438
+
1439
+
1440
+
1441
+
1442
+ <div class="description usertext">
1443
+ <p>取得伺服器指定檔案資訊</p>
1444
+ </div>
1445
+
1446
+
1447
+
1448
+
1449
+
1450
+
1451
+
1452
+
1453
+
1454
+ <h5>Example</h5>
1455
+
1456
+ <pre class="prettyprint"><code>import WFtp from './src/WFtp.mjs'
491
1457
  let r
492
1458
  let ftp = WFtp()
493
1459
  // console.log('ftp', ftp)
494
1460
  await ftp.conn({
495
1461
  hostname: st.up.hostname,
496
1462
  port: st.up.port,
497
1463
  username: st.up.username,
498
1464
  password: st.up.password,
499
1465
  })
500
1466
  r = await ftp.stateFile('./_test_upload_client/DECL_20210805055044.csv')
501
1467
  console.log('ftp.stateFile', r)
502
1468
  r = await ftp.quit()
503
1469
  console.log('ftp.quit', r)
504
1470
  .catch((err) => {
505
1471
  console.log(err)
506
1472
  })</code></pre>
1473
+
1474
+
1475
+
1476
+
1477
+ <h5>Parameters:</h5>
1478
+
1479
+
1480
+ <table class="params">
1481
+ <thead>
1482
+ <tr>
1483
+
1484
+ <th>Name</th>
1485
+
1486
+
1487
+ <th>Type</th>
1488
+
1489
+
1490
+
1491
+
1492
+
1493
+ <th class="last">Description</th>
1494
+ </tr>
1495
+ </thead>
1496
+
1497
+ <tbody>
1498
+
1499
+
1500
+ <tr>
1501
+
1502
+ <td class="name"><code>opt.fpRemote</code></td>
1503
+
1504
+
1505
+ <td class="type">
1506
+
1507
+
1508
+ <span class="param-type">String</span>
1509
+
1510
+
1511
+
1512
+ </td>
1513
+
1514
+
1515
+
1516
+
1517
+
1518
+ <td class="description last"><p>輸入伺服器上指定檔案字串</p></td>
1519
+ </tr>
1520
+
1521
+
1522
+ </tbody>
1523
+ </table>
1524
+
1525
+
1526
+
1527
+
1528
+
1529
+
1530
+
1531
+
1532
+
1533
+
1534
+
1535
+
1536
+
1537
+
1538
+
1539
+
1540
+ <h5>Returns:</h5>
1541
+
1542
+
1543
+ <div class="param-desc">
1544
+ <p>回傳Promise,resolve回傳檔案資訊,reject回傳錯誤訊息</p>
1545
+ </div>
1546
+
1547
+
1548
+
1549
+ <dl class="param-type">
1550
+ <dt>
1551
+ Type
1552
+ </dt>
1553
+ <dd>
1554
+
1555
+ <span class="param-type">Promise</span>
1556
+
1557
+
1558
+ </dd>
1559
+ </dl>
1560
+
1561
+
1562
+
1563
+
1564
+
1565
+
1566
+
1567
+
1568
+
1569
+
1570
+ <h4 class="name" id="syncToLocal"><span class="type-signature">(async) </span>syncToLocal<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1571
+
1572
+
1573
+
1574
+
1575
+
1576
+
1577
+ <dl class="details">
1578
+
1579
+
1580
+ <dt class="tag-source">Source:</dt>
1581
+ <dd class="tag-source"><ul class="dummy"><li>
1582
+ <a href="WFtp.mjs.html">WFtp.mjs</a>, <a href="WFtp.mjs.html#line379">line 379</a>
1583
+ </li></ul></dd>
1584
+
1585
+
1586
+
1587
+
1588
+
1589
+
1590
+
1591
+
1592
+
1593
+
1594
+
1595
+
1596
+
1597
+
1598
+
1599
+
1600
+
1601
+
1602
+
1603
+
1604
+
1605
+
1606
+
1607
+
1608
+
1609
+
1610
+
1611
+
1612
+
1613
+
1614
+
1615
+ </dl>
1616
+
1617
+
1618
+
1619
+
1620
+
1621
+ <div class="description usertext">
1622
+ <p>同步伺服器上指定資料夾內檔案至本機</p>
1623
+ </div>
1624
+
1625
+
1626
+
1627
+
1628
+
1629
+
1630
+
1631
+
1632
+
1633
+ <h5>Example</h5>
1634
+
1635
+ <pre class="prettyprint"><code>import WFtp from './src/WFtp.mjs'
507
1636
  let r
508
1637
  let ftp = WFtp()
509
1638
  // console.log('ftp', ftp)
510
1639
  await ftp.conn({
511
1640
  hostname: st.up.hostname,
512
1641
  port: st.up.port,
513
1642
  username: st.up.username,
514
1643
  password: st.up.password,
515
1644
  })
516
1645
  r = await ftp.syncToLocal('.', './_test_download_client', (p) => {
517
1646
  console.log('ftp.syncToLocal p', p.name, p.progress)
518
1647
  })
519
1648
  console.log('ftp.syncToLocal', r)
520
1649
  r = await ftp.quit()
521
1650
  console.log('ftp.quit', r)
522
1651
  .catch((err) => {
523
1652
  console.log(err)
524
1653
  })</code></pre>
1654
+
1655
+
1656
+
1657
+
1658
+ <h5>Parameters:</h5>
1659
+
1660
+
1661
+ <table class="params">
1662
+ <thead>
1663
+ <tr>
1664
+
1665
+ <th>Name</th>
1666
+
1667
+
1668
+ <th>Type</th>
1669
+
1670
+
1671
+ <th>Attributes</th>
1672
+
1673
+
1674
+
1675
+ <th>Default</th>
1676
+
1677
+
1678
+ <th class="last">Description</th>
1679
+ </tr>
1680
+ </thead>
1681
+
1682
+ <tbody>
1683
+
1684
+
1685
+ <tr>
1686
+
1687
+ <td class="name"><code>opt.fdRemote</code></td>
1688
+
1689
+
1690
+ <td class="type">
1691
+
1692
+
1693
+ <span class="param-type">String</span>
1694
+
1695
+
1696
+
1697
+ </td>
1698
+
1699
+
1700
+ <td class="attributes">
1701
+
1702
+
1703
+
1704
+
1705
+
1706
+ </td>
1707
+
1708
+
1709
+
1710
+ <td class="default">
1711
+
1712
+ </td>
1713
+
1714
+
1715
+ <td class="description last"><p>輸入伺服器上指定資料夾字串</p></td>
1716
+ </tr>
1717
+
1718
+
1719
+
1720
+ <tr>
1721
+
1722
+ <td class="name"><code>opt.fdLocal</code></td>
1723
+
1724
+
1725
+ <td class="type">
1726
+
1727
+
1728
+ <span class="param-type">String</span>
1729
+
1730
+
1731
+
1732
+ </td>
1733
+
1734
+
1735
+ <td class="attributes">
1736
+
1737
+
1738
+
1739
+
1740
+
1741
+ </td>
1742
+
1743
+
1744
+
1745
+ <td class="default">
1746
+
1747
+ </td>
1748
+
1749
+
1750
+ <td class="description last"><p>輸入本機指定資料夾字串</p></td>
1751
+ </tr>
1752
+
1753
+
1754
+
1755
+ <tr>
1756
+
1757
+ <td class="name"><code>opt.cbProcess</code></td>
1758
+
1759
+
1760
+ <td class="type">
1761
+
1762
+
1763
+ <span class="param-type">function</span>
1764
+
1765
+
1766
+
1767
+ </td>
1768
+
1769
+
1770
+ <td class="attributes">
1771
+
1772
+ &lt;optional><br>
1773
+
1774
+
1775
+
1776
+
1777
+
1778
+ </td>
1779
+
1780
+
1781
+
1782
+ <td class="default">
1783
+
1784
+ <code>null</code>
1785
+
1786
+ </td>
1787
+
1788
+
1789
+ <td class="description last"><p>輸入回調進度函數</p></td>
1790
+ </tr>
1791
+
1792
+
1793
+ </tbody>
1794
+ </table>
1795
+
1796
+
1797
+
1798
+
1799
+
1800
+
1801
+
1802
+
1803
+
1804
+
1805
+
1806
+
1807
+
1808
+
1809
+
1810
+
1811
+ <h5>Returns:</h5>
1812
+
1813
+
1814
+ <div class="param-desc">
1815
+ <p>回傳Promise,resolve回傳成功訊息,reject回傳錯誤訊息</p>
1816
+ </div>
1817
+
1818
+
1819
+
1820
+ <dl class="param-type">
1821
+ <dt>
1822
+ Type
1823
+ </dt>
1824
+ <dd>
1825
+
1826
+ <span class="param-type">Promise</span>
1827
+
1828
+
1829
+ </dd>
1830
+ </dl>
1831
+
1832
+
1833
+
1834
+
1835
+
1836
+
1837
+
1838
+
1839
+
1840
+
1841
+ <h4 class="name" id="syncToRemote"><span class="type-signature">(async) </span>syncToRemote<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1842
+
1843
+
1844
+
1845
+
1846
+
1847
+
1848
+ <dl class="details">
1849
+
1850
+
1851
+ <dt class="tag-source">Source:</dt>
1852
+ <dd class="tag-source"><ul class="dummy"><li>
1853
+ <a href="WFtp.mjs.html">WFtp.mjs</a>, <a href="WFtp.mjs.html#line421">line 421</a>
1854
+ </li></ul></dd>
1855
+
1856
+
1857
+
1858
+
1859
+
1860
+
1861
+
1862
+
1863
+
1864
+
1865
+
1866
+
1867
+
1868
+
1869
+
1870
+
1871
+
1872
+
1873
+
1874
+
1875
+
1876
+
1877
+
1878
+
1879
+
1880
+
1881
+
1882
+
1883
+
1884
+
1885
+
1886
+ </dl>
1887
+
1888
+
1889
+
1890
+
1891
+
1892
+ <div class="description usertext">
1893
+ <p>同步本機指定資料夾內檔案至伺服器</p>
1894
+ </div>
1895
+
1896
+
1897
+
1898
+
1899
+
1900
+
1901
+
1902
+
1903
+
1904
+ <h5>Example</h5>
1905
+
1906
+ <pre class="prettyprint"><code>import WFtp from './src/WFtp.mjs'
525
1907
  let r
526
1908
  let ftp = WFtp()
527
1909
  // console.log('ftp', ftp)
528
1910
  await ftp.conn({
529
1911
  hostname: st.up.hostname,
530
1912
  port: st.up.port,
531
1913
  username: st.up.username,
532
1914
  password: st.up.password,
533
1915
  })
534
1916
  r = await ftp.syncToRemote('./_test_upload_client', '.', (p) => {
535
1917
  console.log('ftp.syncToRemote p', p.name, p.progress)
536
1918
  })
537
1919
  console.log('ftp.syncToRemote', r)
538
1920
  r = await ftp.quit()
539
1921
  console.log('ftp.quit', r)
540
1922
  .catch((err) => {
541
1923
  console.log(err)
542
1924
  })</code></pre>
1925
+
1926
+
1927
+
1928
+
1929
+ <h5>Parameters:</h5>
1930
+
1931
+
1932
+ <table class="params">
1933
+ <thead>
1934
+ <tr>
1935
+
1936
+ <th>Name</th>
1937
+
1938
+
1939
+ <th>Type</th>
1940
+
1941
+
1942
+ <th>Attributes</th>
1943
+
1944
+
1945
+
1946
+ <th>Default</th>
1947
+
1948
+
1949
+ <th class="last">Description</th>
1950
+ </tr>
1951
+ </thead>
1952
+
1953
+ <tbody>
1954
+
1955
+
1956
+ <tr>
1957
+
1958
+ <td class="name"><code>opt.fdLocal</code></td>
1959
+
1960
+
1961
+ <td class="type">
1962
+
1963
+
1964
+ <span class="param-type">String</span>
1965
+
1966
+
1967
+
1968
+ </td>
1969
+
1970
+
1971
+ <td class="attributes">
1972
+
1973
+
1974
+
1975
+
1976
+
1977
+ </td>
1978
+
1979
+
1980
+
1981
+ <td class="default">
1982
+
1983
+ </td>
1984
+
1985
+
1986
+ <td class="description last"><p>輸入本機指定資料夾字串</p></td>
1987
+ </tr>
1988
+
1989
+
1990
+
1991
+ <tr>
1992
+
1993
+ <td class="name"><code>opt.fdRemote</code></td>
1994
+
1995
+
1996
+ <td class="type">
1997
+
1998
+
1999
+ <span class="param-type">String</span>
2000
+
2001
+
2002
+
2003
+ </td>
2004
+
2005
+
2006
+ <td class="attributes">
2007
+
2008
+
2009
+
2010
+
2011
+
2012
+ </td>
2013
+
2014
+
2015
+
2016
+ <td class="default">
2017
+
2018
+ </td>
2019
+
2020
+
2021
+ <td class="description last"><p>輸入伺服器上指定資料夾字串</p></td>
2022
+ </tr>
2023
+
2024
+
2025
+
2026
+ <tr>
2027
+
2028
+ <td class="name"><code>opt.cbProcess</code></td>
2029
+
2030
+
2031
+ <td class="type">
2032
+
2033
+
2034
+ <span class="param-type">function</span>
2035
+
2036
+
2037
+
2038
+ </td>
2039
+
2040
+
2041
+ <td class="attributes">
2042
+
2043
+ &lt;optional><br>
2044
+
2045
+
2046
+
2047
+
2048
+
2049
+ </td>
2050
+
2051
+
2052
+
2053
+ <td class="default">
2054
+
2055
+ <code>null</code>
2056
+
2057
+ </td>
2058
+
2059
+
2060
+ <td class="description last"><p>輸入回調進度函數</p></td>
2061
+ </tr>
2062
+
2063
+
2064
+ </tbody>
2065
+ </table>
2066
+
2067
+
2068
+
2069
+
2070
+
2071
+
2072
+
2073
+
2074
+
2075
+
2076
+
2077
+
2078
+
2079
+
2080
+
2081
+
2082
+ <h5>Returns:</h5>
2083
+
2084
+
2085
+ <div class="param-desc">
2086
+ <p>回傳Promise,resolve回傳成功訊息,reject回傳錯誤訊息</p>
2087
+ </div>
2088
+
2089
+
2090
+
2091
+ <dl class="param-type">
2092
+ <dt>
2093
+ Type
2094
+ </dt>
2095
+ <dd>
2096
+
2097
+ <span class="param-type">Promise</span>
2098
+
2099
+
2100
+ </dd>
2101
+ </dl>
2102
+
2103
+
2104
+
2105
+
2106
+
2107
+
2108
+
2109
+
2110
+
2111
+
2112
+ <h4 class="name" id="upload"><span class="type-signature">(async) </span>upload<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
2113
+
2114
+
2115
+
2116
+
2117
+
2118
+
2119
+ <dl class="details">
2120
+
2121
+
2122
+ <dt class="tag-source">Source:</dt>
2123
+ <dd class="tag-source"><ul class="dummy"><li>
2124
+ <a href="WFtp.mjs.html">WFtp.mjs</a>, <a href="WFtp.mjs.html#line337">line 337</a>
2125
+ </li></ul></dd>
2126
+
2127
+
2128
+
2129
+
2130
+
2131
+
2132
+
2133
+
2134
+
2135
+
2136
+
2137
+
2138
+
2139
+
2140
+
2141
+
2142
+
2143
+
2144
+
2145
+
2146
+
2147
+
2148
+
2149
+
2150
+
2151
+
2152
+
2153
+
2154
+
2155
+
2156
+
2157
+ </dl>
2158
+
2159
+
2160
+
2161
+
2162
+
2163
+ <div class="description usertext">
2164
+ <p>上傳本機指定檔案至伺服器</p>
2165
+ </div>
2166
+
2167
+
2168
+
2169
+
2170
+
2171
+
2172
+
2173
+
2174
+
2175
+ <h5>Example</h5>
2176
+
2177
+ <pre class="prettyprint"><code>import WFtp from './src/WFtp.mjs'
543
2178
  let r
544
2179
  let ftp = WFtp()
545
2180
  // console.log('ftp', ftp)
546
2181
  await ftp.conn({
547
2182
  hostname: st.up.hostname,
548
2183
  port: st.up.port,
549
2184
  username: st.up.username,
550
2185
  password: st.up.password,
551
2186
  })
552
2187
  r = await ftp.upload('./_test_upload_client/DECL_20210805055044.csv', './DECL_20210805055044.csv', (p) => {
553
2188
  console.log('ftp.upload p', p.name, p.progress)
554
2189
  })
555
2190
  console.log('ftp.upload', r)
556
2191
  r = await ftp.quit()
557
2192
  console.log('ftp.quit', r)
558
2193
  .catch((err) => {
559
2194
  console.log(err)
560
2195
  })</code></pre>
2196
+
2197
+
2198
+
2199
+
2200
+ <h5>Parameters:</h5>
2201
+
2202
+
2203
+ <table class="params">
2204
+ <thead>
2205
+ <tr>
2206
+
2207
+ <th>Name</th>
2208
+
2209
+
2210
+ <th>Type</th>
2211
+
2212
+
2213
+ <th>Attributes</th>
2214
+
2215
+
2216
+
2217
+ <th>Default</th>
2218
+
2219
+
2220
+ <th class="last">Description</th>
2221
+ </tr>
2222
+ </thead>
2223
+
2224
+ <tbody>
2225
+
2226
+
2227
+ <tr>
2228
+
2229
+ <td class="name"><code>opt.fpLocal</code></td>
2230
+
2231
+
2232
+ <td class="type">
2233
+
2234
+
2235
+ <span class="param-type">String</span>
2236
+
2237
+
2238
+
2239
+ </td>
2240
+
2241
+
2242
+ <td class="attributes">
2243
+
2244
+
2245
+
2246
+
2247
+
2248
+ </td>
2249
+
2250
+
2251
+
2252
+ <td class="default">
2253
+
2254
+ </td>
2255
+
2256
+
2257
+ <td class="description last"><p>輸入本機指定檔案字串</p></td>
2258
+ </tr>
2259
+
2260
+
2261
+
2262
+ <tr>
2263
+
2264
+ <td class="name"><code>opt.fpRemote</code></td>
2265
+
2266
+
2267
+ <td class="type">
2268
+
2269
+
2270
+ <span class="param-type">String</span>
2271
+
2272
+
2273
+
2274
+ </td>
2275
+
2276
+
2277
+ <td class="attributes">
2278
+
2279
+
2280
+
2281
+
2282
+
2283
+ </td>
2284
+
2285
+
2286
+
2287
+ <td class="default">
2288
+
2289
+ </td>
2290
+
2291
+
2292
+ <td class="description last"><p>輸入伺服器上指定檔案字串</p></td>
2293
+ </tr>
2294
+
2295
+
2296
+
2297
+ <tr>
2298
+
2299
+ <td class="name"><code>opt.cbProcess</code></td>
2300
+
2301
+
2302
+ <td class="type">
2303
+
2304
+
2305
+ <span class="param-type">function</span>
2306
+
2307
+
2308
+
2309
+ </td>
2310
+
2311
+
2312
+ <td class="attributes">
2313
+
2314
+ &lt;optional><br>
2315
+
2316
+
2317
+
2318
+
2319
+
2320
+ </td>
2321
+
2322
+
2323
+
2324
+ <td class="default">
2325
+
2326
+ <code>null</code>
2327
+
2328
+ </td>
2329
+
2330
+
2331
+ <td class="description last"><p>輸入回調進度函數</p></td>
2332
+ </tr>
2333
+
2334
+
2335
+ </tbody>
2336
+ </table>
2337
+
2338
+
2339
+
2340
+
2341
+
2342
+
2343
+
2344
+
2345
+
2346
+
2347
+
2348
+
2349
+
2350
+
2351
+
2352
+
2353
+ <h5>Returns:</h5>
2354
+
2355
+
2356
+ <div class="param-desc">
2357
+ <p>回傳Promise,resolve回傳成功訊息,reject回傳錯誤訊息</p>
2358
+ </div>
2359
+
2360
+
2361
+
2362
+ <dl class="param-type">
2363
+ <dt>
2364
+ Type
2365
+ </dt>
2366
+ <dd>
2367
+
2368
+ <span class="param-type">Promise</span>
2369
+
2370
+
2371
+ </dd>
2372
+ </dl>
2373
+
2374
+
2375
+
2376
+
2377
+
2378
+
2379
+
2380
+
2381
+
2382
+
2383
+ <h4 class="name" id="WFtp"><span class="type-signature"></span>WFtp<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4>
2384
+
2385
+
2386
+
2387
+
2388
+
2389
+
2390
+ <dl class="details">
2391
+
2392
+
2393
+ <dt class="tag-source">Source:</dt>
2394
+ <dd class="tag-source"><ul class="dummy"><li>
2395
+ <a href="WFtp.mjs.html">WFtp.mjs</a>, <a href="WFtp.mjs.html#line572">line 572</a>
2396
+ </li></ul></dd>
2397
+
2398
+
2399
+
2400
+
2401
+
2402
+
2403
+
2404
+
2405
+
2406
+
2407
+
2408
+
2409
+
2410
+
2411
+
2412
+
2413
+
2414
+
2415
+
2416
+
2417
+
2418
+
2419
+
2420
+
2421
+
2422
+
2423
+
2424
+
2425
+
2426
+
2427
+
2428
+ </dl>
2429
+
2430
+
2431
+
2432
+
2433
+
2434
+ <div class="description usertext">
2435
+ <p>操作FTP,包含連線、下載、資料夾內檔案同步下載、上傳、資料夾內檔案同步上傳等功能</p>
2436
+ </div>
2437
+
2438
+
2439
+
2440
+
2441
+
2442
+
2443
+
2444
+
2445
+
2446
+ <h5>Example</h5>
2447
+
2448
+ <pre class="prettyprint"><code>import WFtp from './src/WFtp.mjs'
561
2449
  let r
562
2450
  let ftp = WFtp()
563
2451
  // console.log('ftp', ftp)
564
2452
  await ftp.conn({
565
2453
  hostname: `{hostname}`,
566
2454
  port: `{port}`,
567
2455
  username: `{username}`,
568
2456
  password: `{password}`,
569
2457
  })
570
2458
  async function core() {
571
2459
  let fps = await ftp.ls('.')
572
2460
  console.log('ftp.ls', fps[0], fps.length)
573
2461
  r = await ftp.download('./DECL_20210805055044.csv', './_test_download_client/DECL_20210805055044.csv', (p) => {
574
2462
  console.log('ftp.download p', p.name, p.progress)
575
2463
  })
576
2464
  console.log('ftp.download', r)
577
2465
  r = await ftp.syncToLocal('.', './_test_download_client', (p) => {
578
2466
  console.log('ftp.syncToLocal p', p.name, p.progress)
579
2467
  })
580
2468
  console.log('ftp.syncToLocal', r)
581
2469
  }
582
2470
  await core()
583
2471
  .catch((err) => {
584
2472
  console.log(err)
585
2473
  })
586
2474
  r = await ftp.quit()
587
2475
  console.log('ftp.quit', r)
588
2476
  .catch((err) => {
589
2477
  console.log(err)
590
2478
  })
591
2479
  let r
592
2480
  let ftp = WFtp()
593
2481
  // console.log('ftp', ftp)
594
2482
  await ftp.conn({
595
2483
  hostname: `{hostname}`,
596
2484
  port: `{port}`,
597
2485
  username: `{username}`,
598
2486
  password: `{password}`,
599
2487
  })
600
2488
  async function core() {
601
2489
  let fps = await ftp.ls('.')
602
2490
  console.log('ftp.ls', fps[0], fps.length)
603
2491
  r = await ftp.upload('./_test_upload_client/DECL_20210805055044.csv', './DECL_20210805055044.csv', (p) => {
604
2492
  console.log('ftp.upload p', p.name, p.progress)
605
2493
  })
606
2494
  console.log('ftp.upload', r)
607
2495
  r = await ftp.syncToRemote('./_test_upload_client', '.', (p) => {
608
2496
  console.log('ftp.syncToRemote p', p.name, p.progress)
609
2497
  })
610
2498
  console.log('ftp.syncToRemote', r)
611
2499
  }
612
2500
  await core()
613
2501
  .catch((err) => {
614
2502
  console.log(err)
615
2503
  })
616
2504
  r = await ftp.quit()
617
2505
  console.log('ftp.quit', r)
618
2506
  .catch((err) => {
619
2507
  console.log(err)
620
2508
  })
2509
+
2510
+
2511
+
2512
+
2513
+
2514
+
2515
+
2516
+
2517
+
2518
+
2519
+
2520
+
2521
+
2522
+
2523
+
2524
+
2525
+
2526
+
2527
+ <h5>Returns:</h5>
2528
+
2529
+
2530
+ <div class="param-desc">
2531
+ <p>回傳FTP操作物件,包含conn、ls、stateFile、isFile、download、syncToLocal、syncToRemote、upload、quit。</p>
2532
+ </div>
2533
+
2534
+
2535
+
2536
+ <dl class="param-type">
2537
+ <dt>
2538
+ Type
2539
+ </dt>
2540
+ <dd>
2541
+
2542
+ <span class="param-type">Object</span>
2543
+
2544
+
2545
+ </dd>
2546
+ </dl>
2547
+
2548
+
2549
+
2550
+
2551
+
2552
+
621
2553
 
622
2554
 
623
2555
 
@@ -426,7 +2358,7 @@
426
2358
  <br class="clear">
427
2359
 
428
2360
  <footer>
429
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.10</a> on Sat Jul 23 2022 13:04:38 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
2361
+ 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.
430
2362
  </footer>
431
2363
 
432
2364
  <script>prettyPrint();</script>