w-ftp 1.0.6 → 1.0.7

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
@@ -14,6 +14,7 @@
14
14
  <link type="text/css" rel="stylesheet" href="styles/prettify.css">
15
15
  <link type="text/css" rel="stylesheet" href="styles/jsdoc.css">
16
16
  <script src="scripts/nav.js" defer></script>
17
+
17
18
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
18
19
  </head>
19
20
  <body>
@@ -27,7 +28,9 @@
27
28
 
28
29
  <nav >
29
30
 
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
+
32
+ <h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#WFtp">WFtp</a></li><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></ul>
33
+
31
34
  </nav>
32
35
 
33
36
  <div id="main">
@@ -46,6 +49,8 @@
46
49
 
47
50
  <h2>
48
51
 
52
+
53
+
49
54
  </h2>
50
55
 
51
56
 
@@ -58,6 +63,7 @@
58
63
 
59
64
 
60
65
  <dl class="details">
66
+
61
67
 
62
68
 
63
69
 
@@ -124,7 +130,7 @@
124
130
 
125
131
 
126
132
 
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>
133
+ <h4 class="name" id="WFtp"><span class="type-signature"></span>WFtp<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4>
128
134
 
129
135
 
130
136
 
@@ -132,11 +138,15 @@
132
138
 
133
139
 
134
140
  <dl class="details">
141
+
142
+ <dt class="tag-description">Description:</dt>
143
+ <dd class="tag-description"><ul class="dummy"><li><p>操作FTP,包含連線、下載、資料夾內檔案同步下載、上傳、資料夾內檔案同步上傳等功能</p></li></ul></dd>
144
+
135
145
 
136
146
 
137
147
  <dt class="tag-source">Source:</dt>
138
148
  <dd class="tag-source"><ul class="dummy"><li>
139
- <a href="WFtp.mjs.html">WFtp.mjs</a>, <a href="WFtp.mjs.html#line64">line 64</a>
149
+ <a href="WFtp.mjs.html">WFtp.mjs</a>, <a href="WFtp.mjs.html#line572">line 572</a>
140
150
  </li></ul></dd>
141
151
 
142
152
 
@@ -175,26 +185,133 @@
175
185
 
176
186
 
177
187
 
178
- <div class="description usertext">
179
- <p>連線至FPT伺服器</p>
188
+
189
+
190
+
191
+
192
+
193
+
194
+ <h5 class="h5-examples">Example</h5>
195
+
196
+ <pre class="prettyprint"><code>import WFtp from './src/WFtp.mjs'
180
197
  let r
181
198
  let ftp = WFtp()
182
199
  // console.log('ftp', ftp)
183
200
  await ftp.conn({
184
201
  hostname: `{hostname}`,
185
202
  port: `{port}`,
186
203
  username: `{username}`,
187
204
  password: `{password}`,
188
205
  })
189
206
  async function core() {
190
207
  let fps = await ftp.ls('.')
191
208
  console.log('ftp.ls', fps[0], fps.length)
192
209
  r = await ftp.download('./DECL_20210805055044.csv', './_test_download_client/DECL_20210805055044.csv', (p) => {
193
210
  console.log('ftp.download p', p.name, p.progress)
194
211
  })
195
212
  console.log('ftp.download', r)
196
213
  r = await ftp.syncToLocal('.', './_test_download_client', (p) => {
197
214
  console.log('ftp.syncToLocal p', p.name, p.progress)
198
215
  })
199
216
  console.log('ftp.syncToLocal', r)
200
217
  }
201
218
  await core()
202
219
  .catch((err) => {
203
220
  console.log(err)
204
221
  })
205
222
  r = await ftp.quit()
206
223
  console.log('ftp.quit', r)
207
224
  .catch((err) => {
208
225
  console.log(err)
209
226
  })
210
227
  let r
211
228
  let ftp = WFtp()
212
229
  // console.log('ftp', ftp)
213
230
  await ftp.conn({
214
231
  hostname: `{hostname}`,
215
232
  port: `{port}`,
216
233
  username: `{username}`,
217
234
  password: `{password}`,
218
235
  })
219
236
  async function core() {
220
237
  let fps = await ftp.ls('.')
221
238
  console.log('ftp.ls', fps[0], fps.length)
222
239
  r = await ftp.upload('./_test_upload_client/DECL_20210805055044.csv', './DECL_20210805055044.csv', (p) => {
223
240
  console.log('ftp.upload p', p.name, p.progress)
224
241
  })
225
242
  console.log('ftp.upload', r)
226
243
  r = await ftp.syncToRemote('./_test_upload_client', '.', (p) => {
227
244
  console.log('ftp.syncToRemote p', p.name, p.progress)
228
245
  })
229
246
  console.log('ftp.syncToRemote', r)
230
247
  }
231
248
  await core()
232
249
  .catch((err) => {
233
250
  console.log(err)
234
251
  })
235
252
  r = await ftp.quit()
236
253
  console.log('ftp.quit', r)
237
254
  .catch((err) => {
238
255
  console.log(err)
239
256
  })
257
+
258
+
259
+
260
+
261
+
262
+
263
+
264
+
265
+
266
+
267
+
268
+
269
+
270
+
271
+
272
+
273
+
274
+
275
+ <h5 class="h5-returns">Returns:</h5>
276
+
277
+
278
+ <div class="param-desc">
279
+ <p>回傳FTP操作物件,包含conn、ls、stateFile、isFile、download、syncToLocal、syncToRemote、upload、quit。</p>
240
280
  </div>
241
281
 
