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