242
282
 
243
283
 
284
+ <dl class="param-type">
285
+ <dt>
286
+ Type
287
+ </dt>
288
+ <dd>
289
+
290
+ <span class="param-type">Object</span>
291
+
292
+
293
+
294
+ </dd>
295
+ </dl>
296
+
297
+
298
+
299
+
300
+
301
+
302
+
303
+
304
+
305
+
306
+ <h4 class="name" id="conn"><span class="type-signature type-signature-async">(async) </span>conn<span class="signature">(opt<span class="signature-attributes">opt</span>)</span><span class="type-signature"> &rarr; {Promise}</span></h4>
307
+
308
+
309
+
310
+
311
+
312
+
313
+ <dl class="details">
314
+
315
+ <dt class="tag-description">Description:</dt>
316
+ <dd class="tag-description"><ul class="dummy"><li><p>連線至FPT伺服器</p></li></ul></dd>
317
+
318
+
319
+
320
+ <dt class="tag-source">Source:</dt>
321
+ <dd class="tag-source"><ul class="dummy"><li>
322
+ <a href="WFtp.mjs.html">WFtp.mjs</a>, <a href="WFtp.mjs.html#line64">line 64</a>
323
+ </li></ul></dd>
324
+
325
+
326
+
327
+
328
+
329
+
330
+
331
+
332
+
333
+
334
+
335
+
336
+
244
337
 
338
+
245
339
 
340
+
246
341
 
342
+
247
343
 
344
+
248
345
 
346
+
249
347
 
250
- <h5>Example</h5>
348
+
349
+
350
+
351
+
352
+
353
+
354
+
355
+ </dl>
356
+
357
+
358
+
359
+
360
+
361
+
362
+
363
+
364
+
365
+
366
+
367
+ <h5 class="h5-examples">Example</h5>
251
368
 
252
369
  <pre class="prettyprint"><code>import WFtp from './src/WFtp.mjs'
253
370
  let r
254
371
  let ftp = WFtp()
255
372
  // console.log('ftp', ftp)
256
373
  await ftp.conn({
257
374
  hostname: st.up.hostname,
258
375
  port: st.up.port,
259
376
  username: st.up.username,
260
377
  password: st.up.password,
261
378
  })
262
379
  //actions
263
380
  r = await ftp.quit()
264
381
  console.log('ftp.quit', r)
265
382
  .catch((err) => {
266
383
  console.log(err)
267
384
  })</code></pre>
268
385
 
269
386
 
270
387
 
271
388
 
272
- <h5>Parameters:</h5>
389
+ <h5 class="h5-parameters">Parameters:</h5>
273
390
 
274
391
 
275
392
  <table class="params">
@@ -232,6 +349,7 @@
232
349
  <span class="param-type">Object</span>
233
350
 
234
351
 
352
+
235
353
 
236
354
  </td>
237
355
 
@@ -292,6 +410,7 @@
292
410
  <span class="param-type">String</span>
293
411
 
294
412
 
413
+
295
414
 
296
415
  </td>
297
416
 
@@ -321,6 +440,7 @@
321
440
  <span class="param-type">Number</span>
322
441
 
323
442
 
443
+
324
444
 
325
445
  </td>
326
446
 
@@ -350,6 +470,7 @@
350
470
  <span class="param-type">String</span>
351
471
 
352
472
 
473
+
353
474
 
354
475
  </td>
355
476
 
@@ -379,6 +500,7 @@
379
500
  <span class="param-type">String</span>
380
501
 
381
502
 
503
+
382
504
 
383
505
  </td>
384
506
 
@@ -421,7 +543,7 @@
421
543
 
422
544
 
423
545
 
424
- <h5>Returns:</h5>
546
+ <h5 class="h5-returns">Returns:</h5>
425
547
 
426
548
 
427
549
  <div class="param-desc">
@@ -439,6 +561,7 @@
439
561
  <span class="param-type">Promise</span>
440
562
 
441
563
 
564
+
442
565
  </dd>
443
566
  </dl>
444
567
 
@@ -451,7 +574,7 @@
451
574
 
452
575
 
453
576
 
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>
577
+ <h4 class="name" id="download"><span class="type-signature type-signature-async">(async) </span>download<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
455
578
 
456
579
 
457
580
 
@@ -459,6 +582,10 @@
459
582
 
460
583
 
461
584
  <dl class="details">
585
+
586
+ <dt class="tag-description">Description:</dt>
587
+ <dd class="tag-description"><ul class="dummy"><li><p>下載伺服器指定檔案至本機</p></li></ul></dd>
588
+
462
589
 
463
590
 
464
591
  <dt class="tag-source">Source:</dt>
@@ -502,26 +629,20 @@
502
629
 
503
630
 
504
631
 
505
- <div class="description usertext">
506
- <p>下載伺服器指定檔案至本機</p>
507
- </div>
508
-
509
-
510
632
 
511
633
 
512
634
 
513
635
 
514
636
 
515
637
 
516
-
517
- <h5>Example</h5>
638
+ <h5 class="h5-examples">Example</h5>
518
639
 
519
640
  <pre class="prettyprint"><code>import WFtp from './src/WFtp.mjs'
520
641
  let r
521
642
  let ftp = WFtp()
522
643
  // console.log('ftp', ftp)
523
644
  await ftp.conn({
524
645
  hostname: st.up.hostname,
525
646
  port: st.up.port,
526
647
  username: st.up.username,
527
648
  password: st.up.password,
528
649
  })
529
650
  r = await ftp.download('./DECL_20210805055044.csv', './_test_download_client/DECL_20210805055044.csv', (p) => {
530
651
  console.log('ftp.download p', p.name, p.progress)
531
652
  })
532
653
  console.log('ftp.download', r)
533
654
  r = await ftp.quit()
534
655
  console.log('ftp.quit', r)
535
656
  .catch((err) => {
536
657
  console.log(err)
537
658
  })</code></pre>
538
659
 
539
660
 
540
661
 
541
662
 
542
- <h5>Parameters:</h5>
663
+ <h5 class="h5-parameters">Parameters:</h5>
543
664
 
544
665
 
545
666
  <table class="params">
@@ -559,6 +680,7 @@
559
680
  <span class="param-type">String</span>
560
681
 
561
682
 
683
+
562
684
 
563
685
  </td>
564
686
 
@@ -594,6 +716,7 @@
594
716
  <span class="param-type">String</span>
595
717
 
596
718
 
719
+
597
720
 
598
721
  </td>
599
722
 
@@ -629,6 +752,7 @@
629
752
  <span class="param-type">function</span>
630
753
 
631
754
 
755
+
632
756
 
633
757
  </td>
634
758
 
@@ -674,7 +798,7 @@
674
798
 
675
799
 
676
800
 
677
- <h5>Returns:</h5>
801
+ <h5 class="h5-returns">Returns:</h5>
678
802
 
679
803
 
680
804
  <div class="param-desc">
@@ -692,6 +816,7 @@
692
816
  <span class="param-type">Promise</span>
693
817
 
694
818
 
819
+
695
820
  </dd>
696
821
  </dl>
697
822
 
@@ -704,7 +829,7 @@
704
829
 
705
830
 
706
831
 
707
- <h4 class="name" id="isFile"><span class="type-signature">(async) </span>isFile<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
832
+ <h4 class="name" id="isFile"><span class="type-signature type-signature-async">(async) </span>isFile<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
708
833
 
709
834
 
710
835
 
@@ -712,6 +837,10 @@
712
837
 
713
838
 
714
839
  <dl class="details">
840
+
841
+ <dt class="tag-description">Description:</dt>
842
+ <dd class="tag-description"><ul class="dummy"><li><p>確認伺服器指定檔案是否存在</p></li></ul></dd>
843
+
715
844
 
716
845
 
717
846
  <dt class="tag-source">Source:</dt>
@@ -755,26 +884,20 @@
755
884
 
756
885
 
757
886
 
758
- <div class="description usertext">
759
- <p>確認伺服器指定檔案是否存在</p>
760
- </div>
761
-
762
-
763
-
764
887
 
765
888
 
766
889
 
767
890
 
768
891
 
769
892
 
770
- <h5>Example</h5>
893
+ <h5 class="h5-examples">Example</h5>
771
894
 
772
895
  <pre class="prettyprint"><code>import WFtp from './src/WFtp.mjs'
773
896
  let r
774
897
  let ftp = WFtp()
775
898
  // console.log('ftp', ftp)
776
899
  await ftp.conn({
777
900
  hostname: st.up.hostname,
778
901
  port: st.up.port,
779
902
  username: st.up.username,
780
903
  password: st.up.password,
781
904
  })
782
905
  r = await ftp.isFile('./_test_upload_client/DECL_20210805055044.csv')
783
906
  console.log('ftp.isFile', r)
784
907
  r = await ftp.quit()
785
908
  console.log('ftp.quit', r)
786
909
  .catch((err) => {
787
910
  console.log(err)
788
911
  })</code></pre>
789
912
 
790
913
 
791
914
 
792
915
 
793
- <h5>Parameters:</h5>
916
+ <h5 class="h5-parameters">Parameters:</h5>
794
917
 
795
918
 
796
919
  <table class="params">
@@ -808,6 +931,7 @@
808
931
  <span class="param-type">String</span>
809
932
 
810
933
 
934
+
811
935
 
812
936
  </td>
813
937
 
@@ -837,7 +961,7 @@
837
961
 
838
962
 
839
963
 
840
- <h5>Returns:</h5>
964
+ <h5 class="h5-returns">Returns:</h5>
841
965
 
842
966
 
843
967
  <div class="param-desc">
@@ -855,6 +979,7 @@
855
979
  <span class="param-type">Promise</span>
856
980
 
857
981
 
982
+
858
983
  </dd>
859
984
  </dl>
860
985
 
@@ -867,7 +992,7 @@
867
992
 
868
993
 
869
994
 
870
- <h4 class="name" id="isFolder"><span class="type-signature">(async) </span>isFolder<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
995
+ <h4 class="name" id="isFolder"><span class="type-signature type-signature-async">(async) </span>isFolder<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
871
996
 
872
997
 
873
998
 
@@ -875,6 +1000,10 @@
875
1000
 
876
1001
 
877
1002
  <dl class="details">
1003
+
1004
+ <dt class="tag-description">Description:</dt>
1005
+ <dd class="tag-description"><ul class="dummy"><li><p>確認伺服器指定資料夾是否存在</p></li></ul></dd>
1006
+
878
1007
 
879
1008
 
880
1009
  <dt class="tag-source">Source:</dt>
@@ -918,26 +1047,20 @@
918
1047
 
919
1048
 
920
1049
 
921
- <div class="description usertext">
922
- <p>確認伺服器指定資料夾是否存在</p>
923
- </div>
924
-
925
-
926
-
927
1050
 
928
1051
 
929
1052
 
930
1053
 
931
1054
 
932
1055
 
933
- <h5>Example</h5>
1056
+ <h5 class="h5-examples">Example</h5>
934
1057
 
935
1058
  <pre class="prettyprint"><code>import WFtp from './src/WFtp.mjs'
936
1059
  let r
937
1060
  let ftp = WFtp()
938
1061
  // console.log('ftp', ftp)
939
1062
  await ftp.conn({
940
1063
  hostname: st.up.hostname,
941
1064
  port: st.up.port,
942
1065
  username: st.up.username,
943
1066
  password: st.up.password,
944
1067
  })
945
1068
  r = await ftp.isFolder('./_test_upload_client')
946
1069
  console.log('ftp.isFolder', r)
947
1070
  r = await ftp.quit()
948
1071
  console.log('ftp.quit', r)
949
1072
  .catch((err) => {
950
1073
  console.log(err)
951
1074
  })</code></pre>
952
1075
 
953
1076
 
954
1077
 
955
1078
 
956
- <h5>Parameters:</h5>
1079
+ <h5 class="h5-parameters">Parameters:</h5>
957
1080
 
958
1081
 
959
1082
  <table class="params">
@@ -971,6 +1094,7 @@
971
1094
  <span class="param-type">String</span>
972
1095
 
973
1096
 
1097
+
974
1098
 
975
1099
  </td>
976
1100
 
@@ -1000,7 +1124,7 @@
1000
1124
 
1001
1125
 
1002
1126
 
1003
- <h5>Returns:</h5>
1127
+ <h5 class="h5-returns">Returns:</h5>
1004
1128
 
1005
1129
 
1006
1130
  <div class="param-desc">
@@ -1018,6 +1142,7 @@
1018
1142
  <span class="param-type">Promise</span>
1019
1143
 
1020
1144
 
1145
+
1021
1146
  </dd>
1022
1147
  </dl>
1023
1148
 
@@ -1030,7 +1155,7 @@
1030
1155
 
1031
1156
 
1032
1157
 
1033
- <h4 class="name" id="ls"><span class="type-signature">(async) </span>ls<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1158
+ <h4 class="name" id="ls"><span class="type-signature type-signature-async">(async) </span>ls<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1034
1159
 
1035
1160
 
1036
1161
 
@@ -1038,6 +1163,10 @@
1038
1163
 
1039
1164
 
1040
1165
  <dl class="details">
1166
+
1167
+ <dt class="tag-description">Description:</dt>
1168
+ <dd class="tag-description"><ul class="dummy"><li><p>遍歷伺服器上指定資料夾內檔案清單資訊</p></li></ul></dd>
1169
+
1041
1170
 
1042
1171
 
1043
1172
  <dt class="tag-source">Source:</dt>
@@ -1081,26 +1210,20 @@
1081
1210
 
1082
1211
 
1083
1212
 
1084
- <div class="description usertext">
1085
- <p>遍歷伺服器上指定資料夾內檔案清單資訊</p>
1086
- </div>
1087
1213
 
1088
1214
 
1089
1215
 
1090
1216
 
1091
1217
 
1092
1218
 
1093
-
1094
-
1095
-
1096
- <h5>Example</h5>
1219
+ <h5 class="h5-examples">Example</h5>
1097
1220
 
1098
1221
  <pre class="prettyprint"><code>import WFtp from './src/WFtp.mjs'
1099
1222
  let r
1100
1223
  let ftp = WFtp()
1101
1224
  // console.log('ftp', ftp)
1102
1225
  await ftp.conn({
1103
1226
  hostname: st.up.hostname,
1104
1227
  port: st.up.port,
1105
1228
  username: st.up.username,
1106
1229
  password: st.up.password,
1107
1230
  })
1108
1231
  let fps = await ftp.ls('.')
1109
1232
  console.log('ftp.ls', fps[0], fps.length)
1110
1233
  r = await ftp.quit()
1111
1234
  console.log('ftp.quit', r)
1112
1235
  .catch((err) => {
1113
1236
  console.log(err)
1114
1237
  })</code></pre>
1115
1238
 
1116
1239
 
1117
1240
 
1118
1241
 
1119
- <h5>Parameters:</h5>
1242
+ <h5 class="h5-parameters">Parameters:</h5>
1120
1243
 
1121
1244
 
1122
1245
  <table class="params">
@@ -1134,6 +1257,7 @@
1134
1257
  <span class="param-type">String</span>
1135
1258
 
1136
1259
 
1260
+
1137
1261
 
1138
1262
  </td>
1139
1263
 
@@ -1163,7 +1287,7 @@
1163
1287
 
1164
1288
 
1165
1289
 
1166
- <h5>Returns:</h5>
1290
+ <h5 class="h5-returns">Returns:</h5>
1167
1291
 
1168
1292
 
1169
1293
  <div class="param-desc">
@@ -1181,6 +1305,7 @@
1181
1305
  <span class="param-type">Promise</span>
1182
1306
 
1183
1307
 
1308
+
1184
1309
  </dd>
1185
1310
  </dl>
1186
1311
 
@@ -1193,7 +1318,7 @@
1193
1318
 
1194
1319
 
1195
1320
 
1196
- <h4 class="name" id="quit"><span class="type-signature">(async) </span>quit<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1321
+ <h4 class="name" id="quit"><span class="type-signature type-signature-async">(async) </span>quit<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1197
1322
 
1198
1323
 
1199
1324
 
@@ -1201,6 +1326,10 @@
1201
1326
 
1202
1327
 
1203
1328
  <dl class="details">
1329
+
1330
+ <dt class="tag-description">Description:</dt>
1331
+ <dd class="tag-description"><ul class="dummy"><li><p>關閉與伺服器連線</p></li></ul></dd>
1332
+
1204
1333
 
1205
1334
 
1206
1335
  <dt class="tag-source">Source:</dt>
@@ -1244,19 +1373,13 @@
1244
1373
 
1245
1374
 
1246
1375
 
1247
- <div class="description usertext">
1248
- <p>關閉與伺服器連線</p>
1249
- </div>
1250
-
1251
-
1252
-
1253
1376
 
1254
1377
 
1255
1378
 
1256
1379
 
1257
1380
 
1258
1381
 
1259
- <h5>Example</h5>
1382
+ <h5 class="h5-examples">Example</h5>
1260
1383
 
1261
1384
  <pre class="prettyprint"><code>import WFtp from './src/WFtp.mjs'
1262
1385
  let r
1263
1386
  let ftp = WFtp()
1264
1387
  // console.log('ftp', ftp)
1265
1388
  await ftp.conn({
1266
1389
  hostname: st.up.hostname,
1267
1390
  port: st.up.port,
1268
1391
  username: st.up.username,
1269
1392
  password: st.up.password,
1270
1393
  })
1271
1394
  //actions
1272
1395
  r = await ftp.quit()
1273
1396
  console.log('ftp.quit', r)
1274
1397
  .catch((err) => {
1275
1398
  console.log(err)
1276
1399
  })</code></pre>
1277
1400
 
@@ -1277,7 +1400,7 @@
1277
1400
 
1278
1401
 
1279
1402
 
1280
- <h5>Returns:</h5>
1403
+ <h5 class="h5-returns">Returns:</h5>
1281
1404
 
1282
1405
 
1283
1406
  <div class="param-desc">
@@ -1295,6 +1418,7 @@
1295
1418
  <span class="param-type">Promise</span>
1296
1419
 
1297
1420
 
1421
+
1298
1422
  </dd>
1299
1423
  </dl>
1300
1424
 
@@ -1307,7 +1431,7 @@
1307
1431
 
1308
1432
 
1309
1433
 
1310
- <h4 class="name" id="stateFile"><span class="type-signature">(async) </span>stateFile<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1434
+ <h4 class="name" id="stateFile"><span class="type-signature type-signature-async">(async) </span>stateFile<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1311
1435
 
1312
1436
 
1313
1437
 
@@ -1315,6 +1439,10 @@
1315
1439
 
1316
1440
 
1317
1441
  <dl class="details">
1442
+
1443
+ <dt class="tag-description">Description:</dt>
1444
+ <dd class="tag-description"><ul class="dummy"><li><p>取得伺服器指定檔案資訊</p></li></ul></dd>
1445
+
1318
1446
 
1319
1447
 
1320
1448
  <dt class="tag-source">Source:</dt>
@@ -1358,26 +1486,20 @@
1358
1486
 
1359
1487
 
1360
1488
 
1361
- <div class="description usertext">
1362
- <p>取得伺服器指定檔案資訊</p>
1363
- </div>
1364
-
1365
-
1366
1489
 
1367
1490
 
1368
1491
 
1369
1492
 
1370
1493
 
1371
1494
 
1372
-
1373
- <h5>Example</h5>
1495
+ <h5 class="h5-examples">Example</h5>
1374
1496
 
1375
1497
  <pre class="prettyprint"><code>import WFtp from './src/WFtp.mjs'
1376
1498
  let r
1377
1499
  let ftp = WFtp()
1378
1500
  // console.log('ftp', ftp)
1379
1501
  await ftp.conn({
1380
1502
  hostname: st.up.hostname,
1381
1503
  port: st.up.port,
1382
1504
  username: st.up.username,
1383
1505
  password: st.up.password,
1384
1506
  })
1385
1507
  r = await ftp.stateFile('./_test_upload_client/DECL_20210805055044.csv')
1386
1508
  console.log('ftp.stateFile', r)
1387
1509
  r = await ftp.quit()
1388
1510
  console.log('ftp.quit', r)
1389
1511
  .catch((err) => {
1390
1512
  console.log(err)
1391
1513
  })</code></pre>
1392
1514
 
1393
1515
 
1394
1516
 
1395
1517
 
1396
- <h5>Parameters:</h5>
1518
+ <h5 class="h5-parameters">Parameters:</h5>
1397
1519
 
1398
1520
 
1399
1521
  <table class="params">
@@ -1411,6 +1533,7 @@
1411
1533
  <span class="param-type">String</span>
1412
1534
 
1413
1535
 
1536
+
1414
1537
 
1415
1538
  </td>
1416
1539
 
@@ -1440,7 +1563,7 @@
1440
1563
 
1441
1564
 
1442
1565
 
1443
- <h5>Returns:</h5>
1566
+ <h5 class="h5-returns">Returns:</h5>
1444
1567
 
1445
1568
 
1446
1569
  <div class="param-desc">
@@ -1458,6 +1581,7 @@
1458
1581
  <span class="param-type">Promise</span>
1459
1582
 
1460
1583
 
1584
+
1461
1585
  </dd>
1462
1586
  </dl>
1463
1587
 
@@ -1470,7 +1594,7 @@
1470
1594
 
1471
1595
 
1472
1596
 
1473
- <h4 class="name" id="syncToLocal"><span class="type-signature">(async) </span>syncToLocal<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1597
+ <h4 class="name" id="syncToLocal"><span class="type-signature type-signature-async">(async) </span>syncToLocal<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1474
1598
 
1475
1599
 
1476
1600
 
@@ -1478,6 +1602,10 @@
1478
1602
 
1479
1603
 
1480
1604
  <dl class="details">
1605
+
1606
+ <dt class="tag-description">Description:</dt>
1607
+ <dd class="tag-description"><ul class="dummy"><li><p>同步伺服器上指定資料夾內檔案至本機</p></li></ul></dd>
1608
+
1481
1609
 
1482
1610
 
1483
1611
  <dt class="tag-source">Source:</dt>
@@ -1521,26 +1649,20 @@
1521
1649
 
1522
1650
 
1523
1651
 
1524
- <div class="description usertext">
1525
- <p>同步伺服器上指定資料夾內檔案至本機</p>
1526
- </div>
1527
-
1528
1652
 
1529
1653
 
1530
1654
 
1531
1655
 
1532
1656
 
1533
1657
 
1534
-
1535
-
1536
- <h5>Example</h5>
1658
+ <h5 class="h5-examples">Example</h5>
1537
1659
 
1538
1660
  <pre class="prettyprint"><code>import WFtp from './src/WFtp.mjs'
1539
1661
  let r
1540
1662
  let ftp = WFtp()
1541
1663
  // console.log('ftp', ftp)
1542
1664
  await ftp.conn({
1543
1665
  hostname: st.up.hostname,
1544
1666
  port: st.up.port,
1545
1667
  username: st.up.username,
1546
1668
  password: st.up.password,
1547
1669
  })
1548
1670
  r = await ftp.syncToLocal('.', './_test_download_client', (p) => {
1549
1671
  console.log('ftp.syncToLocal p', p.name, p.progress)
1550
1672
  })
1551
1673
  console.log('ftp.syncToLocal', r)
1552
1674
  r = await ftp.quit()
1553
1675
  console.log('ftp.quit', r)
1554
1676
  .catch((err) => {
1555
1677
  console.log(err)
1556
1678
  })</code></pre>
1557
1679
 
1558
1680
 
1559
1681
 
1560
1682
 
1561
- <h5>Parameters:</h5>
1683
+ <h5 class="h5-parameters">Parameters:</h5>
1562
1684
 
1563
1685
 
1564
1686
  <table class="params">
@@ -1578,6 +1700,7 @@
1578
1700
  <span class="param-type">String</span>
1579
1701
 
1580
1702
 
1703
+
1581
1704
 
1582
1705
  </td>
1583
1706
 
@@ -1613,6 +1736,7 @@
1613
1736
  <span class="param-type">String</span>
1614
1737
 
1615
1738
 
1739
+
1616
1740
 
1617
1741
  </td>
1618
1742
 
@@ -1648,6 +1772,7 @@
1648
1772
  <span class="param-type">function</span>
1649
1773
 
1650
1774
 
1775
+
1651
1776
 
1652
1777
  </td>
1653
1778
 
@@ -1693,7 +1818,7 @@
1693
1818
 
1694
1819
 
1695
1820
 
1696
- <h5>Returns:</h5>
1821
+ <h5 class="h5-returns">Returns:</h5>
1697
1822
 
1698
1823
 
1699
1824
  <div class="param-desc">
@@ -1711,6 +1836,7 @@
1711
1836
  <span class="param-type">Promise</span>
1712
1837
 
1713
1838
 
1839
+
1714
1840
  </dd>
1715
1841
  </dl>
1716
1842
 
@@ -1723,7 +1849,7 @@
1723
1849
 
1724
1850
 
1725
1851
 
1726
- <h4 class="name" id="syncToRemote"><span class="type-signature">(async) </span>syncToRemote<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1852
+ <h4 class="name" id="syncToRemote"><span class="type-signature type-signature-async">(async) </span>syncToRemote<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1727
1853
 
1728
1854
 
1729
1855
 
@@ -1731,6 +1857,10 @@
1731
1857
 
1732
1858
 
1733
1859
  <dl class="details">
1860
+
1861
+ <dt class="tag-description">Description:</dt>
1862
+ <dd class="tag-description"><ul class="dummy"><li><p>同步本機指定資料夾內檔案至伺服器</p></li></ul></dd>
1863
+
1734
1864
 
1735
1865
 
1736
1866
  <dt class="tag-source">Source:</dt>
@@ -1774,26 +1904,20 @@
1774
1904
 
1775
1905
 
1776
1906
 
1777
- <div class="description usertext">
1778
- <p>同步本機指定資料夾內檔案至伺服器</p>
1779
- </div>
1780
-
1781
1907
 
1782
1908
 
1783
1909
 
1784
1910
 
1785
1911
 
1786
1912
 
1787
-
1788
-
1789
- <h5>Example</h5>
1913
+ <h5 class="h5-examples">Example</h5>
1790
1914
 
1791
1915
  <pre class="prettyprint"><code>import WFtp from './src/WFtp.mjs'
1792
1916
  let r
1793
1917
  let ftp = WFtp()
1794
1918
  // console.log('ftp', ftp)
1795
1919
  await ftp.conn({
1796
1920
  hostname: st.up.hostname,
1797
1921
  port: st.up.port,
1798
1922
  username: st.up.username,
1799
1923
  password: st.up.password,
1800
1924
  })
1801
1925
  r = await ftp.syncToRemote('./_test_upload_client', '.', (p) => {
1802
1926
  console.log('ftp.syncToRemote p', p.name, p.progress)
1803
1927
  })
1804
1928
  console.log('ftp.syncToRemote', r)
1805
1929
  r = await ftp.quit()
1806
1930
  console.log('ftp.quit', r)
1807
1931
  .catch((err) => {
1808
1932
  console.log(err)
1809
1933
  })</code></pre>
1810
1934
 
1811
1935
 
1812
1936
 
1813
1937
 
1814
- <h5>Parameters:</h5>
1938
+ <h5 class="h5-parameters">Parameters:</h5>
1815
1939
 
1816
1940
 
1817
1941
  <table class="params">
@@ -1831,6 +1955,7 @@
1831
1955
  <span class="param-type">String</span>
1832
1956
 
1833
1957
 
1958
+
1834
1959
 
1835
1960
  </td>
1836
1961
 
@@ -1866,6 +1991,7 @@
1866
1991
  <span class="param-type">String</span>
1867
1992
 
1868
1993
 
1994
+
1869
1995
 
1870
1996
  </td>
1871
1997
 
@@ -1901,6 +2027,7 @@
1901
2027
  <span class="param-type">function</span>
1902
2028
 
1903
2029
 
2030
+
1904
2031
 
1905
2032
  </td>
1906
2033
 
@@ -1946,7 +2073,7 @@
1946
2073
 
1947
2074
 
1948
2075
 
1949
- <h5>Returns:</h5>
2076
+ <h5 class="h5-returns">Returns:</h5>
1950
2077
 
1951
2078
 
1952
2079
  <div class="param-desc">
@@ -1964,6 +2091,7 @@
1964
2091
  <span class="param-type">Promise</span>
1965
2092
 
1966
2093
 
2094
+
1967
2095
  </dd>
1968
2096
  </dl>
1969
2097
 
@@ -1976,7 +2104,7 @@
1976
2104
 
1977
2105
 
1978
2106
 
1979
- <h4 class="name" id="upload"><span class="type-signature">(async) </span>upload<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
2107
+ <h4 class="name" id="upload"><span class="type-signature type-signature-async">(async) </span>upload<span class="signature">()</span><span class="type-signature"> &rarr; {Promise}</span></h4>
1980
2108
 
1981
2109
 
1982
2110
 
@@ -1984,6 +2112,10 @@
1984
2112
 
1985
2113
 
1986
2114
  <dl class="details">
2115
+
2116
+ <dt class="tag-description">Description:</dt>
2117
+ <dd class="tag-description"><ul class="dummy"><li><p>上傳本機指定檔案至伺服器</p></li></ul></dd>
2118
+
1987
2119
 
1988
2120
 
1989
2121
  <dt class="tag-source">Source:</dt>
@@ -2027,26 +2159,20 @@
2027
2159
 
2028
2160
 
2029
2161
 
2030
- <div class="description usertext">
2031
- <p>上傳本機指定檔案至伺服器</p>
2032
- </div>
2033
2162
 
2034
2163
 
2035
2164
 
2036
2165
 
2037
2166
 
2038
2167
 
2039
-
2040
-
2041
-
2042
- <h5>Example</h5>
2168
+ <h5 class="h5-examples">Example</h5>
2043
2169
 
2044
2170
  <pre class="prettyprint"><code>import WFtp from './src/WFtp.mjs'
2045
2171
  let r
2046
2172
  let ftp = WFtp()
2047
2173
  // console.log('ftp', ftp)
2048
2174
  await ftp.conn({
2049
2175
  hostname: st.up.hostname,
2050
2176
  port: st.up.port,
2051
2177
  username: st.up.username,
2052
2178
  password: st.up.password,
2053
2179
  })
2054
2180
  r = await ftp.upload('./_test_upload_client/DECL_20210805055044.csv', './DECL_20210805055044.csv', (p) => {
2055
2181
  console.log('ftp.upload p', p.name, p.progress)
2056
2182
  })
2057
2183
  console.log('ftp.upload', r)
2058
2184
  r = await ftp.quit()
2059
2185
  console.log('ftp.quit', r)
2060
2186
  .catch((err) => {
2061
2187
  console.log(err)
2062
2188
  })</code></pre>
2063
2189
 
2064
2190
 
2065
2191
 
2066
2192
 
2067
- <h5>Parameters:</h5>
2193
+ <h5 class="h5-parameters">Parameters:</h5>
2068
2194
 
2069
2195
 
2070
2196
  <table class="params">
@@ -2084,6 +2210,7 @@
2084
2210
  <span class="param-type">String</span>
2085
2211
 
2086
2212
 
2213
+
2087
2214
 
2088
2215
  </td>
2089
2216
 
@@ -2119,6 +2246,7 @@
2119
2246
  <span class="param-type">String</span>
2120
2247
 
2121
2248
 
2249
+
2122
2250
 
2123
2251
  </td>
2124
2252
 
@@ -2154,6 +2282,7 @@
2154
2282
  <span class="param-type">function</span>
2155
2283
 
2156
2284
 
2285
+
2157
2286
 
2158
2287
  </td>
2159
2288
 
@@ -2199,7 +2328,7 @@
2199
2328
 
2200
2329
 
2201
2330
 
2202
- <h5>Returns:</h5>
2331
+ <h5 class="h5-returns">Returns:</h5>
2203
2332
 
2204
2333
 
2205
2334
  <div class="param-desc">
@@ -2217,119 +2346,6 @@
2217
2346
  <span class="param-type">Promise</span>
2218
2347
 
2219
2348
 
2220
- </dd>
2221
- </dl>
2222
-
2223
-
2224
-
2225
-
2226
-
2227
-
2228
-
2229
-
2230
-
2231
-
2232
- <h4 class="name" id="WFtp"><span class="type-signature"></span>WFtp<span class="signature">()</span><span class="type-signature"> &rarr; {Object}</span></h4>
2233
-
2234
-
2235
-
2236
-
2237
-
2238
-
2239
- <dl class="details">
2240
-
2241
-
2242
- <dt class="tag-source">Source:</dt>
2243
- <dd class="tag-source"><ul class="dummy"><li>
2244
- <a href="WFtp.mjs.html">WFtp.mjs</a>, <a href="WFtp.mjs.html#line572">line 572</a>
2245
- </li></ul></dd>
2246
-
2247
-
2248
-
2249
-
2250
-
2251
-
2252
-
2253
-
2254
-
2255
-
2256
-
2257
-
2258
-
2259
-
2260
-
2261
-
2262
-
2263
-
2264
-
2265
-
2266
-
2267
-
2268
-
2269
-
2270
-
2271
-
2272
-
2273
-
2274
-
2275
-
2276
-
2277
- </dl>
2278
-
2279
-
2280
-
2281
-
2282
-
2283
- <div class="description usertext">
2284
- <p>操作FTP,包含連線、下載、資料夾內檔案同步下載、上傳、資料夾內檔案同步上傳等功能</p>
2285
- </div>
2286
-
2287
-
2288
-
2289
-
2290
-
2291
-
2292
-
2293
-
2294
-
2295
- <h5>Example</h5>
2296
-
2297
- <pre class="prettyprint"><code>import WFtp from './src/WFtp.mjs'
2298
2349
  let r
2299
2350
  let ftp = WFtp()
2300
2351
  // console.log('ftp', ftp)
2301
2352
  await ftp.conn({
2302
2353
  hostname: `{hostname}`,
2303
2354
  port: `{port}`,
2304
2355
  username: `{username}`,
2305
2356
  password: `{password}`,
2306
2357
  })
2307
2358
  async function core() {
2308
2359
  let fps = await ftp.ls('.')
2309
2360
  console.log('ftp.ls', fps[0], fps.length)
2310
2361
  r = await ftp.download('./DECL_20210805055044.csv', './_test_download_client/DECL_20210805055044.csv', (p) => {
2311
2362
  console.log('ftp.download p', p.name, p.progress)
2312
2363
  })
2313
2364
  console.log('ftp.download', r)
2314
2365
  r = await ftp.syncToLocal('.', './_test_download_client', (p) => {
2315
2366
  console.log('ftp.syncToLocal p', p.name, p.progress)
2316
2367
  })
2317
2368
  console.log('ftp.syncToLocal', r)
2318
2369
  }
2319
2370
  await core()
2320
2371
  .catch((err) => {
2321
2372
  console.log(err)
2322
2373
  })
2323
2374
  r = await ftp.quit()
2324
2375
  console.log('ftp.quit', r)
2325
2376
  .catch((err) => {
2326
2377
  console.log(err)
2327
2378
  })
2328
2379
  let r
2329
2380
  let ftp = WFtp()
2330
2381
  // console.log('ftp', ftp)
2331
2382
  await ftp.conn({
2332
2383
  hostname: `{hostname}`,
2333
2384
  port: `{port}`,
2334
2385
  username: `{username}`,
2335
2386
  password: `{password}`,
2336
2387
  })
2337
2388
  async function core() {
2338
2389
  let fps = await ftp.ls('.')
2339
2390
  console.log('ftp.ls', fps[0], fps.length)
2340
2391
  r = await ftp.upload('./_test_upload_client/DECL_20210805055044.csv', './DECL_20210805055044.csv', (p) => {
2341
2392
  console.log('ftp.upload p', p.name, p.progress)
2342
2393
  })
2343
2394
  console.log('ftp.upload', r)
2344
2395
  r = await ftp.syncToRemote('./_test_upload_client', '.', (p) => {
2345
2396
  console.log('ftp.syncToRemote p', p.name, p.progress)
2346
2397
  })
2347
2398
  console.log('ftp.syncToRemote', r)
2348
2399
  }
2349
2400
  await core()
2350
2401
  .catch((err) => {
2351
2402
  console.log(err)
2352
2403
  })
2353
2404
  r = await ftp.quit()
2354
2405
  console.log('ftp.quit', r)
2355
2406
  .catch((err) => {
2356
2407
  console.log(err)
2357
2408
  })
2358
-
2359
-
2360
-
2361
-
2362
-
2363
-
2364
-
2365
-
2366
-
2367
-
2368
-
2369
-
2370
-
2371
-
2372
-
2373
-
2374
-
2375
-
2376
- <h5>Returns:</h5>
2377
-
2378
-
2379
- <div class="param-desc">
2380
- <p>回傳FTP操作物件,包含conn、ls、stateFile、isFile、download、syncToLocal、syncToRemote、upload、quit。</p>
2381
- </div>
2382
-
2383
-
2384
-
2385
- <dl class="param-type">
2386
- <dt>
2387
- Type
2388
- </dt>
2389
- <dd>
2390
-
2391
- <span class="param-type">Object</span>
2392
-
2393
2409
 
2394
2410
  </dd>
2395
2411
  </dl>
@@ -2358,7 +2374,7 @@
2358
2374
  <br class="clear">
2359
2375
 
2360
2376
  <footer>
2361
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.6.10</a> on Thu Jan 19 2023 12:20:00 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
2377
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Wed Mar 29 2023 12:23:37 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
2362
2378
  </footer>
2363
2379
 
2364
2380
  <script>prettyPrint();</script>