w-md2docx 1.0.0 → 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 +4 -4
- package/dist/w-md2docx.umd.js +2 -2
- package/dist/w-md2docx.umd.js.map +1 -1
- package/docs/WMd2docx.mjs.html +7 -7
- package/docs/cvMdTo.mjs.html +2 -2
- package/docs/cvMdToDocx.mjs.html +2 -2
- package/docs/global.html +1192 -1192
- package/docs/index.html +2 -2
- package/docs/{ApiClient.mjs.html → rmApiClient.mjs.html} +10 -10
- package/docs/{ApiServer.mjs.html → rmApiServer.mjs.html} +8 -8
- package/docs/utils.mjs.html +2 -2
- package/package.json +5 -5
- package/script.txt +0 -1
- package/src/WMd2docx.mjs +5 -5
- package/src/{ApiClient.mjs → rmApiClient.mjs} +6 -6
- package/src/{ApiServer.mjs → rmApiServer.mjs} +4 -4
- package/test/{api-ApiClient.test.mjs → api-rmApiClient.test.mjs} +10 -10
- package/test/{api-ApiServer.test.mjs → api-rmApiServer.test.mjs} +7 -7
- package/toolg/gDistRollup.mjs +2 -2
- package/toolg/gDocsExams.mjs +0 -51
package/docs/global.html
CHANGED
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
<nav >
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
<h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#
|
|
32
|
+
<h2><a href="index.html">Home</a></h2><h3>Global</h3><ul><li><a href="global.html#WMd2docx">WMd2docx</a></li><li><a href="global.html#checkDocxReady">checkDocxReady</a></li><li><a href="global.html#cleanWorkDir">cleanWorkDir</a></li><li><a href="global.html#cvMdTo">cvMdTo</a></li><li><a href="global.html#cvMdToDocx">cvMdToDocx</a></li><li><a href="global.html#getFpExe">getFpExe</a></li><li><a href="global.html#getQueueSize">getQueueSize</a></li><li><a href="global.html#health">health</a></li><li><a href="global.html#readAssets">readAssets</a></li><li><a href="global.html#resolveAssetPaths">resolveAssetPaths</a></li><li><a href="global.html#retryBusy">retryBusy</a></li><li><a href="global.html#rmApiServer">rmApiServer</a></li><li><a href="global.html#runExclusive">runExclusive</a></li><li><a href="global.html#scanAssetPaths">scanAssetPaths</a></li><li><a href="global.html#toErrText">toErrText</a></li><li><a href="global.html#toSafeName">toSafeName</a></li><li><a href="global.html#transErrAsset">transErrAsset</a></li><li><a href="global.html#writeAssets">writeAssets</a></li></ul>
|
|
33
33
|
|
|
34
34
|
</nav>
|
|
35
35
|
|
|
@@ -135,7 +135,7 @@
|
|
|
135
135
|
|
|
136
136
|
<dt class="tag-description">Description:</dt>
|
|
137
137
|
<dd class="tag-description"><ul class="dummy"><li><p>Markdown轉Docx工具集</p>
|
|
138
|
-
<p>匯整四個入口:cvMdToDocx(md檔轉docx檔)、cvMdTo(md內容轉html/docx之base64)、
|
|
138
|
+
<p>匯整四個入口:cvMdToDocx(md檔轉docx檔)、cvMdTo(md內容轉html/docx之base64)、rmApiServer(hapi轉檔服務)、rmApiClient(呼叫轉檔服務之用戶端)。</p></li></ul></dd>
|
|
139
139
|
|
|
140
140
|
|
|
141
141
|
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
|
|
183
183
|
<div class="description usertext">
|
|
184
184
|
<p>Markdown轉Docx工具集</p>
|
|
185
|
-
<p>匯整四個入口:cvMdToDocx(md檔轉docx檔)、cvMdTo(md內容轉html/docx之base64)、
|
|
185
|
+
<p>匯整四個入口:cvMdToDocx(md檔轉docx檔)、cvMdTo(md內容轉html/docx之base64)、rmApiServer(hapi轉檔服務)、rmApiClient(呼叫轉檔服務之用戶端)。</p>
|
|
186
186
|
</div>
|
|
187
187
|
|
|
188
188
|
|
|
@@ -212,7 +212,7 @@ console.log(r)
|
|
|
212
212
|
|
|
213
213
|
|
|
214
214
|
|
|
215
|
-
<h4 class="name" id="
|
|
215
|
+
<h4 class="name" id="checkDocxReady"><span class="type-signature"></span>checkDocxReady<span class="signature">()</span><span class="type-signature"> → {Object}</span></h4>
|
|
216
216
|
|
|
217
217
|
|
|
218
218
|
|
|
@@ -222,14 +222,14 @@ console.log(r)
|
|
|
222
222
|
<dl class="details">
|
|
223
223
|
|
|
224
224
|
<dt class="tag-description">Description:</dt>
|
|
225
|
-
<dd class="tag-description"><ul class="dummy"><li><p
|
|
226
|
-
<p
|
|
225
|
+
<dd class="tag-description"><ul class="dummy"><li><p>檢查本機是否具備docx轉檔條件(Windows且轉檔器存在)</p>
|
|
226
|
+
<p>注意:僅代表環境條件成立,不代表Word確實可被調用;後者須實際轉一份小檔驗證。</p></li></ul></dd>
|
|
227
227
|
|
|
228
228
|
|
|
229
229
|
|
|
230
230
|
<dt class="tag-source">Source:</dt>
|
|
231
231
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
232
|
-
<a href="
|
|
232
|
+
<a href="utils.mjs.html">utils.mjs</a>, <a href="utils.mjs.html#line205">line 205</a>
|
|
233
233
|
</li></ul></dd>
|
|
234
234
|
|
|
235
235
|
|
|
@@ -276,82 +276,129 @@ console.log(r)
|
|
|
276
276
|
|
|
277
277
|
<h5 class="h5-examples">Example</h5>
|
|
278
278
|
|
|
279
|
-
<pre class="prettyprint"><code>
|
|
279
|
+
<pre class="prettyprint"><code>console.log(checkDocxReady())
|
|
280
|
+
// => { platform: 'win32', isWindows: true, cwd: '...', exePath: '...', exeFound: true, ready: true }</code></pre>
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
|
|
284
|
+
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
|
|
288
|
+
|
|
280
289
|
|
|
281
|
-
let { server, settings } = await ApiServer({
|
|
282
|
-
port: 22000,
|
|
283
|
-
token: '',
|
|
284
|
-
})
|
|
285
|
-
console.log(`listening on ${server.info.uri}`, settings)</code></pre>
|
|
286
290
|
|
|
287
291
|
|
|
288
292
|
|
|
289
293
|
|
|
290
|
-
<h5 class="h5-parameters">Parameters:</h5>
|
|
291
|
-
|
|
292
294
|
|
|
293
|
-
<table class="params">
|
|
294
|
-
<thead>
|
|
295
|
-
<tr>
|
|
296
|
-
|
|
297
|
-
<th>Name</th>
|
|
298
|
-
|
|
299
295
|
|
|
300
|
-
<th>Type</th>
|
|
301
296
|
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
<h5 class="h5-returns">Returns:</h5>
|
|
305
300
|
|
|
306
301
|
|
|
307
|
-
|
|
302
|
+
<div class="param-desc">
|
|
303
|
+
<p>回傳狀態物件{platform,isWindows,cwd,exePath,exeFound,ready}</p>
|
|
304
|
+
</div>
|
|
305
|
+
|
|
306
|
+
|
|
307
|
+
|
|
308
|
+
<dl class="param-type">
|
|
309
|
+
<dt>
|
|
310
|
+
Type
|
|
311
|
+
</dt>
|
|
312
|
+
<dd>
|
|
308
313
|
|
|
314
|
+
<span class="param-type">Object</span>
|
|
309
315
|
|
|
310
|
-
<th class="last">Description</th>
|
|
311
|
-
</tr>
|
|
312
|
-
</thead>
|
|
313
316
|
|
|
314
|
-
|
|
317
|
+
|
|
318
|
+
</dd>
|
|
319
|
+
</dl>
|
|
320
|
+
|
|
315
321
|
|
|
316
322
|
|
|
317
|
-
<tr>
|
|
318
|
-
|
|
319
|
-
<td class="name"><code>opt</code></td>
|
|
320
|
-
|
|
321
323
|
|
|
322
|
-
|
|
324
|
+
|
|
325
|
+
|
|
323
326
|
|
|
324
|
-
|
|
325
|
-
<span class="param-type">Object</span>
|
|
326
327
|
|
|
328
|
+
|
|
327
329
|
|
|
330
|
+
<h4 class="name" id="cleanWorkDir"><span class="type-signature"></span>cleanWorkDir<span class="signature">(dirWork, opt<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Integer}</span></h4>
|
|
328
331
|
|
|
329
|
-
|
|
330
|
-
</td>
|
|
332
|
+
|
|
331
333
|
|
|
332
|
-
|
|
333
|
-
<td class="attributes">
|
|
334
|
-
|
|
335
|
-
<optional><br>
|
|
336
|
-
|
|
337
334
|
|
|
338
|
-
|
|
339
335
|
|
|
340
|
-
|
|
341
|
-
</td>
|
|
342
|
-
|
|
343
336
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
337
|
+
<dl class="details">
|
|
338
|
+
|
|
339
|
+
<dt class="tag-description">Description:</dt>
|
|
340
|
+
<dd class="tag-description"><ul class="dummy"><li><p>清除工作資料夾內逾時未刪之作業夾(前綴job_)</p>
|
|
341
|
+
<p>工作資料夾不存在時自動建立。</p></li></ul></dd>
|
|
342
|
+
|
|
351
343
|
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
344
|
+
|
|
345
|
+
<dt class="tag-source">Source:</dt>
|
|
346
|
+
<dd class="tag-source"><ul class="dummy"><li>
|
|
347
|
+
<a href="utils.mjs.html">utils.mjs</a>, <a href="utils.mjs.html#line369">line 369</a>
|
|
348
|
+
</li></ul></dd>
|
|
349
|
+
|
|
350
|
+
|
|
351
|
+
|
|
352
|
+
|
|
353
|
+
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
|
|
360
|
+
|
|
361
|
+
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
|
|
370
|
+
|
|
371
|
+
|
|
372
|
+
|
|
373
|
+
|
|
374
|
+
|
|
375
|
+
|
|
376
|
+
|
|
377
|
+
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
</dl>
|
|
381
|
+
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
|
|
387
|
+
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
|
|
391
|
+
|
|
392
|
+
<h5 class="h5-examples">Example</h5>
|
|
393
|
+
|
|
394
|
+
<pre class="prettyprint"><code>let n = cleanWorkDir('./tmp', { msAge: 3600 * 1000 })
|
|
395
|
+
// => 2</code></pre>
|
|
396
|
+
|
|
397
|
+
|
|
398
|
+
|
|
399
|
+
|
|
400
|
+
<h5 class="h5-parameters">Parameters:</h5>
|
|
401
|
+
|
|
355
402
|
|
|
356
403
|
<table class="params">
|
|
357
404
|
<thead>
|
|
@@ -379,13 +426,13 @@ console.log(`listening on ${server.info.uri}`, settings)</code></pre>
|
|
|
379
426
|
|
|
380
427
|
<tr>
|
|
381
428
|
|
|
382
|
-
<td class="name"><code>
|
|
429
|
+
<td class="name"><code>dirWork</code></td>
|
|
383
430
|
|
|
384
431
|
|
|
385
432
|
<td class="type">
|
|
386
433
|
|
|
387
434
|
|
|
388
|
-
<span class="param-type">
|
|
435
|
+
<span class="param-type">String</span>
|
|
389
436
|
|
|
390
437
|
|
|
391
438
|
|
|
@@ -395,8 +442,6 @@ console.log(`listening on ${server.info.uri}`, settings)</code></pre>
|
|
|
395
442
|
|
|
396
443
|
<td class="attributes">
|
|
397
444
|
|
|
398
|
-
<optional><br>
|
|
399
|
-
|
|
400
445
|
|
|
401
446
|
|
|
402
447
|
|
|
@@ -407,25 +452,23 @@ console.log(`listening on ${server.info.uri}`, settings)</code></pre>
|
|
|
407
452
|
|
|
408
453
|
<td class="default">
|
|
409
454
|
|
|
410
|
-
<code>22000</code>
|
|
411
|
-
|
|
412
455
|
</td>
|
|
413
456
|
|
|
414
457
|
|
|
415
|
-
<td class="description last"><p
|
|
458
|
+
<td class="description last"><p>輸入工作資料夾位置字串</p></td>
|
|
416
459
|
</tr>
|
|
417
460
|
|
|
418
461
|
|
|
419
462
|
|
|
420
463
|
<tr>
|
|
421
464
|
|
|
422
|
-
<td class="name"><code>
|
|
465
|
+
<td class="name"><code>opt</code></td>
|
|
423
466
|
|
|
424
467
|
|
|
425
468
|
<td class="type">
|
|
426
469
|
|
|
427
470
|
|
|
428
|
-
<span class="param-type">
|
|
471
|
+
<span class="param-type">Object</span>
|
|
429
472
|
|
|
430
473
|
|
|
431
474
|
|
|
@@ -447,25 +490,48 @@ console.log(`listening on ${server.info.uri}`, settings)</code></pre>
|
|
|
447
490
|
|
|
448
491
|
<td class="default">
|
|
449
492
|
|
|
450
|
-
<code>
|
|
493
|
+
<code>{}</code>
|
|
451
494
|
|
|
452
495
|
</td>
|
|
453
496
|
|
|
454
497
|
|
|
455
|
-
<td class="description last"><p
|
|
456
|
-
|
|
498
|
+
<td class="description last"><p>輸入設定物件,預設{}</p>
|
|
499
|
+
<h6>Properties</h6>
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
<table class="params">
|
|
503
|
+
<thead>
|
|
504
|
+
<tr>
|
|
505
|
+
|
|
506
|
+
<th>Name</th>
|
|
507
|
+
|
|
508
|
+
|
|
509
|
+
<th>Type</th>
|
|
510
|
+
|
|
511
|
+
|
|
512
|
+
<th>Attributes</th>
|
|
513
|
+
|
|
514
|
+
|
|
515
|
+
|
|
516
|
+
<th>Default</th>
|
|
517
|
+
|
|
518
|
+
|
|
519
|
+
<th class="last">Description</th>
|
|
520
|
+
</tr>
|
|
521
|
+
</thead>
|
|
457
522
|
|
|
523
|
+
<tbody>
|
|
458
524
|
|
|
459
525
|
|
|
460
526
|
<tr>
|
|
461
527
|
|
|
462
|
-
<td class="name"><code>
|
|
528
|
+
<td class="name"><code>msAge</code></td>
|
|
463
529
|
|
|
464
530
|
|
|
465
531
|
<td class="type">
|
|
466
532
|
|
|
467
533
|
|
|
468
|
-
<span class="param-type">
|
|
534
|
+
<span class="param-type">Number</span>
|
|
469
535
|
|
|
470
536
|
|
|
471
537
|
|
|
@@ -487,78 +553,198 @@ console.log(`listening on ${server.info.uri}`, settings)</code></pre>
|
|
|
487
553
|
|
|
488
554
|
<td class="default">
|
|
489
555
|
|
|
490
|
-
<code>
|
|
556
|
+
<code>21600000</code>
|
|
491
557
|
|
|
492
558
|
</td>
|
|
493
559
|
|
|
494
560
|
|
|
495
|
-
<td class="description last"><p
|
|
561
|
+
<td class="description last"><p>輸入視為逾時之毫秒數,預設6小時(21600000)</p></td>
|
|
496
562
|
</tr>
|
|
497
563
|
|
|
498
564
|
|
|
565
|
+
</tbody>
|
|
566
|
+
</table>
|
|
499
567
|
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
<td class="name"><code>maxMb</code></td>
|
|
503
|
-
|
|
568
|
+
</td>
|
|
569
|
+
</tr>
|
|
504
570
|
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
<span class="param-type">Number</span>
|
|
571
|
+
|
|
572
|
+
</tbody>
|
|
573
|
+
</table>
|
|
509
574
|
|
|
510
575
|
|
|
511
576
|
|
|
512
|
-
|
|
513
|
-
</td>
|
|
514
577
|
|
|
515
|
-
|
|
516
|
-
<td class="attributes">
|
|
517
|
-
|
|
518
|
-
<optional><br>
|
|
519
|
-
|
|
520
578
|
|
|
521
|
-
|
|
522
579
|
|
|
523
|
-
|
|
524
|
-
</td>
|
|
525
|
-
|
|
526
580
|
|
|
527
|
-
|
|
528
|
-
<td class="default">
|
|
529
|
-
|
|
530
|
-
<code>256</code>
|
|
531
|
-
|
|
532
|
-
</td>
|
|
533
|
-
|
|
534
581
|
|
|
535
|
-
<td class="description last"><p>輸入請求大小上限數字,單位MB,預設256</p></td>
|
|
536
|
-
</tr>
|
|
537
582
|
|
|
538
|
-
|
|
539
583
|
|
|
540
|
-
<tr>
|
|
541
|
-
|
|
542
|
-
<td class="name"><code>dirTemplates</code></td>
|
|
543
|
-
|
|
544
584
|
|
|
545
|
-
<td class="type">
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
<span class="param-type">String</span>
|
|
549
585
|
|
|
550
586
|
|
|
551
587
|
|
|
552
|
-
|
|
553
|
-
</td>
|
|
554
588
|
|
|
555
|
-
|
|
556
|
-
<td class="attributes">
|
|
557
|
-
|
|
558
|
-
<optional><br>
|
|
559
|
-
|
|
560
589
|
|
|
561
|
-
|
|
590
|
+
<h5 class="h5-returns">Returns:</h5>
|
|
591
|
+
|
|
592
|
+
|
|
593
|
+
<div class="param-desc">
|
|
594
|
+
<p>回傳刪除之作業夾數整數</p>
|
|
595
|
+
</div>
|
|
596
|
+
|
|
597
|
+
|
|
598
|
+
|
|
599
|
+
<dl class="param-type">
|
|
600
|
+
<dt>
|
|
601
|
+
Type
|
|
602
|
+
</dt>
|
|
603
|
+
<dd>
|
|
604
|
+
|
|
605
|
+
<span class="param-type">Integer</span>
|
|
606
|
+
|
|
607
|
+
|
|
608
|
+
|
|
609
|
+
</dd>
|
|
610
|
+
</dl>
|
|
611
|
+
|
|
612
|
+
|
|
613
|
+
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
|
|
620
|
+
|
|
621
|
+
<h4 class="name" id="cvMdTo"><span class="type-signature type-signature-async">(async) </span>cvMdTo<span class="signature">(opt<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise}</span></h4>
|
|
622
|
+
|
|
623
|
+
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
|
|
628
|
+
<dl class="details">
|
|
629
|
+
|
|
630
|
+
<dt class="tag-description">Description:</dt>
|
|
631
|
+
<dd class="tag-description"><ul class="dummy"><li><p>Markdown內容轉Html與Docx內容</p>
|
|
632
|
+
<p>與cvMdToDocx之差異:本函數接收Markdown「內容」與其引用之資產(圖片等),於獨立工作資料夾內還原後轉檔,完成後回傳產物之base64內容並清除工作資料夾。適用於服務端等無實體來源檔之情境;有實體md檔者請直接用cvMdToDocx。</p></li></ul></dd>
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
|
|
636
|
+
<dt class="tag-source">Source:</dt>
|
|
637
|
+
<dd class="tag-source"><ul class="dummy"><li>
|
|
638
|
+
<a href="cvMdTo.mjs.html">cvMdTo.mjs</a>, <a href="cvMdTo.mjs.html#line46">line 46</a>
|
|
639
|
+
</li></ul></dd>
|
|
640
|
+
|
|
641
|
+
|
|
642
|
+
|
|
643
|
+
|
|
644
|
+
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
|
|
649
|
+
|
|
650
|
+
|
|
651
|
+
|
|
652
|
+
|
|
653
|
+
|
|
654
|
+
|
|
655
|
+
|
|
656
|
+
|
|
657
|
+
|
|
658
|
+
|
|
659
|
+
|
|
660
|
+
|
|
661
|
+
|
|
662
|
+
|
|
663
|
+
|
|
664
|
+
|
|
665
|
+
|
|
666
|
+
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
|
|
670
|
+
|
|
671
|
+
</dl>
|
|
672
|
+
|
|
673
|
+
|
|
674
|
+
|
|
675
|
+
|
|
676
|
+
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
|
|
680
|
+
|
|
681
|
+
|
|
682
|
+
|
|
683
|
+
<h5 class="h5-examples">Example</h5>
|
|
684
|
+
|
|
685
|
+
<pre class="prettyprint"><code>import cvMdTo from 'w-md2docx/src/cvMdTo.mjs'
|
|
686
|
+
|
|
687
|
+
let r = await cvMdTo({
|
|
688
|
+
md: '# 標題\n\n<img src="pics/圖.png" />',
|
|
689
|
+
name: '報告R00.01',
|
|
690
|
+
out: 'docx',
|
|
691
|
+
assets: [{ path: 'pics/圖.png', base64: '…' }],
|
|
692
|
+
})
|
|
693
|
+
console.log(r)
|
|
694
|
+
// => { name: '報告R00.01', out: 'docx', ms: 8342, nAssets: 1, msDocx: 8300, docx: { fileName: '報告R00.01.docx', mime: '…', size: 39856, base64: '…' } }</code></pre>
|
|
695
|
+
|
|
696
|
+
|
|
697
|
+
|
|
698
|
+
|
|
699
|
+
<h5 class="h5-parameters">Parameters:</h5>
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
<table class="params">
|
|
703
|
+
<thead>
|
|
704
|
+
<tr>
|
|
705
|
+
|
|
706
|
+
<th>Name</th>
|
|
707
|
+
|
|
708
|
+
|
|
709
|
+
<th>Type</th>
|
|
710
|
+
|
|
711
|
+
|
|
712
|
+
<th>Attributes</th>
|
|
713
|
+
|
|
714
|
+
|
|
715
|
+
|
|
716
|
+
<th>Default</th>
|
|
717
|
+
|
|
718
|
+
|
|
719
|
+
<th class="last">Description</th>
|
|
720
|
+
</tr>
|
|
721
|
+
</thead>
|
|
722
|
+
|
|
723
|
+
<tbody>
|
|
724
|
+
|
|
725
|
+
|
|
726
|
+
<tr>
|
|
727
|
+
|
|
728
|
+
<td class="name"><code>opt</code></td>
|
|
729
|
+
|
|
730
|
+
|
|
731
|
+
<td class="type">
|
|
732
|
+
|
|
733
|
+
|
|
734
|
+
<span class="param-type">Object</span>
|
|
735
|
+
|
|
736
|
+
|
|
737
|
+
|
|
738
|
+
|
|
739
|
+
</td>
|
|
740
|
+
|
|
741
|
+
|
|
742
|
+
<td class="attributes">
|
|
743
|
+
|
|
744
|
+
<optional><br>
|
|
745
|
+
|
|
746
|
+
|
|
747
|
+
|
|
562
748
|
|
|
563
749
|
|
|
564
750
|
</td>
|
|
@@ -567,19 +753,42 @@ console.log(`listening on ${server.info.uri}`, settings)</code></pre>
|
|
|
567
753
|
|
|
568
754
|
<td class="default">
|
|
569
755
|
|
|
570
|
-
<code>
|
|
756
|
+
<code>{}</code>
|
|
571
757
|
|
|
572
758
|
</td>
|
|
573
759
|
|
|
574
760
|
|
|
575
|
-
<td class="description last"><p
|
|
576
|
-
|
|
761
|
+
<td class="description last"><p>輸入設定物件,預設{}</p>
|
|
762
|
+
<h6>Properties</h6>
|
|
763
|
+
|
|
764
|
+
|
|
765
|
+
<table class="params">
|
|
766
|
+
<thead>
|
|
767
|
+
<tr>
|
|
768
|
+
|
|
769
|
+
<th>Name</th>
|
|
770
|
+
|
|
771
|
+
|
|
772
|
+
<th>Type</th>
|
|
773
|
+
|
|
774
|
+
|
|
775
|
+
<th>Attributes</th>
|
|
776
|
+
|
|
777
|
+
|
|
778
|
+
|
|
779
|
+
<th>Default</th>
|
|
780
|
+
|
|
781
|
+
|
|
782
|
+
<th class="last">Description</th>
|
|
783
|
+
</tr>
|
|
784
|
+
</thead>
|
|
577
785
|
|
|
786
|
+
<tbody>
|
|
578
787
|
|
|
579
788
|
|
|
580
789
|
<tr>
|
|
581
790
|
|
|
582
|
-
<td class="name"><code>
|
|
791
|
+
<td class="name"><code>md</code></td>
|
|
583
792
|
|
|
584
793
|
|
|
585
794
|
<td class="type">
|
|
@@ -612,14 +821,14 @@ console.log(`listening on ${server.info.uri}`, settings)</code></pre>
|
|
|
612
821
|
</td>
|
|
613
822
|
|
|
614
823
|
|
|
615
|
-
<td class="description last"><p
|
|
824
|
+
<td class="description last"><p>輸入Markdown內容字串,與mdBase64二擇一</p></td>
|
|
616
825
|
</tr>
|
|
617
826
|
|
|
618
827
|
|
|
619
828
|
|
|
620
829
|
<tr>
|
|
621
830
|
|
|
622
|
-
<td class="name"><code>
|
|
831
|
+
<td class="name"><code>mdBase64</code></td>
|
|
623
832
|
|
|
624
833
|
|
|
625
834
|
<td class="type">
|
|
@@ -647,25 +856,25 @@ console.log(`listening on ${server.info.uri}`, settings)</code></pre>
|
|
|
647
856
|
|
|
648
857
|
<td class="default">
|
|
649
858
|
|
|
650
|
-
<code>'
|
|
859
|
+
<code>''</code>
|
|
651
860
|
|
|
652
861
|
</td>
|
|
653
862
|
|
|
654
863
|
|
|
655
|
-
<td class="description last"><p
|
|
864
|
+
<td class="description last"><p>輸入Markdown內容之base64字串,與md二擇一</p></td>
|
|
656
865
|
</tr>
|
|
657
866
|
|
|
658
867
|
|
|
659
868
|
|
|
660
869
|
<tr>
|
|
661
870
|
|
|
662
|
-
<td class="name"><code>
|
|
871
|
+
<td class="name"><code>name</code></td>
|
|
663
872
|
|
|
664
873
|
|
|
665
874
|
<td class="type">
|
|
666
875
|
|
|
667
876
|
|
|
668
|
-
<span class="param-type">
|
|
877
|
+
<span class="param-type">String</span>
|
|
669
878
|
|
|
670
879
|
|
|
671
880
|
|
|
@@ -687,286 +896,139 @@ console.log(`listening on ${server.info.uri}`, settings)</code></pre>
|
|
|
687
896
|
|
|
688
897
|
<td class="default">
|
|
689
898
|
|
|
690
|
-
<code>
|
|
899
|
+
<code>'output'</code>
|
|
691
900
|
|
|
692
901
|
</td>
|
|
693
902
|
|
|
694
903
|
|
|
695
|
-
<td class="description last"><p
|
|
904
|
+
<td class="description last"><p>輸入輸出檔名主體字串(不含副檔名),將自動移除路徑成分與非法字元,預設'output'</p></td>
|
|
696
905
|
</tr>
|
|
697
906
|
|
|
698
907
|
|
|
699
|
-
</tbody>
|
|
700
|
-
</table>
|
|
701
908
|
|
|
702
|
-
|
|
703
|
-
|
|
909
|
+
<tr>
|
|
910
|
+
|
|
911
|
+
<td class="name"><code>out</code></td>
|
|
912
|
+
|
|
704
913
|
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
914
|
+
<td class="type">
|
|
915
|
+
|
|
916
|
+
|
|
917
|
+
<span class="param-type">String</span>
|
|
708
918
|
|
|
709
919
|
|
|
710
920
|
|
|
921
|
+
|
|
922
|
+
</td>
|
|
711
923
|
|
|
924
|
+
|
|
925
|
+
<td class="attributes">
|
|
926
|
+
|
|
927
|
+
<optional><br>
|
|
928
|
+
|
|
712
929
|
|
|
930
|
+
|
|
713
931
|
|
|
932
|
+
|
|
933
|
+
</td>
|
|
934
|
+
|
|
714
935
|
|
|
936
|
+
|
|
937
|
+
<td class="default">
|
|
938
|
+
|
|
939
|
+
<code>'docx'</code>
|
|
940
|
+
|
|
941
|
+
</td>
|
|
942
|
+
|
|
715
943
|
|
|
944
|
+
<td class="description last"><p>輸入產出類型字串,可為'html'、'docx'、'both',預設'docx'</p></td>
|
|
945
|
+
</tr>
|
|
716
946
|
|
|
947
|
+
|
|
717
948
|
|
|
949
|
+
<tr>
|
|
950
|
+
|
|
951
|
+
<td class="name"><code>assets</code></td>
|
|
952
|
+
|
|
718
953
|
|
|
954
|
+
<td class="type">
|
|
955
|
+
|
|
956
|
+
|
|
957
|
+
<span class="param-type">Array</span>
|
|
719
958
|
|
|
720
959
|
|
|
721
960
|
|
|
961
|
+
|
|
962
|
+
</td>
|
|
722
963
|
|
|
964
|
+
|
|
965
|
+
<td class="attributes">
|
|
966
|
+
|
|
967
|
+
<optional><br>
|
|
968
|
+
|
|
723
969
|
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
<div class="param-desc">
|
|
728
|
-
<p>回傳Promise,resolve回傳{server,settings,getState,stop},其中server為hapi實例,getState為取環境狀態之async函數,stop為停止服務之async函數,reject回傳錯誤訊息</p>
|
|
729
|
-
</div>
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
<dl class="param-type">
|
|
734
|
-
<dt>
|
|
735
|
-
Type
|
|
736
|
-
</dt>
|
|
737
|
-
<dd>
|
|
738
|
-
|
|
739
|
-
<span class="param-type">Promise</span>
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
</dd>
|
|
744
|
-
</dl>
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
970
|
+
|
|
749
971
|
|
|
750
|
-
|
|
972
|
+
|
|
973
|
+
</td>
|
|
751
974
|
|
|
752
975
|
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
<dl class="details">
|
|
763
|
-
|
|
764
|
-
<dt class="tag-description">Description:</dt>
|
|
765
|
-
<dd class="tag-description"><ul class="dummy"><li><p>檢查本機是否具備docx轉檔條件(Windows且轉檔器存在)</p>
|
|
766
|
-
<p>注意:僅代表環境條件成立,不代表Word確實可被調用;後者須實際轉一份小檔驗證。</p></li></ul></dd>
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
<dt class="tag-source">Source:</dt>
|
|
771
|
-
<dd class="tag-source"><ul class="dummy"><li>
|
|
772
|
-
<a href="utils.mjs.html">utils.mjs</a>, <a href="utils.mjs.html#line205">line 205</a>
|
|
773
|
-
</li></ul></dd>
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
</dl>
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
<h5 class="h5-examples">Example</h5>
|
|
818
|
-
|
|
819
|
-
<pre class="prettyprint"><code>console.log(checkDocxReady())
|
|
820
|
-
// => { platform: 'win32', isWindows: true, cwd: '...', exePath: '...', exeFound: true, ready: true }</code></pre>
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
<h5 class="h5-returns">Returns:</h5>
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
<div class="param-desc">
|
|
843
|
-
<p>回傳狀態物件{platform,isWindows,cwd,exePath,exeFound,ready}</p>
|
|
844
|
-
</div>
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
<dl class="param-type">
|
|
849
|
-
<dt>
|
|
850
|
-
Type
|
|
851
|
-
</dt>
|
|
852
|
-
<dd>
|
|
853
|
-
|
|
854
|
-
<span class="param-type">Object</span>
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
</dd>
|
|
859
|
-
</dl>
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
976
|
+
|
|
977
|
+
<td class="default">
|
|
978
|
+
|
|
979
|
+
<code>[]</code>
|
|
980
|
+
|
|
981
|
+
</td>
|
|
866
982
|
|
|
867
983
|
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
<h4 class="name" id="cleanWorkDir"><span class="type-signature"></span>cleanWorkDir<span class="signature">(dirWork, opt<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Integer}</span></h4>
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
<dl class="details">
|
|
878
|
-
|
|
879
|
-
<dt class="tag-description">Description:</dt>
|
|
880
|
-
<dd class="tag-description"><ul class="dummy"><li><p>清除工作資料夾內逾時未刪之作業夾(前綴job_)</p>
|
|
881
|
-
<p>工作資料夾不存在時自動建立。</p></li></ul></dd>
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
<dt class="tag-source">Source:</dt>
|
|
886
|
-
<dd class="tag-source"><ul class="dummy"><li>
|
|
887
|
-
<a href="utils.mjs.html">utils.mjs</a>, <a href="utils.mjs.html#line369">line 369</a>
|
|
888
|
-
</li></ul></dd>
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
984
|
+
<td class="description last"><p>輸入md內引用之相對路徑資產陣列,格式[{path,base64}],預設[]</p></td>
|
|
985
|
+
</tr>
|
|
918
986
|
|
|
919
987
|
|
|
920
|
-
</dl>
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
988
|
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
989
|
+
<tr>
|
|
990
|
+
|
|
991
|
+
<td class="name"><code>dirWork</code></td>
|
|
992
|
+
|
|
936
993
|
|
|
994
|
+
<td class="type">
|
|
995
|
+
|
|
996
|
+
|
|
997
|
+
<span class="param-type">String</span>
|
|
937
998
|
|
|
938
999
|
|
|
939
1000
|
|
|
940
|
-
|
|
941
|
-
|
|
1001
|
+
|
|
1002
|
+
</td>
|
|
942
1003
|
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
1004
|
+
|
|
1005
|
+
<td class="attributes">
|
|
1006
|
+
|
|
1007
|
+
<optional><br>
|
|
1008
|
+
|
|
949
1009
|
|
|
950
|
-
|
|
1010
|
+
|
|
951
1011
|
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
1012
|
+
|
|
1013
|
+
</td>
|
|
1014
|
+
|
|
955
1015
|
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
1016
|
+
|
|
1017
|
+
<td class="default">
|
|
1018
|
+
|
|
1019
|
+
<code>''</code>
|
|
1020
|
+
|
|
1021
|
+
</td>
|
|
1022
|
+
|
|
959
1023
|
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
</thead>
|
|
1024
|
+
<td class="description last"><p>輸入工作資料夾根位置字串,未給則用系統暫存夾下之w-md2docx,預設''</p></td>
|
|
1025
|
+
</tr>
|
|
963
1026
|
|
|
964
|
-
<tbody>
|
|
965
1027
|
|
|
966
1028
|
|
|
967
1029
|
<tr>
|
|
968
1030
|
|
|
969
|
-
<td class="name"><code>
|
|
1031
|
+
<td class="name"><code>fpInTemp</code></td>
|
|
970
1032
|
|
|
971
1033
|
|
|
972
1034
|
<td class="type">
|
|
@@ -982,6 +1044,8 @@ console.log(`listening on ${server.info.uri}`, settings)</code></pre>
|
|
|
982
1044
|
|
|
983
1045
|
<td class="attributes">
|
|
984
1046
|
|
|
1047
|
+
<optional><br>
|
|
1048
|
+
|
|
985
1049
|
|
|
986
1050
|
|
|
987
1051
|
|
|
@@ -992,17 +1056,19 @@ console.log(`listening on ${server.info.uri}`, settings)</code></pre>
|
|
|
992
1056
|
|
|
993
1057
|
<td class="default">
|
|
994
1058
|
|
|
1059
|
+
<code>''</code>
|
|
1060
|
+
|
|
995
1061
|
</td>
|
|
996
1062
|
|
|
997
1063
|
|
|
998
|
-
<td class="description last"><p
|
|
1064
|
+
<td class="description last"><p>輸入Docx模板檔位置字串,未給則由w-html2docx使用其內建模板,預設''</p></td>
|
|
999
1065
|
</tr>
|
|
1000
1066
|
|
|
1001
1067
|
|
|
1002
1068
|
|
|
1003
1069
|
<tr>
|
|
1004
1070
|
|
|
1005
|
-
<td class="name"><code>
|
|
1071
|
+
<td class="name"><code>optMd2html</code></td>
|
|
1006
1072
|
|
|
1007
1073
|
|
|
1008
1074
|
<td class="type">
|
|
@@ -1035,43 +1101,60 @@ console.log(`listening on ${server.info.uri}`, settings)</code></pre>
|
|
|
1035
1101
|
</td>
|
|
1036
1102
|
|
|
1037
1103
|
|
|
1038
|
-
<td class="description last"><p
|
|
1039
|
-
|
|
1104
|
+
<td class="description last"><p>輸入傳予w-md2html之設定物件,預設{}</p></td>
|
|
1105
|
+
</tr>
|
|
1106
|
+
|
|
1107
|
+
|
|
1108
|
+
|
|
1109
|
+
<tr>
|
|
1110
|
+
|
|
1111
|
+
<td class="name"><code>optHtml2docx</code></td>
|
|
1112
|
+
|
|
1113
|
+
|
|
1114
|
+
<td class="type">
|
|
1115
|
+
|
|
1040
1116
|
|
|
1117
|
+
<span class="param-type">Object</span>
|
|
1041
1118
|
|
|
1042
|
-
<table class="params">
|
|
1043
|
-
<thead>
|
|
1044
|
-
<tr>
|
|
1045
|
-
|
|
1046
|
-
<th>Name</th>
|
|
1047
|
-
|
|
1048
1119
|
|
|
1049
|
-
<th>Type</th>
|
|
1050
1120
|
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1121
|
+
|
|
1122
|
+
</td>
|
|
1123
|
+
|
|
1124
|
+
|
|
1125
|
+
<td class="attributes">
|
|
1126
|
+
|
|
1127
|
+
<optional><br>
|
|
1128
|
+
|
|
1129
|
+
|
|
1130
|
+
|
|
1054
1131
|
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1132
|
+
|
|
1133
|
+
</td>
|
|
1134
|
+
|
|
1058
1135
|
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1136
|
+
|
|
1137
|
+
<td class="default">
|
|
1138
|
+
|
|
1139
|
+
<code>{}</code>
|
|
1140
|
+
|
|
1141
|
+
</td>
|
|
1142
|
+
|
|
1143
|
+
|
|
1144
|
+
<td class="description last"><p>輸入傳予w-html2docx之設定物件,預設{}</p></td>
|
|
1145
|
+
</tr>
|
|
1062
1146
|
|
|
1063
|
-
<tbody>
|
|
1064
1147
|
|
|
1065
1148
|
|
|
1066
1149
|
<tr>
|
|
1067
1150
|
|
|
1068
|
-
<td class="name"><code>
|
|
1151
|
+
<td class="name"><code>keepWork</code></td>
|
|
1069
1152
|
|
|
1070
1153
|
|
|
1071
1154
|
<td class="type">
|
|
1072
1155
|
|
|
1073
1156
|
|
|
1074
|
-
<span class="param-type">
|
|
1157
|
+
<span class="param-type">Boolean</span>
|
|
1075
1158
|
|
|
1076
1159
|
|
|
1077
1160
|
|
|
@@ -1093,12 +1176,12 @@ console.log(`listening on ${server.info.uri}`, settings)</code></pre>
|
|
|
1093
1176
|
|
|
1094
1177
|
<td class="default">
|
|
1095
1178
|
|
|
1096
|
-
<code>
|
|
1179
|
+
<code>false</code>
|
|
1097
1180
|
|
|
1098
1181
|
</td>
|
|
1099
1182
|
|
|
1100
1183
|
|
|
1101
|
-
<td class="description last"><p
|
|
1184
|
+
<td class="description last"><p>輸入是否保留工作資料夾供除錯布林值,預設false</p></td>
|
|
1102
1185
|
</tr>
|
|
1103
1186
|
|
|
1104
1187
|
|
|
@@ -1131,7 +1214,7 @@ console.log(`listening on ${server.info.uri}`, settings)</code></pre>
|
|
|
1131
1214
|
|
|
1132
1215
|
|
|
1133
1216
|
<div class="param-desc">
|
|
1134
|
-
<p
|
|
1217
|
+
<p>回傳Promise,resolve回傳結果物件{name,out,ms,nAssets,[msDocx],[html],[docx]},其中html與docx為{fileName,mime,size,base64},reject回傳錯誤訊息</p>
|
|
1135
1218
|
</div>
|
|
1136
1219
|
|
|
1137
1220
|
|
|
@@ -1142,7 +1225,7 @@ console.log(`listening on ${server.info.uri}`, settings)</code></pre>
|
|
|
1142
1225
|
</dt>
|
|
1143
1226
|
<dd>
|
|
1144
1227
|
|
|
1145
|
-
<span class="param-type">
|
|
1228
|
+
<span class="param-type">Promise</span>
|
|
1146
1229
|
|
|
1147
1230
|
|
|
1148
1231
|
|
|
@@ -1169,13 +1252,13 @@ console.log(`listening on ${server.info.uri}`, settings)</code></pre>
|
|
|
1169
1252
|
|
|
1170
1253
|
<dt class="tag-description">Description:</dt>
|
|
1171
1254
|
<dd class="tag-description"><ul class="dummy"><li><p>將本機Markdown檔送至轉檔服務,取回並寫出Html與(或)Docx</p>
|
|
1172
|
-
<p>供無Microsoft Word之機器產製docx:讀取本機md與其引用之圖片,送至
|
|
1255
|
+
<p>供無Microsoft Word之機器產製docx:讀取本機md與其引用之圖片,送至rmApiServer轉檔後寫回本機。連線層失敗會自動重試;逾時與HTTP錯誤不重試。</p></li></ul></dd>
|
|
1173
1256
|
|
|
1174
1257
|
|
|
1175
1258
|
|
|
1176
1259
|
<dt class="tag-source">Source:</dt>
|
|
1177
1260
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
1178
|
-
<a href="
|
|
1261
|
+
<a href="rmApiClient.mjs.html">rmApiClient.mjs</a>, <a href="rmApiClient.mjs.html#line216">line 216</a>
|
|
1179
1262
|
</li></ul></dd>
|
|
1180
1263
|
|
|
1181
1264
|
|
|
@@ -1222,7 +1305,7 @@ console.log(`listening on ${server.info.uri}`, settings)</code></pre>
|
|
|
1222
1305
|
|
|
1223
1306
|
<h5 class="h5-examples">Example</h5>
|
|
1224
1307
|
|
|
1225
|
-
<pre class="prettyprint"><code>import { cvMdTo } from 'w-md2docx/src/
|
|
1308
|
+
<pre class="prettyprint"><code>import { cvMdTo } from 'w-md2docx/src/rmApiClient.mjs'
|
|
1226
1309
|
|
|
1227
1310
|
let r = await cvMdTo({
|
|
1228
1311
|
host: '127.0.0.1',
|
|
@@ -1973,7 +2056,7 @@ console.log(r)
|
|
|
1973
2056
|
|
|
1974
2057
|
|
|
1975
2058
|
|
|
1976
|
-
<h4 class="name" id="
|
|
2059
|
+
<h4 class="name" id="cvMdToDocx"><span class="type-signature type-signature-async">(async) </span>cvMdToDocx<span class="signature">(fpInMd, fpOutDocx, opt<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise}</span></h4>
|
|
1977
2060
|
|
|
1978
2061
|
|
|
1979
2062
|
|
|
@@ -1983,14 +2066,15 @@ console.log(r)
|
|
|
1983
2066
|
<dl class="details">
|
|
1984
2067
|
|
|
1985
2068
|
<dt class="tag-description">Description:</dt>
|
|
1986
|
-
<dd class="tag-description"><ul class="dummy"><li><p>Markdown
|
|
1987
|
-
<p
|
|
2069
|
+
<dd class="tag-description"><ul class="dummy"><li><p>Markdown檔轉Docx檔</p>
|
|
2070
|
+
<p>內部流程為md -> html -> docx。docx階段係調用本機Microsoft Word(win32com),故僅能於已安裝Word之Windows執行,且同時間僅一份轉檔作業(內部佇列自動排隊)。</p>
|
|
2071
|
+
<p>注意:底層w-html2docx於Word未安裝或COM呼叫失敗時「仍回傳ok」,本函數一律以產物實體檔之存在與大小驗證成敗,失敗即reject,不會回報假成功。</p></li></ul></dd>
|
|
1988
2072
|
|
|
1989
2073
|
|
|
1990
2074
|
|
|
1991
2075
|
<dt class="tag-source">Source:</dt>
|
|
1992
2076
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
1993
|
-
<a href="
|
|
2077
|
+
<a href="cvMdToDocx.mjs.html">cvMdToDocx.mjs</a>, <a href="cvMdToDocx.mjs.html#line42">line 42</a>
|
|
1994
2078
|
</li></ul></dd>
|
|
1995
2079
|
|
|
1996
2080
|
|
|
@@ -2037,16 +2121,16 @@ console.log(r)
|
|
|
2037
2121
|
|
|
2038
2122
|
<h5 class="h5-examples">Example</h5>
|
|
2039
2123
|
|
|
2040
|
-
<pre class="prettyprint"><code>import
|
|
2124
|
+
<pre class="prettyprint"><code>import cvMdToDocx from 'w-md2docx/src/cvMdToDocx.mjs'
|
|
2041
2125
|
|
|
2042
|
-
let r = await
|
|
2043
|
-
|
|
2044
|
-
|
|
2045
|
-
|
|
2046
|
-
|
|
2126
|
+
let r = await cvMdToDocx('./test/report.md', './test/report.docx', {
|
|
2127
|
+
fpInTemp: './src/templates/temp_tpc.docx',
|
|
2128
|
+
optMd2html: {
|
|
2129
|
+
imgWidthMax: '500px',
|
|
2130
|
+
},
|
|
2047
2131
|
})
|
|
2048
2132
|
console.log(r)
|
|
2049
|
-
// => {
|
|
2133
|
+
// => { fpOutDocx: '…', sizeDocx: 39856, sizeHtml: 12345, ms: 8342 }</code></pre>
|
|
2050
2134
|
|
|
2051
2135
|
|
|
2052
2136
|
|
|
@@ -2078,6 +2162,78 @@ console.log(r)
|
|
|
2078
2162
|
<tbody>
|
|
2079
2163
|
|
|
2080
2164
|
|
|
2165
|
+
<tr>
|
|
2166
|
+
|
|
2167
|
+
<td class="name"><code>fpInMd</code></td>
|
|
2168
|
+
|
|
2169
|
+
|
|
2170
|
+
<td class="type">
|
|
2171
|
+
|
|
2172
|
+
|
|
2173
|
+
<span class="param-type">String</span>
|
|
2174
|
+
|
|
2175
|
+
|
|
2176
|
+
|
|
2177
|
+
|
|
2178
|
+
</td>
|
|
2179
|
+
|
|
2180
|
+
|
|
2181
|
+
<td class="attributes">
|
|
2182
|
+
|
|
2183
|
+
|
|
2184
|
+
|
|
2185
|
+
|
|
2186
|
+
|
|
2187
|
+
</td>
|
|
2188
|
+
|
|
2189
|
+
|
|
2190
|
+
|
|
2191
|
+
<td class="default">
|
|
2192
|
+
|
|
2193
|
+
</td>
|
|
2194
|
+
|
|
2195
|
+
|
|
2196
|
+
<td class="description last"><p>輸入來源Markdown檔位置字串</p></td>
|
|
2197
|
+
</tr>
|
|
2198
|
+
|
|
2199
|
+
|
|
2200
|
+
|
|
2201
|
+
<tr>
|
|
2202
|
+
|
|
2203
|
+
<td class="name"><code>fpOutDocx</code></td>
|
|
2204
|
+
|
|
2205
|
+
|
|
2206
|
+
<td class="type">
|
|
2207
|
+
|
|
2208
|
+
|
|
2209
|
+
<span class="param-type">String</span>
|
|
2210
|
+
|
|
2211
|
+
|
|
2212
|
+
|
|
2213
|
+
|
|
2214
|
+
</td>
|
|
2215
|
+
|
|
2216
|
+
|
|
2217
|
+
<td class="attributes">
|
|
2218
|
+
|
|
2219
|
+
|
|
2220
|
+
|
|
2221
|
+
|
|
2222
|
+
|
|
2223
|
+
</td>
|
|
2224
|
+
|
|
2225
|
+
|
|
2226
|
+
|
|
2227
|
+
<td class="default">
|
|
2228
|
+
|
|
2229
|
+
</td>
|
|
2230
|
+
|
|
2231
|
+
|
|
2232
|
+
<td class="description last"><p>輸入轉出Docx檔位置字串</p></td>
|
|
2233
|
+
</tr>
|
|
2234
|
+
|
|
2235
|
+
|
|
2236
|
+
|
|
2081
2237
|
<tr>
|
|
2082
2238
|
|
|
2083
2239
|
<td class="name"><code>opt</code></td>
|
|
@@ -2143,7 +2299,7 @@ console.log(r)
|
|
|
2143
2299
|
|
|
2144
2300
|
<tr>
|
|
2145
2301
|
|
|
2146
|
-
<td class="name"><code>
|
|
2302
|
+
<td class="name"><code>fpInTemp</code></td>
|
|
2147
2303
|
|
|
2148
2304
|
|
|
2149
2305
|
<td class="type">
|
|
@@ -2176,14 +2332,14 @@ console.log(r)
|
|
|
2176
2332
|
</td>
|
|
2177
2333
|
|
|
2178
2334
|
|
|
2179
|
-
<td class="description last"><p>輸入
|
|
2335
|
+
<td class="description last"><p>輸入Docx模板檔位置字串,未給則由w-html2docx使用其內建模板,預設''</p></td>
|
|
2180
2336
|
</tr>
|
|
2181
2337
|
|
|
2182
2338
|
|
|
2183
2339
|
|
|
2184
2340
|
<tr>
|
|
2185
2341
|
|
|
2186
|
-
<td class="name"><code>
|
|
2342
|
+
<td class="name"><code>fpOutHtml</code></td>
|
|
2187
2343
|
|
|
2188
2344
|
|
|
2189
2345
|
<td class="type">
|
|
@@ -2216,20 +2372,20 @@ console.log(r)
|
|
|
2216
2372
|
</td>
|
|
2217
2373
|
|
|
2218
2374
|
|
|
2219
|
-
<td class="description last"><p
|
|
2375
|
+
<td class="description last"><p>輸入另存中介Html檔位置字串,未給則中介檔產於系統暫存夾並於轉檔後刪除,預設''</p></td>
|
|
2220
2376
|
</tr>
|
|
2221
2377
|
|
|
2222
2378
|
|
|
2223
2379
|
|
|
2224
2380
|
<tr>
|
|
2225
2381
|
|
|
2226
|
-
<td class="name"><code>
|
|
2382
|
+
<td class="name"><code>optMd2html</code></td>
|
|
2227
2383
|
|
|
2228
2384
|
|
|
2229
2385
|
<td class="type">
|
|
2230
2386
|
|
|
2231
2387
|
|
|
2232
|
-
<span class="param-type">
|
|
2388
|
+
<span class="param-type">Object</span>
|
|
2233
2389
|
|
|
2234
2390
|
|
|
2235
2391
|
|
|
@@ -2251,25 +2407,25 @@ console.log(r)
|
|
|
2251
2407
|
|
|
2252
2408
|
<td class="default">
|
|
2253
2409
|
|
|
2254
|
-
<code>
|
|
2410
|
+
<code>{}</code>
|
|
2255
2411
|
|
|
2256
2412
|
</td>
|
|
2257
2413
|
|
|
2258
2414
|
|
|
2259
|
-
<td class="description last"><p
|
|
2415
|
+
<td class="description last"><p>輸入傳予w-md2html之設定物件(如imgWidthMax、fontSizeScale等),預設{}</p></td>
|
|
2260
2416
|
</tr>
|
|
2261
2417
|
|
|
2262
2418
|
|
|
2263
2419
|
|
|
2264
2420
|
<tr>
|
|
2265
2421
|
|
|
2266
|
-
<td class="name"><code>
|
|
2422
|
+
<td class="name"><code>optHtml2docx</code></td>
|
|
2267
2423
|
|
|
2268
2424
|
|
|
2269
2425
|
<td class="type">
|
|
2270
2426
|
|
|
2271
2427
|
|
|
2272
|
-
<span class="param-type">
|
|
2428
|
+
<span class="param-type">Object</span>
|
|
2273
2429
|
|
|
2274
2430
|
|
|
2275
2431
|
|
|
@@ -2291,264 +2447,253 @@ console.log(r)
|
|
|
2291
2447
|
|
|
2292
2448
|
<td class="default">
|
|
2293
2449
|
|
|
2294
|
-
<code>
|
|
2450
|
+
<code>{}</code>
|
|
2295
2451
|
|
|
2296
2452
|
</td>
|
|
2297
2453
|
|
|
2298
2454
|
|
|
2299
|
-
<td class="description last"><p
|
|
2455
|
+
<td class="description last"><p>輸入傳予w-html2docx之設定物件(如imgRatioWidthMax、fontFamilies等),預設{}</p></td>
|
|
2300
2456
|
</tr>
|
|
2457
|
+
|
|
2458
|
+
|
|
2459
|
+
</tbody>
|
|
2460
|
+
</table>
|
|
2461
|
+
|
|
2462
|
+
</td>
|
|
2463
|
+
</tr>
|
|
2464
|
+
|
|
2465
|
+
|
|
2466
|
+
</tbody>
|
|
2467
|
+
</table>
|
|
2468
|
+
|
|
2469
|
+
|
|
2470
|
+
|
|
2471
|
+
|
|
2472
|
+
|
|
2473
|
+
|
|
2474
|
+
|
|
2475
|
+
|
|
2476
|
+
|
|
2477
|
+
|
|
2478
|
+
|
|
2479
|
+
|
|
2480
|
+
|
|
2481
|
+
|
|
2482
|
+
|
|
2483
|
+
|
|
2484
|
+
<h5 class="h5-returns">Returns:</h5>
|
|
2485
|
+
|
|
2486
|
+
|
|
2487
|
+
<div class="param-desc">
|
|
2488
|
+
<p>回傳Promise,resolve回傳結果物件{fpOutDocx,sizeDocx,sizeHtml,ms,[fpOutHtml]},reject回傳錯誤訊息</p>
|
|
2489
|
+
</div>
|
|
2490
|
+
|
|
2491
|
+
|
|
2492
|
+
|
|
2493
|
+
<dl class="param-type">
|
|
2494
|
+
<dt>
|
|
2495
|
+
Type
|
|
2496
|
+
</dt>
|
|
2497
|
+
<dd>
|
|
2498
|
+
|
|
2499
|
+
<span class="param-type">Promise</span>
|
|
2500
|
+
|
|
2501
|
+
|
|
2502
|
+
|
|
2503
|
+
</dd>
|
|
2504
|
+
</dl>
|
|
2505
|
+
|
|
2506
|
+
|
|
2507
|
+
|
|
2508
|
+
|
|
2509
|
+
|
|
2510
|
+
|
|
2511
|
+
|
|
2512
|
+
|
|
2513
|
+
|
|
2514
|
+
|
|
2515
|
+
<h4 class="name" id="getFpExe"><span class="type-signature"></span>getFpExe<span class="signature">()</span><span class="type-signature"> → {String}</span></h4>
|
|
2516
|
+
|
|
2517
|
+
|
|
2518
|
+
|
|
2519
|
+
|
|
2520
|
+
|
|
2521
|
+
|
|
2522
|
+
<dl class="details">
|
|
2523
|
+
|
|
2524
|
+
<dt class="tag-description">Description:</dt>
|
|
2525
|
+
<dd class="tag-description"><ul class="dummy"><li><p>取w-html2docx之htmlToDocx.exe位置</p>
|
|
2526
|
+
<p>注意:w-html2docx內部以「模組載入當下之工作目錄(cwd)」推導exe位置,故此處以同一規則檢查,使事前檢查與實際轉檔行為一致;查無即代表由此cwd執行必定轉檔失敗。</p></li></ul></dd>
|
|
2527
|
+
|
|
2528
|
+
|
|
2529
|
+
|
|
2530
|
+
<dt class="tag-source">Source:</dt>
|
|
2531
|
+
<dd class="tag-source"><ul class="dummy"><li>
|
|
2532
|
+
<a href="utils.mjs.html">utils.mjs</a>, <a href="utils.mjs.html#line178">line 178</a>
|
|
2533
|
+
</li></ul></dd>
|
|
2534
|
+
|
|
2535
|
+
|
|
2536
|
+
|
|
2537
|
+
|
|
2538
|
+
|
|
2539
|
+
|
|
2540
|
+
|
|
2541
|
+
|
|
2542
|
+
|
|
2543
|
+
|
|
2544
|
+
|
|
2545
|
+
|
|
2546
|
+
|
|
2547
|
+
|
|
2548
|
+
|
|
2549
|
+
|
|
2550
|
+
|
|
2551
|
+
|
|
2552
|
+
|
|
2553
|
+
|
|
2554
|
+
|
|
2555
|
+
|
|
2556
|
+
|
|
2557
|
+
|
|
2558
|
+
|
|
2559
|
+
|
|
2560
|
+
|
|
2301
2561
|
|
|
2302
2562
|
|
|
2303
2563
|
|
|
2304
|
-
|
|
2305
|
-
|
|
2306
|
-
<td class="name"><code>assets</code></td>
|
|
2307
|
-
|
|
2564
|
+
|
|
2565
|
+
</dl>
|
|
2308
2566
|
|
|
2309
|
-
<td class="type">
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
<span class="param-type">Array</span>
|
|
2313
2567
|
|
|
2314
2568
|
|
|
2315
2569
|
|
|
2316
|
-
|
|
2317
|
-
</td>
|
|
2318
2570
|
|
|
2319
|
-
|
|
2320
|
-
<td class="attributes">
|
|
2321
|
-
|
|
2322
|
-
<optional><br>
|
|
2323
|
-
|
|
2324
2571
|
|
|
2325
|
-
|
|
2326
2572
|
|
|
2327
|
-
|
|
2328
|
-
</td>
|
|
2329
|
-
|
|
2330
2573
|
|
|
2331
|
-
|
|
2332
|
-
<td class="default">
|
|
2333
|
-
|
|
2334
|
-
<code>[]</code>
|
|
2335
|
-
|
|
2336
|
-
</td>
|
|
2337
|
-
|
|
2338
2574
|
|
|
2339
|
-
<td class="description last"><p>輸入md內引用之相對路徑資產陣列,格式[{path,base64}],預設[]</p></td>
|
|
2340
|
-
</tr>
|
|
2341
2575
|
|
|
2576
|
+
|
|
2577
|
+
<h5 class="h5-examples">Example</h5>
|
|
2342
2578
|
|
|
2579
|
+
<pre class="prettyprint"><code>console.log(getFpExe())
|
|
2580
|
+
// => 'C:\\proj\\node_modules\\w-html2docx\\src\\htmlToDocx.exe'</code></pre>
|
|
2343
2581
|
|
|
2344
|
-
<tr>
|
|
2345
|
-
|
|
2346
|
-
<td class="name"><code>dirWork</code></td>
|
|
2347
|
-
|
|
2348
2582
|
|
|
2349
|
-
<td class="type">
|
|
2350
|
-
|
|
2351
|
-
|
|
2352
|
-
<span class="param-type">String</span>
|
|
2353
2583
|
|
|
2354
2584
|
|
|
2355
2585
|
|
|
2356
|
-
|
|
2357
|
-
</td>
|
|
2358
2586
|
|
|
2359
|
-
|
|
2360
|
-
<td class="attributes">
|
|
2361
|
-
|
|
2362
|
-
<optional><br>
|
|
2363
|
-
|
|
2364
2587
|
|
|
2365
|
-
|
|
2366
2588
|
|
|
2367
|
-
|
|
2368
|
-
</td>
|
|
2369
|
-
|
|
2370
2589
|
|
|
2371
|
-
|
|
2372
|
-
<td class="default">
|
|
2373
|
-
|
|
2374
|
-
<code>''</code>
|
|
2375
|
-
|
|
2376
|
-
</td>
|
|
2377
|
-
|
|
2378
2590
|
|
|
2379
|
-
<td class="description last"><p>輸入工作資料夾根位置字串,未給則用系統暫存夾下之w-md2docx,預設''</p></td>
|
|
2380
|
-
</tr>
|
|
2381
2591
|
|
|
2382
|
-
|
|
2383
2592
|
|
|
2384
|
-
<tr>
|
|
2385
|
-
|
|
2386
|
-
<td class="name"><code>fpInTemp</code></td>
|
|
2387
|
-
|
|
2388
2593
|
|
|
2389
|
-
<td class="type">
|
|
2390
|
-
|
|
2391
|
-
|
|
2392
|
-
<span class="param-type">String</span>
|
|
2393
2594
|
|
|
2394
2595
|
|
|
2395
2596
|
|
|
2396
|
-
|
|
2397
|
-
</td>
|
|
2398
2597
|
|
|
2399
|
-
|
|
2400
|
-
<td class="attributes">
|
|
2401
|
-
|
|
2402
|
-
<optional><br>
|
|
2403
|
-
|
|
2404
2598
|
|
|
2405
|
-
|
|
2599
|
+
<h5 class="h5-returns">Returns:</h5>
|
|
2406
2600
|
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2601
|
+
|
|
2602
|
+
<div class="param-desc">
|
|
2603
|
+
<p>回傳exe位置字串,查無則回傳空字串</p>
|
|
2604
|
+
</div>
|
|
2410
2605
|
|
|
2411
|
-
|
|
2412
|
-
<td class="default">
|
|
2413
|
-
|
|
2414
|
-
<code>''</code>
|
|
2415
|
-
|
|
2416
|
-
</td>
|
|
2417
|
-
|
|
2418
2606
|
|
|
2419
|
-
|
|
2420
|
-
|
|
2607
|
+
|
|
2608
|
+
<dl class="param-type">
|
|
2609
|
+
<dt>
|
|
2610
|
+
Type
|
|
2611
|
+
</dt>
|
|
2612
|
+
<dd>
|
|
2613
|
+
|
|
2614
|
+
<span class="param-type">String</span>
|
|
2615
|
+
|
|
2616
|
+
|
|
2617
|
+
|
|
2618
|
+
</dd>
|
|
2619
|
+
</dl>
|
|
2421
2620
|
|
|
2422
2621
|
|
|
2423
2622
|
|
|
2424
|
-
<tr>
|
|
2425
|
-
|
|
2426
|
-
<td class="name"><code>optMd2html</code></td>
|
|
2427
|
-
|
|
2428
2623
|
|
|
2429
|
-
|
|
2624
|
+
|
|
2625
|
+
|
|
2430
2626
|
|
|
2431
|
-
|
|
2432
|
-
<span class="param-type">Object</span>
|
|
2433
2627
|
|
|
2628
|
+
|
|
2434
2629
|
|
|
2630
|
+
<h4 class="name" id="getQueueSize"><span class="type-signature"></span>getQueueSize<span class="signature">()</span><span class="type-signature"> → {Integer}</span></h4>
|
|
2435
2631
|
|
|
2436
|
-
|
|
2437
|
-
</td>
|
|
2632
|
+
|
|
2438
2633
|
|
|
2439
|
-
|
|
2440
|
-
<td class="attributes">
|
|
2441
|
-
|
|
2442
|
-
<optional><br>
|
|
2443
|
-
|
|
2444
2634
|
|
|
2445
|
-
|
|
2446
2635
|
|
|
2447
|
-
|
|
2448
|
-
</td>
|
|
2449
|
-
|
|
2450
2636
|
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
</td>
|
|
2457
|
-
|
|
2637
|
+
<dl class="details">
|
|
2638
|
+
|
|
2639
|
+
<dt class="tag-description">Description:</dt>
|
|
2640
|
+
<dd class="tag-description"><ul class="dummy"><li><p>取當前排隊中(含執行中)之docx轉檔數</p></li></ul></dd>
|
|
2641
|
+
|
|
2458
2642
|
|
|
2459
|
-
|
|
2460
|
-
|
|
2643
|
+
|
|
2644
|
+
<dt class="tag-source">Source:</dt>
|
|
2645
|
+
<dd class="tag-source"><ul class="dummy"><li>
|
|
2646
|
+
<a href="utils.mjs.html">utils.mjs</a>, <a href="utils.mjs.html#line161">line 161</a>
|
|
2647
|
+
</li></ul></dd>
|
|
2648
|
+
|
|
2461
2649
|
|
|
2462
2650
|
|
|
2463
2651
|
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
<td class="name"><code>optHtml2docx</code></td>
|
|
2467
|
-
|
|
2652
|
+
|
|
2468
2653
|
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
<span class="param-type">Object</span>
|
|
2654
|
+
|
|
2473
2655
|
|
|
2656
|
+
|
|
2474
2657
|
|
|
2658
|
+
|
|
2475
2659
|
|
|
2476
|
-
|
|
2477
|
-
</td>
|
|
2660
|
+
|
|
2478
2661
|
|
|
2479
|
-
|
|
2480
|
-
<td class="attributes">
|
|
2481
|
-
|
|
2482
|
-
<optional><br>
|
|
2483
|
-
|
|
2662
|
+
|
|
2484
2663
|
|
|
2485
|
-
|
|
2664
|
+
|
|
2486
2665
|
|
|
2487
|
-
|
|
2488
|
-
</td>
|
|
2489
|
-
|
|
2666
|
+
|
|
2490
2667
|
|
|
2491
|
-
|
|
2492
|
-
<td class="default">
|
|
2493
|
-
|
|
2494
|
-
<code>{}</code>
|
|
2495
|
-
|
|
2496
|
-
</td>
|
|
2497
|
-
|
|
2668
|
+
|
|
2498
2669
|
|
|
2499
|
-
|
|
2500
|
-
</tr>
|
|
2670
|
+
|
|
2501
2671
|
|
|
2502
2672
|
|
|
2503
2673
|
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
<td class="name"><code>keepWork</code></td>
|
|
2507
|
-
|
|
2674
|
+
|
|
2508
2675
|
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2676
|
+
|
|
2677
|
+
|
|
2678
|
+
|
|
2679
|
+
</dl>
|
|
2513
2680
|
|
|
2514
2681
|
|
|
2515
2682
|
|
|
2516
|
-
|
|
2517
|
-
</td>
|
|
2518
2683
|
|
|
2519
|
-
|
|
2520
|
-
<td class="attributes">
|
|
2521
|
-
|
|
2522
|
-
<optional><br>
|
|
2523
|
-
|
|
2524
2684
|
|
|
2525
|
-
|
|
2526
2685
|
|
|
2527
|
-
|
|
2528
|
-
</td>
|
|
2529
|
-
|
|
2530
2686
|
|
|
2531
|
-
|
|
2532
|
-
<td class="default">
|
|
2533
|
-
|
|
2534
|
-
<code>false</code>
|
|
2535
|
-
|
|
2536
|
-
</td>
|
|
2537
|
-
|
|
2538
2687
|
|
|
2539
|
-
<td class="description last"><p>輸入是否保留工作資料夾供除錯布林值,預設false</p></td>
|
|
2540
|
-
</tr>
|
|
2541
2688
|
|
|
2542
|
-
|
|
2543
|
-
</tbody>
|
|
2544
|
-
</table>
|
|
2545
2689
|
|
|
2546
|
-
</td>
|
|
2547
|
-
</tr>
|
|
2548
2690
|
|
|
2691
|
+
<h5 class="h5-examples">Example</h5>
|
|
2549
2692
|
|
|
2550
|
-
|
|
2551
|
-
</
|
|
2693
|
+
<pre class="prettyprint"><code>console.log(getQueueSize())
|
|
2694
|
+
// => 0</code></pre>
|
|
2695
|
+
|
|
2696
|
+
|
|
2552
2697
|
|
|
2553
2698
|
|
|
2554
2699
|
|
|
@@ -2569,7 +2714,7 @@ console.log(r)
|
|
|
2569
2714
|
|
|
2570
2715
|
|
|
2571
2716
|
<div class="param-desc">
|
|
2572
|
-
<p
|
|
2717
|
+
<p>回傳排隊數整數</p>
|
|
2573
2718
|
</div>
|
|
2574
2719
|
|
|
2575
2720
|
|
|
@@ -2580,7 +2725,7 @@ console.log(r)
|
|
|
2580
2725
|
</dt>
|
|
2581
2726
|
<dd>
|
|
2582
2727
|
|
|
2583
|
-
<span class="param-type">
|
|
2728
|
+
<span class="param-type">Integer</span>
|
|
2584
2729
|
|
|
2585
2730
|
|
|
2586
2731
|
|
|
@@ -2596,7 +2741,7 @@ console.log(r)
|
|
|
2596
2741
|
|
|
2597
2742
|
|
|
2598
2743
|
|
|
2599
|
-
<h4 class="name" id="
|
|
2744
|
+
<h4 class="name" id="health"><span class="type-signature type-signature-async">(async) </span>health<span class="signature">(opt<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise}</span></h4>
|
|
2600
2745
|
|
|
2601
2746
|
|
|
2602
2747
|
|
|
@@ -2606,15 +2751,13 @@ console.log(r)
|
|
|
2606
2751
|
<dl class="details">
|
|
2607
2752
|
|
|
2608
2753
|
<dt class="tag-description">Description:</dt>
|
|
2609
|
-
<dd class="tag-description"><ul class="dummy"><li><p
|
|
2610
|
-
<p>內部流程為md -> html -> docx。docx階段係調用本機Microsoft Word(win32com),故僅能於已安裝Word之Windows執行,且同時間僅一份轉檔作業(內部佇列自動排隊)。</p>
|
|
2611
|
-
<p>注意:底層w-html2docx於Word未安裝或COM呼叫失敗時「仍回傳ok」,本函數一律以產物實體檔之存在與大小驗證成敗,失敗即reject,不會回報假成功。</p></li></ul></dd>
|
|
2754
|
+
<dd class="tag-description"><ul class="dummy"><li><p>查詢轉檔服務之健康狀態</p></li></ul></dd>
|
|
2612
2755
|
|
|
2613
2756
|
|
|
2614
2757
|
|
|
2615
2758
|
<dt class="tag-source">Source:</dt>
|
|
2616
2759
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
2617
|
-
<a href="
|
|
2760
|
+
<a href="rmApiClient.mjs.html">rmApiClient.mjs</a>, <a href="rmApiClient.mjs.html#line420">line 420</a>
|
|
2618
2761
|
</li></ul></dd>
|
|
2619
2762
|
|
|
2620
2763
|
|
|
@@ -2661,16 +2804,11 @@ console.log(r)
|
|
|
2661
2804
|
|
|
2662
2805
|
<h5 class="h5-examples">Example</h5>
|
|
2663
2806
|
|
|
2664
|
-
<pre class="prettyprint"><code>import
|
|
2807
|
+
<pre class="prettyprint"><code>import { health } from 'w-md2docx/src/rmApiClient.mjs'
|
|
2665
2808
|
|
|
2666
|
-
let r = await
|
|
2667
|
-
fpInTemp: './src/templates/temp_tpc.docx',
|
|
2668
|
-
optMd2html: {
|
|
2669
|
-
imgWidthMax: '500px',
|
|
2670
|
-
},
|
|
2671
|
-
})
|
|
2809
|
+
let r = await health({ host: '127.0.0.1', port: 22000 })
|
|
2672
2810
|
console.log(r)
|
|
2673
|
-
// => {
|
|
2811
|
+
// => { success: true, platform: 'win32', docxReady: true, … }</code></pre>
|
|
2674
2812
|
|
|
2675
2813
|
|
|
2676
2814
|
|
|
@@ -2704,13 +2842,13 @@ console.log(r)
|
|
|
2704
2842
|
|
|
2705
2843
|
<tr>
|
|
2706
2844
|
|
|
2707
|
-
<td class="name"><code>
|
|
2845
|
+
<td class="name"><code>opt</code></td>
|
|
2708
2846
|
|
|
2709
2847
|
|
|
2710
2848
|
<td class="type">
|
|
2711
2849
|
|
|
2712
2850
|
|
|
2713
|
-
<span class="param-type">
|
|
2851
|
+
<span class="param-type">Object</span>
|
|
2714
2852
|
|
|
2715
2853
|
|
|
2716
2854
|
|
|
@@ -2720,6 +2858,8 @@ console.log(r)
|
|
|
2720
2858
|
|
|
2721
2859
|
<td class="attributes">
|
|
2722
2860
|
|
|
2861
|
+
<optional><br>
|
|
2862
|
+
|
|
2723
2863
|
|
|
2724
2864
|
|
|
2725
2865
|
|
|
@@ -2730,59 +2870,48 @@ console.log(r)
|
|
|
2730
2870
|
|
|
2731
2871
|
<td class="default">
|
|
2732
2872
|
|
|
2873
|
+
<code>{}</code>
|
|
2874
|
+
|
|
2733
2875
|
</td>
|
|
2734
2876
|
|
|
2735
2877
|
|
|
2736
|
-
<td class="description last"><p
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
|
|
2741
|
-
<tr>
|
|
2742
|
-
|
|
2743
|
-
<td class="name"><code>fpOutDocx</code></td>
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
<td class="type">
|
|
2747
|
-
|
|
2878
|
+
<td class="description last"><p>輸入設定物件,預設{}</p>
|
|
2879
|
+
<h6>Properties</h6>
|
|
2748
2880
|
|
|
2749
|
-
<span class="param-type">String</span>
|
|
2750
|
-
|
|
2751
2881
|
|
|
2882
|
+
<table class="params">
|
|
2883
|
+
<thead>
|
|
2884
|
+
<tr>
|
|
2885
|
+
|
|
2886
|
+
<th>Name</th>
|
|
2887
|
+
|
|
2752
2888
|
|
|
2753
|
-
|
|
2754
|
-
</td>
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
<td class="attributes">
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2889
|
+
<th>Type</th>
|
|
2761
2890
|
|
|
2762
|
-
|
|
2763
|
-
|
|
2764
|
-
|
|
2891
|
+
|
|
2892
|
+
<th>Attributes</th>
|
|
2893
|
+
|
|
2765
2894
|
|
|
2766
|
-
|
|
2767
|
-
|
|
2768
|
-
|
|
2769
|
-
</td>
|
|
2770
|
-
|
|
2895
|
+
|
|
2896
|
+
<th>Default</th>
|
|
2897
|
+
|
|
2771
2898
|
|
|
2772
|
-
|
|
2773
|
-
|
|
2899
|
+
<th class="last">Description</th>
|
|
2900
|
+
</tr>
|
|
2901
|
+
</thead>
|
|
2774
2902
|
|
|
2903
|
+
<tbody>
|
|
2775
2904
|
|
|
2776
2905
|
|
|
2777
2906
|
<tr>
|
|
2778
2907
|
|
|
2779
|
-
<td class="name"><code>
|
|
2908
|
+
<td class="name"><code>host</code></td>
|
|
2780
2909
|
|
|
2781
2910
|
|
|
2782
2911
|
<td class="type">
|
|
2783
2912
|
|
|
2784
2913
|
|
|
2785
|
-
<span class="param-type">
|
|
2914
|
+
<span class="param-type">String</span>
|
|
2786
2915
|
|
|
2787
2916
|
|
|
2788
2917
|
|
|
@@ -2804,48 +2933,25 @@ console.log(r)
|
|
|
2804
2933
|
|
|
2805
2934
|
<td class="default">
|
|
2806
2935
|
|
|
2807
|
-
<code>
|
|
2936
|
+
<code>'127.0.0.1'</code>
|
|
2808
2937
|
|
|
2809
2938
|
</td>
|
|
2810
2939
|
|
|
2811
2940
|
|
|
2812
|
-
<td class="description last"><p
|
|
2813
|
-
|
|
2814
|
-
|
|
2815
|
-
|
|
2816
|
-
<table class="params">
|
|
2817
|
-
<thead>
|
|
2818
|
-
<tr>
|
|
2819
|
-
|
|
2820
|
-
<th>Name</th>
|
|
2821
|
-
|
|
2822
|
-
|
|
2823
|
-
<th>Type</th>
|
|
2824
|
-
|
|
2825
|
-
|
|
2826
|
-
<th>Attributes</th>
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
|
|
2830
|
-
<th>Default</th>
|
|
2831
|
-
|
|
2832
|
-
|
|
2833
|
-
<th class="last">Description</th>
|
|
2834
|
-
</tr>
|
|
2835
|
-
</thead>
|
|
2941
|
+
<td class="description last"><p>輸入服務主機位址(ip或網域)字串,未給則取環境變數WMD2DOCX_HOST,再無則用'127.0.0.1',預設'127.0.0.1'</p></td>
|
|
2942
|
+
</tr>
|
|
2836
2943
|
|
|
2837
|
-
<tbody>
|
|
2838
2944
|
|
|
2839
2945
|
|
|
2840
2946
|
<tr>
|
|
2841
2947
|
|
|
2842
|
-
<td class="name"><code>
|
|
2948
|
+
<td class="name"><code>port</code></td>
|
|
2843
2949
|
|
|
2844
2950
|
|
|
2845
2951
|
<td class="type">
|
|
2846
2952
|
|
|
2847
2953
|
|
|
2848
|
-
<span class="param-type">
|
|
2954
|
+
<span class="param-type">Integer</span>
|
|
2849
2955
|
|
|
2850
2956
|
|
|
2851
2957
|
|
|
@@ -2867,19 +2973,19 @@ console.log(r)
|
|
|
2867
2973
|
|
|
2868
2974
|
<td class="default">
|
|
2869
2975
|
|
|
2870
|
-
<code>
|
|
2976
|
+
<code>22000</code>
|
|
2871
2977
|
|
|
2872
2978
|
</td>
|
|
2873
2979
|
|
|
2874
2980
|
|
|
2875
|
-
<td class="description last"><p
|
|
2981
|
+
<td class="description last"><p>輸入服務埠號整數,未給則取環境變數WMD2DOCX_PORT,再無則用22000,預設22000</p></td>
|
|
2876
2982
|
</tr>
|
|
2877
2983
|
|
|
2878
2984
|
|
|
2879
2985
|
|
|
2880
2986
|
<tr>
|
|
2881
2987
|
|
|
2882
|
-
<td class="name"><code>
|
|
2988
|
+
<td class="name"><code>url</code></td>
|
|
2883
2989
|
|
|
2884
2990
|
|
|
2885
2991
|
<td class="type">
|
|
@@ -2912,20 +3018,20 @@ console.log(r)
|
|
|
2912
3018
|
</td>
|
|
2913
3019
|
|
|
2914
3020
|
|
|
2915
|
-
<td class="description last"><p
|
|
3021
|
+
<td class="description last"><p>輸入服務完整位址字串,給予時覆寫host與port,預設''</p></td>
|
|
2916
3022
|
</tr>
|
|
2917
3023
|
|
|
2918
3024
|
|
|
2919
3025
|
|
|
2920
3026
|
<tr>
|
|
2921
3027
|
|
|
2922
|
-
<td class="name"><code>
|
|
3028
|
+
<td class="name"><code>token</code></td>
|
|
2923
3029
|
|
|
2924
3030
|
|
|
2925
3031
|
<td class="type">
|
|
2926
3032
|
|
|
2927
3033
|
|
|
2928
|
-
<span class="param-type">
|
|
3034
|
+
<span class="param-type">String</span>
|
|
2929
3035
|
|
|
2930
3036
|
|
|
2931
3037
|
|
|
@@ -2947,25 +3053,25 @@ console.log(r)
|
|
|
2947
3053
|
|
|
2948
3054
|
<td class="default">
|
|
2949
3055
|
|
|
2950
|
-
<code>
|
|
3056
|
+
<code>''</code>
|
|
2951
3057
|
|
|
2952
3058
|
</td>
|
|
2953
3059
|
|
|
2954
3060
|
|
|
2955
|
-
<td class="description last"><p
|
|
3061
|
+
<td class="description last"><p>輸入x-api-token字串,未給則取環境變數WMD2DOCX_TOKEN,預設''</p></td>
|
|
2956
3062
|
</tr>
|
|
2957
3063
|
|
|
2958
3064
|
|
|
2959
3065
|
|
|
2960
3066
|
<tr>
|
|
2961
3067
|
|
|
2962
|
-
<td class="name"><code>
|
|
3068
|
+
<td class="name"><code>timeoutMs</code></td>
|
|
2963
3069
|
|
|
2964
3070
|
|
|
2965
3071
|
<td class="type">
|
|
2966
3072
|
|
|
2967
3073
|
|
|
2968
|
-
<span class="param-type">
|
|
3074
|
+
<span class="param-type">Number</span>
|
|
2969
3075
|
|
|
2970
3076
|
|
|
2971
3077
|
|
|
@@ -2987,12 +3093,12 @@ console.log(r)
|
|
|
2987
3093
|
|
|
2988
3094
|
<td class="default">
|
|
2989
3095
|
|
|
2990
|
-
<code>
|
|
3096
|
+
<code>20000</code>
|
|
2991
3097
|
|
|
2992
3098
|
</td>
|
|
2993
3099
|
|
|
2994
3100
|
|
|
2995
|
-
<td class="description last"><p
|
|
3101
|
+
<td class="description last"><p>輸入逾時毫秒數,預設20000</p></td>
|
|
2996
3102
|
</tr>
|
|
2997
3103
|
|
|
2998
3104
|
|
|
@@ -3025,7 +3131,7 @@ console.log(r)
|
|
|
3025
3131
|
|
|
3026
3132
|
|
|
3027
3133
|
<div class="param-desc">
|
|
3028
|
-
<p>回傳Promise,resolve
|
|
3134
|
+
<p>回傳Promise,resolve回傳服務端回傳之狀態物件,reject回傳錯誤訊息</p>
|
|
3029
3135
|
</div>
|
|
3030
3136
|
|
|
3031
3137
|
|
|
@@ -3052,7 +3158,7 @@ console.log(r)
|
|
|
3052
3158
|
|
|
3053
3159
|
|
|
3054
3160
|
|
|
3055
|
-
<h4 class="name" id="
|
|
3161
|
+
<h4 class="name" id="readAssets"><span class="type-signature"></span>readAssets<span class="signature">(md, dirMd)</span><span class="type-signature"> → {Object}</span></h4>
|
|
3056
3162
|
|
|
3057
3163
|
|
|
3058
3164
|
|
|
@@ -3062,14 +3168,14 @@ console.log(r)
|
|
|
3062
3168
|
<dl class="details">
|
|
3063
3169
|
|
|
3064
3170
|
<dt class="tag-description">Description:</dt>
|
|
3065
|
-
<dd class="tag-description"><ul class="dummy"><li><p
|
|
3066
|
-
<p
|
|
3171
|
+
<dd class="tag-description"><ul class="dummy"><li><p>讀取Markdown引用之資產檔並轉base64</p>
|
|
3172
|
+
<p>path一律回傳md內之原字串(服務端據以還原相對路徑);實體檔則原字串與URL解碼後字串皆嘗試。</p></li></ul></dd>
|
|
3067
3173
|
|
|
3068
3174
|
|
|
3069
3175
|
|
|
3070
3176
|
<dt class="tag-source">Source:</dt>
|
|
3071
3177
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
3072
|
-
<a href="
|
|
3178
|
+
<a href="rmApiClient.mjs.html">rmApiClient.mjs</a>, <a href="rmApiClient.mjs.html#line134">line 134</a>
|
|
3073
3179
|
</li></ul></dd>
|
|
3074
3180
|
|
|
3075
3181
|
|
|
@@ -3116,124 +3222,84 @@ console.log(r)
|
|
|
3116
3222
|
|
|
3117
3223
|
<h5 class="h5-examples">Example</h5>
|
|
3118
3224
|
|
|
3119
|
-
<pre class="prettyprint"><code>
|
|
3120
|
-
// => '
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3127
|
-
|
|
3128
|
-
|
|
3129
|
-
|
|
3130
|
-
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3225
|
+
<pre class="prettyprint"><code>let { assets, missing } = readAssets('', './report')
|
|
3226
|
+
// => { assets: [ { path: 'pics/a.png', base64: '…' } ], missing: [] }</code></pre>
|
|
3135
3227
|
|
|
3136
3228
|
|
|
3137
3229
|
|
|
3138
3230
|
|
|
3139
|
-
<h5 class="h5-
|
|
3231
|
+
<h5 class="h5-parameters">Parameters:</h5>
|
|
3232
|
+
|
|
3140
3233
|
|
|
3234
|
+
<table class="params">
|
|
3235
|
+
<thead>
|
|
3236
|
+
<tr>
|
|
3141
3237
|
|
|
3142
|
-
<
|
|
3143
|
-
<p>回傳exe位置字串,查無則回傳空字串</p>
|
|
3144
|
-
</div>
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
|
|
3148
|
-
<dl class="param-type">
|
|
3149
|
-
<dt>
|
|
3150
|
-
Type
|
|
3151
|
-
</dt>
|
|
3152
|
-
<dd>
|
|
3238
|
+
<th>Name</th>
|
|
3153
3239
|
|
|
3154
|
-
<span class="param-type">String</span>
|
|
3155
|
-
|
|
3156
|
-
|
|
3157
|
-
|
|
3158
|
-
</dd>
|
|
3159
|
-
</dl>
|
|
3160
|
-
|
|
3161
|
-
|
|
3162
|
-
|
|
3163
3240
|
|
|
3241
|
+
<th>Type</th>
|
|
3164
3242
|
|
|
3165
3243
|
|
|
3166
|
-
|
|
3167
|
-
|
|
3168
|
-
|
|
3169
|
-
|
|
3170
|
-
<h4 class="name" id="getQueueSize"><span class="type-signature"></span>getQueueSize<span class="signature">()</span><span class="type-signature"> → {Integer}</span></h4>
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
<dl class="details">
|
|
3178
|
-
|
|
3179
|
-
<dt class="tag-description">Description:</dt>
|
|
3180
|
-
<dd class="tag-description"><ul class="dummy"><li><p>取當前排隊中(含執行中)之docx轉檔數</p></li></ul></dd>
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
<dt class="tag-source">Source:</dt>
|
|
3185
|
-
<dd class="tag-source"><ul class="dummy"><li>
|
|
3186
|
-
<a href="utils.mjs.html">utils.mjs</a>, <a href="utils.mjs.html#line161">line 161</a>
|
|
3187
|
-
</li></ul></dd>
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
3244
|
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3245
|
+
|
|
3197
3246
|
|
|
3198
|
-
|
|
3247
|
+
<th class="last">Description</th>
|
|
3248
|
+
</tr>
|
|
3249
|
+
</thead>
|
|
3199
3250
|
|
|
3251
|
+
<tbody>
|
|
3200
3252
|
|
|
3201
3253
|
|
|
3202
|
-
|
|
3254
|
+
<tr>
|
|
3255
|
+
|
|
3256
|
+
<td class="name"><code>md</code></td>
|
|
3257
|
+
|
|
3203
3258
|
|
|
3204
|
-
|
|
3259
|
+
<td class="type">
|
|
3260
|
+
|
|
3261
|
+
|
|
3262
|
+
<span class="param-type">String</span>
|
|
3205
3263
|
|
|
3206
|
-
|
|
3207
3264
|
|
|
3208
|
-
|
|
3209
3265
|
|
|
3210
|
-
|
|
3266
|
+
|
|
3267
|
+
</td>
|
|
3211
3268
|
|
|
3212
|
-
|
|
3269
|
+
|
|
3213
3270
|
|
|
3214
|
-
|
|
3271
|
+
|
|
3215
3272
|
|
|
3216
|
-
|
|
3273
|
+
<td class="description last"><p>輸入Markdown內容字串</p></td>
|
|
3274
|
+
</tr>
|
|
3217
3275
|
|
|
3218
3276
|
|
|
3219
|
-
</dl>
|
|
3220
|
-
|
|
3221
|
-
|
|
3222
3277
|
|
|
3278
|
+
<tr>
|
|
3279
|
+
|
|
3280
|
+
<td class="name"><code>dirMd</code></td>
|
|
3281
|
+
|
|
3223
3282
|
|
|
3283
|
+
<td class="type">
|
|
3284
|
+
|
|
3285
|
+
|
|
3286
|
+
<span class="param-type">String</span>
|
|
3224
3287
|
|
|
3225
3288
|
|
|
3226
3289
|
|
|
3290
|
+
|
|
3291
|
+
</td>
|
|
3227
3292
|
|
|
3293
|
+
|
|
3228
3294
|
|
|
3295
|
+
|
|
3229
3296
|
|
|
3297
|
+
<td class="description last"><p>輸入Markdown所在資料夾位置字串,相對路徑以此為基準</p></td>
|
|
3298
|
+
</tr>
|
|
3230
3299
|
|
|
3231
|
-
<h5 class="h5-examples">Example</h5>
|
|
3232
3300
|
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3301
|
+
</tbody>
|
|
3302
|
+
</table>
|
|
3237
3303
|
|
|
3238
3304
|
|
|
3239
3305
|
|
|
@@ -3254,7 +3320,7 @@ console.log(r)
|
|
|
3254
3320
|
|
|
3255
3321
|
|
|
3256
3322
|
<div class="param-desc">
|
|
3257
|
-
<p
|
|
3323
|
+
<p>回傳{assets,missing},assets為[{path,base64}],missing為找不到之相對路徑陣列</p>
|
|
3258
3324
|
</div>
|
|
3259
3325
|
|
|
3260
3326
|
|
|
@@ -3265,7 +3331,7 @@ console.log(r)
|
|
|
3265
3331
|
</dt>
|
|
3266
3332
|
<dd>
|
|
3267
3333
|
|
|
3268
|
-
<span class="param-type">
|
|
3334
|
+
<span class="param-type">Object</span>
|
|
3269
3335
|
|
|
3270
3336
|
|
|
3271
3337
|
|
|
@@ -3281,7 +3347,7 @@ console.log(r)
|
|
|
3281
3347
|
|
|
3282
3348
|
|
|
3283
3349
|
|
|
3284
|
-
<h4 class="name" id="
|
|
3350
|
+
<h4 class="name" id="resolveAssetPaths"><span class="type-signature"></span>resolveAssetPaths<span class="signature">(dirJob, p)</span><span class="type-signature"> → {Array}</span></h4>
|
|
3285
3351
|
|
|
3286
3352
|
|
|
3287
3353
|
|
|
@@ -3291,13 +3357,14 @@ console.log(r)
|
|
|
3291
3357
|
<dl class="details">
|
|
3292
3358
|
|
|
3293
3359
|
<dt class="tag-description">Description:</dt>
|
|
3294
|
-
<dd class="tag-description"><ul class="dummy"><li><p
|
|
3360
|
+
<dd class="tag-description"><ul class="dummy"><li><p>解析資產之相對路徑並防護路徑穿越</p>
|
|
3361
|
+
<p>md內之圖片路徑可能為URL編碼(中文或空白),而轉檔器係以md內之原字串組路徑取圖;故原字串與解碼後字串不同時回傳兩者,供呼叫端寫入同一內容確保圖片必能被解析。</p></li></ul></dd>
|
|
3295
3362
|
|
|
3296
3363
|
|
|
3297
3364
|
|
|
3298
3365
|
<dt class="tag-source">Source:</dt>
|
|
3299
3366
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
3300
|
-
<a href="
|
|
3367
|
+
<a href="utils.mjs.html">utils.mjs</a>, <a href="utils.mjs.html#line288">line 288</a>
|
|
3301
3368
|
</li></ul></dd>
|
|
3302
3369
|
|
|
3303
3370
|
|
|
@@ -3344,11 +3411,8 @@ console.log(r)
|
|
|
3344
3411
|
|
|
3345
3412
|
<h5 class="h5-examples">Example</h5>
|
|
3346
3413
|
|
|
3347
|
-
<pre class="prettyprint"><code>
|
|
3348
|
-
|
|
3349
|
-
let r = await health({ host: '127.0.0.1', port: 22000 })
|
|
3350
|
-
console.log(r)
|
|
3351
|
-
// => { success: true, platform: 'win32', docxReady: true, … }</code></pre>
|
|
3414
|
+
<pre class="prettyprint"><code>console.log(resolveAssetPaths('C:\\job', 'pics/%E5%9C%96.png'))
|
|
3415
|
+
// => [ 'C:\\job\\pics\\%E5%9C%96.png', 'C:\\job\\pics\\圖.png' ]</code></pre>
|
|
3352
3416
|
|
|
3353
3417
|
|
|
3354
3418
|
|
|
@@ -3366,75 +3430,8 @@ console.log(r)
|
|
|
3366
3430
|
<th>Type</th>
|
|
3367
3431
|
|
|
3368
3432
|
|
|
3369
|
-
<th>Attributes</th>
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
<th>Default</th>
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
<th class="last">Description</th>
|
|
3377
|
-
</tr>
|
|
3378
|
-
</thead>
|
|
3379
|
-
|
|
3380
|
-
<tbody>
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
<tr>
|
|
3384
|
-
|
|
3385
|
-
<td class="name"><code>opt</code></td>
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
<td class="type">
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
<span class="param-type">Object</span>
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
</td>
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
<td class="attributes">
|
|
3400
|
-
|
|
3401
|
-
<optional><br>
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
</td>
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3411
|
-
<td class="default">
|
|
3412
|
-
|
|
3413
|
-
<code>{}</code>
|
|
3414
|
-
|
|
3415
|
-
</td>
|
|
3416
|
-
|
|
3417
|
-
|
|
3418
|
-
<td class="description last"><p>輸入設定物件,預設{}</p>
|
|
3419
|
-
<h6>Properties</h6>
|
|
3420
|
-
|
|
3421
|
-
|
|
3422
|
-
<table class="params">
|
|
3423
|
-
<thead>
|
|
3424
|
-
<tr>
|
|
3425
|
-
|
|
3426
|
-
<th>Name</th>
|
|
3427
|
-
|
|
3428
|
-
|
|
3429
|
-
<th>Type</th>
|
|
3430
|
-
|
|
3431
|
-
|
|
3432
|
-
<th>Attributes</th>
|
|
3433
|
-
|
|
3434
3433
|
|
|
3435
3434
|
|
|
3436
|
-
<th>Default</th>
|
|
3437
|
-
|
|
3438
3435
|
|
|
3439
3436
|
<th class="last">Description</th>
|
|
3440
3437
|
</tr>
|
|
@@ -3445,87 +3442,7 @@ console.log(r)
|
|
|
3445
3442
|
|
|
3446
3443
|
<tr>
|
|
3447
3444
|
|
|
3448
|
-
<td class="name"><code>
|
|
3449
|
-
|
|
3450
|
-
|
|
3451
|
-
<td class="type">
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
<span class="param-type">String</span>
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
|
|
3458
|
-
|
|
3459
|
-
</td>
|
|
3460
|
-
|
|
3461
|
-
|
|
3462
|
-
<td class="attributes">
|
|
3463
|
-
|
|
3464
|
-
<optional><br>
|
|
3465
|
-
|
|
3466
|
-
|
|
3467
|
-
|
|
3468
|
-
|
|
3469
|
-
|
|
3470
|
-
</td>
|
|
3471
|
-
|
|
3472
|
-
|
|
3473
|
-
|
|
3474
|
-
<td class="default">
|
|
3475
|
-
|
|
3476
|
-
<code>'127.0.0.1'</code>
|
|
3477
|
-
|
|
3478
|
-
</td>
|
|
3479
|
-
|
|
3480
|
-
|
|
3481
|
-
<td class="description last"><p>輸入服務主機位址(ip或網域)字串,未給則取環境變數WMD2DOCX_HOST,再無則用'127.0.0.1',預設'127.0.0.1'</p></td>
|
|
3482
|
-
</tr>
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
<tr>
|
|
3487
|
-
|
|
3488
|
-
<td class="name"><code>port</code></td>
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
<td class="type">
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
<span class="param-type">Integer</span>
|
|
3495
|
-
|
|
3496
|
-
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
</td>
|
|
3500
|
-
|
|
3501
|
-
|
|
3502
|
-
<td class="attributes">
|
|
3503
|
-
|
|
3504
|
-
<optional><br>
|
|
3505
|
-
|
|
3506
|
-
|
|
3507
|
-
|
|
3508
|
-
|
|
3509
|
-
|
|
3510
|
-
</td>
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
<td class="default">
|
|
3515
|
-
|
|
3516
|
-
<code>22000</code>
|
|
3517
|
-
|
|
3518
|
-
</td>
|
|
3519
|
-
|
|
3520
|
-
|
|
3521
|
-
<td class="description last"><p>輸入服務埠號整數,未給則取環境變數WMD2DOCX_PORT,再無則用22000,預設22000</p></td>
|
|
3522
|
-
</tr>
|
|
3523
|
-
|
|
3524
|
-
|
|
3525
|
-
|
|
3526
|
-
<tr>
|
|
3527
|
-
|
|
3528
|
-
<td class="name"><code>url</code></td>
|
|
3445
|
+
<td class="name"><code>dirJob</code></td>
|
|
3529
3446
|
|
|
3530
3447
|
|
|
3531
3448
|
<td class="type">
|
|
@@ -3539,33 +3456,17 @@ console.log(r)
|
|
|
3539
3456
|
</td>
|
|
3540
3457
|
|
|
3541
3458
|
|
|
3542
|
-
<td class="attributes">
|
|
3543
|
-
|
|
3544
|
-
<optional><br>
|
|
3545
|
-
|
|
3546
|
-
|
|
3547
|
-
|
|
3548
|
-
|
|
3549
|
-
|
|
3550
|
-
</td>
|
|
3551
|
-
|
|
3552
3459
|
|
|
3553
3460
|
|
|
3554
|
-
<td class="default">
|
|
3555
|
-
|
|
3556
|
-
<code>''</code>
|
|
3557
|
-
|
|
3558
|
-
</td>
|
|
3559
|
-
|
|
3560
3461
|
|
|
3561
|
-
<td class="description last"><p
|
|
3462
|
+
<td class="description last"><p>輸入工作資料夾位置字串</p></td>
|
|
3562
3463
|
</tr>
|
|
3563
3464
|
|
|
3564
3465
|
|
|
3565
3466
|
|
|
3566
3467
|
<tr>
|
|
3567
3468
|
|
|
3568
|
-
<td class="name"><code>
|
|
3469
|
+
<td class="name"><code>p</code></td>
|
|
3569
3470
|
|
|
3570
3471
|
|
|
3571
3472
|
<td class="type">
|
|
@@ -3575,77 +3476,14 @@ console.log(r)
|
|
|
3575
3476
|
|
|
3576
3477
|
|
|
3577
3478
|
|
|
3578
|
-
|
|
3579
|
-
</td>
|
|
3580
|
-
|
|
3581
|
-
|
|
3582
|
-
<td class="attributes">
|
|
3583
|
-
|
|
3584
|
-
<optional><br>
|
|
3585
|
-
|
|
3586
|
-
|
|
3587
|
-
|
|
3588
|
-
|
|
3589
|
-
|
|
3590
|
-
</td>
|
|
3591
|
-
|
|
3592
|
-
|
|
3593
|
-
|
|
3594
|
-
<td class="default">
|
|
3595
|
-
|
|
3596
|
-
<code>''</code>
|
|
3597
|
-
|
|
3598
|
-
</td>
|
|
3599
|
-
|
|
3600
|
-
|
|
3601
|
-
<td class="description last"><p>輸入x-api-token字串,未給則取環境變數WMD2DOCX_TOKEN,預設''</p></td>
|
|
3602
|
-
</tr>
|
|
3603
|
-
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
<tr>
|
|
3607
|
-
|
|
3608
|
-
<td class="name"><code>timeoutMs</code></td>
|
|
3609
|
-
|
|
3610
|
-
|
|
3611
|
-
<td class="type">
|
|
3612
|
-
|
|
3613
|
-
|
|
3614
|
-
<span class="param-type">Number</span>
|
|
3615
|
-
|
|
3616
|
-
|
|
3617
|
-
|
|
3618
|
-
|
|
3619
|
-
</td>
|
|
3620
|
-
|
|
3621
|
-
|
|
3622
|
-
<td class="attributes">
|
|
3623
|
-
|
|
3624
|
-
<optional><br>
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
</td>
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
<td class="default">
|
|
3635
|
-
|
|
3636
|
-
<code>20000</code>
|
|
3637
|
-
|
|
3638
|
-
</td>
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
<td class="description last"><p>輸入逾時毫秒數,預設20000</p></td>
|
|
3642
|
-
</tr>
|
|
3643
|
-
|
|
3644
|
-
|
|
3645
|
-
</tbody>
|
|
3646
|
-
</table>
|
|
3647
|
-
|
|
3479
|
+
|
|
3648
3480
|
</td>
|
|
3481
|
+
|
|
3482
|
+
|
|
3483
|
+
|
|
3484
|
+
|
|
3485
|
+
|
|
3486
|
+
<td class="description last"><p>輸入資產相對路徑字串</p></td>
|
|
3649
3487
|
</tr>
|
|
3650
3488
|
|
|
3651
3489
|
|
|
@@ -3671,7 +3509,7 @@ console.log(r)
|
|
|
3671
3509
|
|
|
3672
3510
|
|
|
3673
3511
|
<div class="param-desc">
|
|
3674
|
-
<p
|
|
3512
|
+
<p>回傳實際寫入之絕對路徑陣列</p>
|
|
3675
3513
|
</div>
|
|
3676
3514
|
|
|
3677
3515
|
|
|
@@ -3682,7 +3520,7 @@ console.log(r)
|
|
|
3682
3520
|
</dt>
|
|
3683
3521
|
<dd>
|
|
3684
3522
|
|
|
3685
|
-
<span class="param-type">
|
|
3523
|
+
<span class="param-type">Array</span>
|
|
3686
3524
|
|
|
3687
3525
|
|
|
3688
3526
|
|
|
@@ -3698,7 +3536,7 @@ console.log(r)
|
|
|
3698
3536
|
|
|
3699
3537
|
|
|
3700
3538
|
|
|
3701
|
-
<h4 class="name" id="
|
|
3539
|
+
<h4 class="name" id="retryBusy"><span class="type-signature type-signature-async">(async) </span>retryBusy<span class="signature">(fun, opt<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise}</span></h4>
|
|
3702
3540
|
|
|
3703
3541
|
|
|
3704
3542
|
|
|
@@ -3708,14 +3546,14 @@ console.log(r)
|
|
|
3708
3546
|
<dl class="details">
|
|
3709
3547
|
|
|
3710
3548
|
<dt class="tag-description">Description:</dt>
|
|
3711
|
-
<dd class="tag-description"><ul class="dummy"><li><p
|
|
3712
|
-
<p>
|
|
3549
|
+
<dd class="tag-description"><ul class="dummy"><li><p>重試短暫被鎖定之檔案操作</p>
|
|
3550
|
+
<p>Windows下新建檔案常被防毒或索引器即時掃描而短暫鎖定(EBUSY/EPERM),遇此類錯誤時延遲後重試以提高穩定性,其餘錯誤直接拋出。</p></li></ul></dd>
|
|
3713
3551
|
|
|
3714
3552
|
|
|
3715
3553
|
|
|
3716
3554
|
<dt class="tag-source">Source:</dt>
|
|
3717
3555
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
3718
|
-
<a href="
|
|
3556
|
+
<a href="utils.mjs.html">utils.mjs</a>, <a href="utils.mjs.html#line73">line 73</a>
|
|
3719
3557
|
</li></ul></dd>
|
|
3720
3558
|
|
|
3721
3559
|
|
|
@@ -3762,8 +3600,7 @@ console.log(r)
|
|
|
3762
3600
|
|
|
3763
3601
|
<h5 class="h5-examples">Example</h5>
|
|
3764
3602
|
|
|
3765
|
-
<pre class="prettyprint"><code>let
|
|
3766
|
-
// => { assets: [ { path: 'pics/a.png', base64: '…' } ], missing: [] }</code></pre>
|
|
3603
|
+
<pre class="prettyprint"><code>let r = await retryBusy(() => fs.promises.readFile('./a.txt', 'utf8'), { tries: 3 })</code></pre>
|
|
3767
3604
|
|
|
3768
3605
|
|
|
3769
3606
|
|
|
@@ -3781,8 +3618,12 @@ console.log(r)
|
|
|
3781
3618
|
<th>Type</th>
|
|
3782
3619
|
|
|
3783
3620
|
|
|
3621
|
+
<th>Attributes</th>
|
|
3622
|
+
|
|
3784
3623
|
|
|
3785
3624
|
|
|
3625
|
+
<th>Default</th>
|
|
3626
|
+
|
|
3786
3627
|
|
|
3787
3628
|
<th class="last">Description</th>
|
|
3788
3629
|
</tr>
|
|
@@ -3793,13 +3634,13 @@ console.log(r)
|
|
|
3793
3634
|
|
|
3794
3635
|
<tr>
|
|
3795
3636
|
|
|
3796
|
-
<td class="name"><code>
|
|
3637
|
+
<td class="name"><code>fun</code></td>
|
|
3797
3638
|
|
|
3798
3639
|
|
|
3799
3640
|
<td class="type">
|
|
3800
3641
|
|
|
3801
3642
|
|
|
3802
|
-
<span class="param-type">
|
|
3643
|
+
<span class="param-type">function</span>
|
|
3803
3644
|
|
|
3804
3645
|
|
|
3805
3646
|
|
|
@@ -3807,23 +3648,35 @@ console.log(r)
|
|
|
3807
3648
|
</td>
|
|
3808
3649
|
|
|
3809
3650
|
|
|
3651
|
+
<td class="attributes">
|
|
3652
|
+
|
|
3653
|
+
|
|
3654
|
+
|
|
3655
|
+
|
|
3656
|
+
|
|
3657
|
+
</td>
|
|
3658
|
+
|
|
3810
3659
|
|
|
3811
3660
|
|
|
3661
|
+
<td class="default">
|
|
3662
|
+
|
|
3663
|
+
</td>
|
|
3664
|
+
|
|
3812
3665
|
|
|
3813
|
-
<td class="description last"><p
|
|
3666
|
+
<td class="description last"><p>輸入欲執行之函數,可回傳Promise</p></td>
|
|
3814
3667
|
</tr>
|
|
3815
3668
|
|
|
3816
3669
|
|
|
3817
3670
|
|
|
3818
3671
|
<tr>
|
|
3819
3672
|
|
|
3820
|
-
<td class="name"><code>
|
|
3673
|
+
<td class="name"><code>opt</code></td>
|
|
3821
3674
|
|
|
3822
3675
|
|
|
3823
3676
|
<td class="type">
|
|
3824
3677
|
|
|
3825
3678
|
|
|
3826
|
-
<span class="param-type">
|
|
3679
|
+
<span class="param-type">Object</span>
|
|
3827
3680
|
|
|
3828
3681
|
|
|
3829
3682
|
|
|
@@ -3831,10 +3684,136 @@ console.log(r)
|
|
|
3831
3684
|
</td>
|
|
3832
3685
|
|
|
3833
3686
|
|
|
3687
|
+
<td class="attributes">
|
|
3688
|
+
|
|
3689
|
+
<optional><br>
|
|
3690
|
+
|
|
3691
|
+
|
|
3692
|
+
|
|
3693
|
+
|
|
3694
|
+
|
|
3695
|
+
</td>
|
|
3696
|
+
|
|
3834
3697
|
|
|
3835
3698
|
|
|
3699
|
+
<td class="default">
|
|
3700
|
+
|
|
3701
|
+
<code>{}</code>
|
|
3702
|
+
|
|
3703
|
+
</td>
|
|
3704
|
+
|
|
3836
3705
|
|
|
3837
|
-
<td class="description last"><p
|
|
3706
|
+
<td class="description last"><p>輸入設定物件,預設{}</p>
|
|
3707
|
+
<h6>Properties</h6>
|
|
3708
|
+
|
|
3709
|
+
|
|
3710
|
+
<table class="params">
|
|
3711
|
+
<thead>
|
|
3712
|
+
<tr>
|
|
3713
|
+
|
|
3714
|
+
<th>Name</th>
|
|
3715
|
+
|
|
3716
|
+
|
|
3717
|
+
<th>Type</th>
|
|
3718
|
+
|
|
3719
|
+
|
|
3720
|
+
<th>Attributes</th>
|
|
3721
|
+
|
|
3722
|
+
|
|
3723
|
+
|
|
3724
|
+
<th>Default</th>
|
|
3725
|
+
|
|
3726
|
+
|
|
3727
|
+
<th class="last">Description</th>
|
|
3728
|
+
</tr>
|
|
3729
|
+
</thead>
|
|
3730
|
+
|
|
3731
|
+
<tbody>
|
|
3732
|
+
|
|
3733
|
+
|
|
3734
|
+
<tr>
|
|
3735
|
+
|
|
3736
|
+
<td class="name"><code>tries</code></td>
|
|
3737
|
+
|
|
3738
|
+
|
|
3739
|
+
<td class="type">
|
|
3740
|
+
|
|
3741
|
+
|
|
3742
|
+
<span class="param-type">Integer</span>
|
|
3743
|
+
|
|
3744
|
+
|
|
3745
|
+
|
|
3746
|
+
|
|
3747
|
+
</td>
|
|
3748
|
+
|
|
3749
|
+
|
|
3750
|
+
<td class="attributes">
|
|
3751
|
+
|
|
3752
|
+
<optional><br>
|
|
3753
|
+
|
|
3754
|
+
|
|
3755
|
+
|
|
3756
|
+
|
|
3757
|
+
|
|
3758
|
+
</td>
|
|
3759
|
+
|
|
3760
|
+
|
|
3761
|
+
|
|
3762
|
+
<td class="default">
|
|
3763
|
+
|
|
3764
|
+
<code>6</code>
|
|
3765
|
+
|
|
3766
|
+
</td>
|
|
3767
|
+
|
|
3768
|
+
|
|
3769
|
+
<td class="description last"><p>輸入最多嘗試次數整數,預設6</p></td>
|
|
3770
|
+
</tr>
|
|
3771
|
+
|
|
3772
|
+
|
|
3773
|
+
|
|
3774
|
+
<tr>
|
|
3775
|
+
|
|
3776
|
+
<td class="name"><code>delayMs</code></td>
|
|
3777
|
+
|
|
3778
|
+
|
|
3779
|
+
<td class="type">
|
|
3780
|
+
|
|
3781
|
+
|
|
3782
|
+
<span class="param-type">Number</span>
|
|
3783
|
+
|
|
3784
|
+
|
|
3785
|
+
|
|
3786
|
+
|
|
3787
|
+
</td>
|
|
3788
|
+
|
|
3789
|
+
|
|
3790
|
+
<td class="attributes">
|
|
3791
|
+
|
|
3792
|
+
<optional><br>
|
|
3793
|
+
|
|
3794
|
+
|
|
3795
|
+
|
|
3796
|
+
|
|
3797
|
+
|
|
3798
|
+
</td>
|
|
3799
|
+
|
|
3800
|
+
|
|
3801
|
+
|
|
3802
|
+
<td class="default">
|
|
3803
|
+
|
|
3804
|
+
<code>400</code>
|
|
3805
|
+
|
|
3806
|
+
</td>
|
|
3807
|
+
|
|
3808
|
+
|
|
3809
|
+
<td class="description last"><p>輸入每次重試前延遲毫秒數,預設400</p></td>
|
|
3810
|
+
</tr>
|
|
3811
|
+
|
|
3812
|
+
|
|
3813
|
+
</tbody>
|
|
3814
|
+
</table>
|
|
3815
|
+
|
|
3816
|
+
</td>
|
|
3838
3817
|
</tr>
|
|
3839
3818
|
|
|
3840
3819
|
|
|
@@ -3860,7 +3839,7 @@ console.log(r)
|
|
|
3860
3839
|
|
|
3861
3840
|
|
|
3862
3841
|
<div class="param-desc">
|
|
3863
|
-
<p>回傳
|
|
3842
|
+
<p>回傳Promise,resolve回傳fun之結果,reject回傳錯誤</p>
|
|
3864
3843
|
</div>
|
|
3865
3844
|
|
|
3866
3845
|
|
|
@@ -3871,7 +3850,7 @@ console.log(r)
|
|
|
3871
3850
|
</dt>
|
|
3872
3851
|
<dd>
|
|
3873
3852
|
|
|
3874
|
-
<span class="param-type">
|
|
3853
|
+
<span class="param-type">Promise</span>
|
|
3875
3854
|
|
|
3876
3855
|
|
|
3877
3856
|
|
|
@@ -3887,7 +3866,7 @@ console.log(r)
|
|
|
3887
3866
|
|
|
3888
3867
|
|
|
3889
3868
|
|
|
3890
|
-
<h4 class="name" id="
|
|
3869
|
+
<h4 class="name" id="rmApiServer"><span class="type-signature type-signature-async">(async) </span>rmApiServer<span class="signature">(opt<span class="signature-attributes">opt</span>)</span><span class="type-signature"> → {Promise}</span></h4>
|
|
3891
3870
|
|
|
3892
3871
|
|
|
3893
3872
|
|
|
@@ -3897,14 +3876,14 @@ console.log(r)
|
|
|
3897
3876
|
<dl class="details">
|
|
3898
3877
|
|
|
3899
3878
|
<dt class="tag-description">Description:</dt>
|
|
3900
|
-
<dd class="tag-description"><ul class="dummy"><li><p
|
|
3901
|
-
<p
|
|
3879
|
+
<dd class="tag-description"><ul class="dummy"><li><p>建立並啟動Markdown轉Html/Docx之API服務</p>
|
|
3880
|
+
<p>以hapi提供三個端點:GET /api/health(健康檢查與環境狀態)、GET /api/selftest(實跑一次最小轉檔驗證本機Word可用)、POST /api/convert(轉檔主端點,JSON參數同cvMdTo,另可用templateName指定服務端模板或templateBase64夾帶模板;query帶download=1時單一格式直接回傳二進位檔)。</p></li></ul></dd>
|
|
3902
3881
|
|
|
3903
3882
|
|
|
3904
3883
|
|
|
3905
3884
|
<dt class="tag-source">Source:</dt>
|
|
3906
3885
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
3907
|
-
<a href="
|
|
3886
|
+
<a href="rmApiServer.mjs.html">rmApiServer.mjs</a>, <a href="rmApiServer.mjs.html#line86">line 86</a>
|
|
3908
3887
|
</li></ul></dd>
|
|
3909
3888
|
|
|
3910
3889
|
|
|
@@ -3951,8 +3930,13 @@ console.log(r)
|
|
|
3951
3930
|
|
|
3952
3931
|
<h5 class="h5-examples">Example</h5>
|
|
3953
3932
|
|
|
3954
|
-
<pre class="prettyprint"><code>
|
|
3955
|
-
|
|
3933
|
+
<pre class="prettyprint"><code>import rmApiServer from 'w-md2docx/src/rmApiServer.mjs'
|
|
3934
|
+
|
|
3935
|
+
let { server, settings } = await rmApiServer({
|
|
3936
|
+
port: 22000,
|
|
3937
|
+
token: '',
|
|
3938
|
+
})
|
|
3939
|
+
console.log(`listening on ${server.info.uri}`, settings)</code></pre>
|
|
3956
3940
|
|
|
3957
3941
|
|
|
3958
3942
|
|
|
@@ -3970,8 +3954,12 @@ console.log(r)
|
|
|
3970
3954
|
<th>Type</th>
|
|
3971
3955
|
|
|
3972
3956
|
|
|
3957
|
+
<th>Attributes</th>
|
|
3958
|
+
|
|
3973
3959
|
|
|
3974
3960
|
|
|
3961
|
+
<th>Default</th>
|
|
3962
|
+
|
|
3975
3963
|
|
|
3976
3964
|
<th class="last">Description</th>
|
|
3977
3965
|
</tr>
|
|
@@ -3982,13 +3970,13 @@ console.log(r)
|
|
|
3982
3970
|
|
|
3983
3971
|
<tr>
|
|
3984
3972
|
|
|
3985
|
-
<td class="name"><code>
|
|
3973
|
+
<td class="name"><code>opt</code></td>
|
|
3986
3974
|
|
|
3987
3975
|
|
|
3988
3976
|
<td class="type">
|
|
3989
3977
|
|
|
3990
3978
|
|
|
3991
|
-
<span class="param-type">
|
|
3979
|
+
<span class="param-type">Object</span>
|
|
3992
3980
|
|
|
3993
3981
|
|
|
3994
3982
|
|
|
@@ -3996,191 +3984,222 @@ console.log(r)
|
|
|
3996
3984
|
</td>
|
|
3997
3985
|
|
|
3998
3986
|
|
|
3999
|
-
|
|
4000
|
-
|
|
4001
|
-
|
|
4002
|
-
<td class="description last"><p>輸入工作資料夾位置字串</p></td>
|
|
4003
|
-
</tr>
|
|
4004
|
-
|
|
4005
|
-
|
|
4006
|
-
|
|
4007
|
-
<tr>
|
|
4008
|
-
|
|
4009
|
-
<td class="name"><code>p</code></td>
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
<td class="type">
|
|
4013
|
-
|
|
3987
|
+
<td class="attributes">
|
|
3988
|
+
|
|
3989
|
+
<optional><br>
|
|
4014
3990
|
|
|
4015
|
-
<span class="param-type">String</span>
|
|
4016
|
-
|
|
4017
3991
|
|
|
3992
|
+
|
|
4018
3993
|
|
|
3994
|
+
|
|
3995
|
+
</td>
|
|
4019
3996
|
|
|
4020
|
-
</td>
|
|
4021
3997
|
|
|
4022
3998
|
|
|
4023
|
-
|
|
3999
|
+
<td class="default">
|
|
4000
|
+
|
|
4001
|
+
<code>{}</code>
|
|
4002
|
+
|
|
4003
|
+
</td>
|
|
4024
4004
|
|
|
4025
4005
|
|
|
4026
|
-
<td class="description last"><p
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
</tbody>
|
|
4031
|
-
</table>
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
<h5 class="h5-returns">Returns:</h5>
|
|
4006
|
+
<td class="description last"><p>輸入設定物件,預設{}</p>
|
|
4007
|
+
<h6>Properties</h6>
|
|
4008
|
+
|
|
4049
4009
|
|
|
4010
|
+
<table class="params">
|
|
4011
|
+
<thead>
|
|
4012
|
+
<tr>
|
|
4013
|
+
|
|
4014
|
+
<th>Name</th>
|
|
4050
4015
|
|
|
4051
|
-
<div class="param-desc">
|
|
4052
|
-
<p>回傳實際寫入之絕對路徑陣列</p>
|
|
4053
|
-
</div>
|
|
4054
|
-
|
|
4055
4016
|
|
|
4017
|
+
<th>Type</th>
|
|
4056
4018
|
|
|
4057
|
-
<dl class="param-type">
|
|
4058
|
-
<dt>
|
|
4059
|
-
Type
|
|
4060
|
-
</dt>
|
|
4061
|
-
<dd>
|
|
4062
4019
|
|
|
4063
|
-
<
|
|
4064
|
-
|
|
4020
|
+
<th>Attributes</th>
|
|
4021
|
+
|
|
4065
4022
|
|
|
4023
|
+
|
|
4024
|
+
<th>Default</th>
|
|
4025
|
+
|
|
4066
4026
|
|
|
4067
|
-
|
|
4068
|
-
</
|
|
4027
|
+
<th class="last">Description</th>
|
|
4028
|
+
</tr>
|
|
4029
|
+
</thead>
|
|
4069
4030
|
|
|
4031
|
+
<tbody>
|
|
4070
4032
|
|
|
4071
4033
|
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4034
|
+
<tr>
|
|
4035
|
+
|
|
4036
|
+
<td class="name"><code>port</code></td>
|
|
4075
4037
|
|
|
4076
4038
|
|
|
4077
|
-
|
|
4078
|
-
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
|
|
4039
|
+
<td class="type">
|
|
4040
|
+
|
|
4041
|
+
|
|
4042
|
+
<span class="param-type">Integer</span>
|
|
4082
4043
|
|
|
4083
4044
|
|
|
4084
4045
|
|
|
4046
|
+
|
|
4047
|
+
</td>
|
|
4085
4048
|
|
|
4086
|
-
|
|
4087
|
-
|
|
4088
|
-
|
|
4089
|
-
|
|
4090
|
-
|
|
4091
|
-
|
|
4049
|
+
|
|
4050
|
+
<td class="attributes">
|
|
4051
|
+
|
|
4052
|
+
<optional><br>
|
|
4053
|
+
|
|
4092
4054
|
|
|
4093
|
-
|
|
4094
|
-
<dt class="tag-source">Source:</dt>
|
|
4095
|
-
<dd class="tag-source"><ul class="dummy"><li>
|
|
4096
|
-
<a href="utils.mjs.html">utils.mjs</a>, <a href="utils.mjs.html#line73">line 73</a>
|
|
4097
|
-
</li></ul></dd>
|
|
4098
|
-
|
|
4055
|
+
|
|
4099
4056
|
|
|
4100
|
-
|
|
4057
|
+
|
|
4058
|
+
</td>
|
|
4059
|
+
|
|
4101
4060
|
|
|
4102
|
-
|
|
4061
|
+
|
|
4062
|
+
<td class="default">
|
|
4063
|
+
|
|
4064
|
+
<code>22000</code>
|
|
4065
|
+
|
|
4066
|
+
</td>
|
|
4067
|
+
|
|
4103
4068
|
|
|
4104
|
-
|
|
4069
|
+
<td class="description last"><p>輸入服務埠號整數,給0則由系統自動配置(實際埠號見回傳之server.info.port),預設22000</p></td>
|
|
4070
|
+
</tr>
|
|
4105
4071
|
|
|
4106
4072
|
|
|
4107
4073
|
|
|
4108
|
-
|
|
4074
|
+
<tr>
|
|
4075
|
+
|
|
4076
|
+
<td class="name"><code>host</code></td>
|
|
4077
|
+
|
|
4109
4078
|
|
|
4110
|
-
|
|
4079
|
+
<td class="type">
|
|
4080
|
+
|
|
4081
|
+
|
|
4082
|
+
<span class="param-type">String</span>
|
|
4111
4083
|
|
|
4112
|
-
|
|
4113
4084
|
|
|
4114
|
-
|
|
4115
4085
|
|
|
4116
|
-
|
|
4086
|
+
|
|
4087
|
+
</td>
|
|
4117
4088
|
|
|
4118
|
-
|
|
4089
|
+
|
|
4090
|
+
<td class="attributes">
|
|
4091
|
+
|
|
4092
|
+
<optional><br>
|
|
4093
|
+
|
|
4119
4094
|
|
|
4120
|
-
|
|
4095
|
+
|
|
4121
4096
|
|
|
4122
|
-
|
|
4097
|
+
|
|
4098
|
+
</td>
|
|
4099
|
+
|
|
4123
4100
|
|
|
4124
|
-
|
|
4101
|
+
|
|
4102
|
+
<td class="default">
|
|
4103
|
+
|
|
4104
|
+
<code>'0.0.0.0'</code>
|
|
4105
|
+
|
|
4106
|
+
</td>
|
|
4107
|
+
|
|
4125
4108
|
|
|
4126
|
-
|
|
4109
|
+
<td class="description last"><p>輸入監聽位址字串,預設'0.0.0.0'</p></td>
|
|
4110
|
+
</tr>
|
|
4127
4111
|
|
|
4128
4112
|
|
|
4129
|
-
</dl>
|
|
4130
4113
|
|
|
4114
|
+
<tr>
|
|
4115
|
+
|
|
4116
|
+
<td class="name"><code>token</code></td>
|
|
4117
|
+
|
|
4131
4118
|
|
|
4119
|
+
<td class="type">
|
|
4120
|
+
|
|
4121
|
+
|
|
4122
|
+
<span class="param-type">String</span>
|
|
4132
4123
|
|
|
4133
4124
|
|
|
4134
4125
|
|
|
4126
|
+
|
|
4127
|
+
</td>
|
|
4135
4128
|
|
|
4129
|
+
|
|
4130
|
+
<td class="attributes">
|
|
4131
|
+
|
|
4132
|
+
<optional><br>
|
|
4133
|
+
|
|
4136
4134
|
|
|
4135
|
+
|
|
4137
4136
|
|
|
4137
|
+
|
|
4138
|
+
</td>
|
|
4139
|
+
|
|
4138
4140
|
|
|
4141
|
+
|
|
4142
|
+
<td class="default">
|
|
4143
|
+
|
|
4144
|
+
<code>''</code>
|
|
4145
|
+
|
|
4146
|
+
</td>
|
|
4147
|
+
|
|
4139
4148
|
|
|
4149
|
+
<td class="description last"><p>輸入權杖字串,非空時所有/api/*須帶x-api-token標頭,預設''</p></td>
|
|
4150
|
+
</tr>
|
|
4140
4151
|
|
|
4141
|
-
<h5 class="h5-examples">Example</h5>
|
|
4142
4152
|
|
|
4143
|
-
<pre class="prettyprint"><code>let r = await retryBusy(() => fs.promises.readFile('./a.txt', 'utf8'), { tries: 3 })</code></pre>
|
|
4144
4153
|
|
|
4154
|
+
<tr>
|
|
4155
|
+
|
|
4156
|
+
<td class="name"><code>maxMb</code></td>
|
|
4157
|
+
|
|
4145
4158
|
|
|
4159
|
+
<td class="type">
|
|
4160
|
+
|
|
4161
|
+
|
|
4162
|
+
<span class="param-type">Number</span>
|
|
4146
4163
|
|
|
4147
4164
|
|
|
4148
|
-
<h5 class="h5-parameters">Parameters:</h5>
|
|
4149
|
-
|
|
4150
4165
|
|
|
4151
|
-
|
|
4152
|
-
|
|
4153
|
-
<tr>
|
|
4154
|
-
|
|
4155
|
-
<th>Name</th>
|
|
4156
|
-
|
|
4166
|
+
|
|
4167
|
+
</td>
|
|
4157
4168
|
|
|
4158
|
-
|
|
4169
|
+
|
|
4170
|
+
<td class="attributes">
|
|
4171
|
+
|
|
4172
|
+
<optional><br>
|
|
4173
|
+
|
|
4159
4174
|
|
|
4160
|
-
|
|
4161
|
-
<th>Attributes</th>
|
|
4162
|
-
|
|
4175
|
+
|
|
4163
4176
|
|
|
4164
|
-
|
|
4165
|
-
|
|
4166
|
-
|
|
4177
|
+
|
|
4178
|
+
</td>
|
|
4179
|
+
|
|
4167
4180
|
|
|
4168
|
-
|
|
4169
|
-
|
|
4170
|
-
|
|
4181
|
+
|
|
4182
|
+
<td class="default">
|
|
4183
|
+
|
|
4184
|
+
<code>256</code>
|
|
4185
|
+
|
|
4186
|
+
</td>
|
|
4187
|
+
|
|
4188
|
+
|
|
4189
|
+
<td class="description last"><p>輸入請求大小上限數字,單位MB,預設256</p></td>
|
|
4190
|
+
</tr>
|
|
4171
4191
|
|
|
4172
|
-
<tbody>
|
|
4173
4192
|
|
|
4174
4193
|
|
|
4175
4194
|
<tr>
|
|
4176
4195
|
|
|
4177
|
-
<td class="name"><code>
|
|
4196
|
+
<td class="name"><code>dirTemplates</code></td>
|
|
4178
4197
|
|
|
4179
4198
|
|
|
4180
4199
|
<td class="type">
|
|
4181
4200
|
|
|
4182
4201
|
|
|
4183
|
-
<span class="param-type">
|
|
4202
|
+
<span class="param-type">String</span>
|
|
4184
4203
|
|
|
4185
4204
|
|
|
4186
4205
|
|
|
@@ -4190,6 +4209,8 @@ console.log(r)
|
|
|
4190
4209
|
|
|
4191
4210
|
<td class="attributes">
|
|
4192
4211
|
|
|
4212
|
+
<optional><br>
|
|
4213
|
+
|
|
4193
4214
|
|
|
4194
4215
|
|
|
4195
4216
|
|
|
@@ -4200,23 +4221,25 @@ console.log(r)
|
|
|
4200
4221
|
|
|
4201
4222
|
<td class="default">
|
|
4202
4223
|
|
|
4224
|
+
<code>''</code>
|
|
4225
|
+
|
|
4203
4226
|
</td>
|
|
4204
4227
|
|
|
4205
4228
|
|
|
4206
|
-
<td class="description last"><p
|
|
4229
|
+
<td class="description last"><p>輸入docx模板資料夾位置字串,未給則用本套件src/templates,預設''</p></td>
|
|
4207
4230
|
</tr>
|
|
4208
4231
|
|
|
4209
4232
|
|
|
4210
4233
|
|
|
4211
4234
|
<tr>
|
|
4212
4235
|
|
|
4213
|
-
<td class="name"><code>
|
|
4236
|
+
<td class="name"><code>dirWork</code></td>
|
|
4214
4237
|
|
|
4215
4238
|
|
|
4216
4239
|
<td class="type">
|
|
4217
4240
|
|
|
4218
4241
|
|
|
4219
|
-
<span class="param-type">
|
|
4242
|
+
<span class="param-type">String</span>
|
|
4220
4243
|
|
|
4221
4244
|
|
|
4222
4245
|
|
|
@@ -4238,48 +4261,25 @@ console.log(r)
|
|
|
4238
4261
|
|
|
4239
4262
|
<td class="default">
|
|
4240
4263
|
|
|
4241
|
-
<code>
|
|
4264
|
+
<code>''</code>
|
|
4242
4265
|
|
|
4243
4266
|
</td>
|
|
4244
4267
|
|
|
4245
4268
|
|
|
4246
|
-
<td class="description last"><p
|
|
4247
|
-
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
-
<table class="params">
|
|
4251
|
-
<thead>
|
|
4252
|
-
<tr>
|
|
4253
|
-
|
|
4254
|
-
<th>Name</th>
|
|
4255
|
-
|
|
4256
|
-
|
|
4257
|
-
<th>Type</th>
|
|
4258
|
-
|
|
4259
|
-
|
|
4260
|
-
<th>Attributes</th>
|
|
4261
|
-
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
<th>Default</th>
|
|
4265
|
-
|
|
4266
|
-
|
|
4267
|
-
<th class="last">Description</th>
|
|
4268
|
-
</tr>
|
|
4269
|
-
</thead>
|
|
4269
|
+
<td class="description last"><p>輸入工作資料夾位置字串,未給則用系統暫存夾下之w-md2docx,預設''</p></td>
|
|
4270
|
+
</tr>
|
|
4270
4271
|
|
|
4271
|
-
<tbody>
|
|
4272
4272
|
|
|
4273
4273
|
|
|
4274
4274
|
<tr>
|
|
4275
4275
|
|
|
4276
|
-
<td class="name"><code>
|
|
4276
|
+
<td class="name"><code>templateDef</code></td>
|
|
4277
4277
|
|
|
4278
4278
|
|
|
4279
4279
|
<td class="type">
|
|
4280
4280
|
|
|
4281
4281
|
|
|
4282
|
-
<span class="param-type">
|
|
4282
|
+
<span class="param-type">String</span>
|
|
4283
4283
|
|
|
4284
4284
|
|
|
4285
4285
|
|
|
@@ -4301,25 +4301,25 @@ console.log(r)
|
|
|
4301
4301
|
|
|
4302
4302
|
<td class="default">
|
|
4303
4303
|
|
|
4304
|
-
<code>
|
|
4304
|
+
<code>'temp_tpc.docx'</code>
|
|
4305
4305
|
|
|
4306
4306
|
</td>
|
|
4307
4307
|
|
|
4308
4308
|
|
|
4309
|
-
<td class="description last"><p
|
|
4309
|
+
<td class="description last"><p>輸入預設模板檔名字串,預設'temp_tpc.docx'</p></td>
|
|
4310
4310
|
</tr>
|
|
4311
4311
|
|
|
4312
4312
|
|
|
4313
4313
|
|
|
4314
4314
|
<tr>
|
|
4315
4315
|
|
|
4316
|
-
<td class="name"><code>
|
|
4316
|
+
<td class="name"><code>autoStart</code></td>
|
|
4317
4317
|
|
|
4318
4318
|
|
|
4319
4319
|
<td class="type">
|
|
4320
4320
|
|
|
4321
4321
|
|
|
4322
|
-
<span class="param-type">
|
|
4322
|
+
<span class="param-type">Boolean</span>
|
|
4323
4323
|
|
|
4324
4324
|
|
|
4325
4325
|
|
|
@@ -4341,12 +4341,12 @@ console.log(r)
|
|
|
4341
4341
|
|
|
4342
4342
|
<td class="default">
|
|
4343
4343
|
|
|
4344
|
-
<code>
|
|
4344
|
+
<code>true</code>
|
|
4345
4345
|
|
|
4346
4346
|
</td>
|
|
4347
4347
|
|
|
4348
4348
|
|
|
4349
|
-
<td class="description last"><p
|
|
4349
|
+
<td class="description last"><p>輸入是否立即啟動服務布林值,預設true</p></td>
|
|
4350
4350
|
</tr>
|
|
4351
4351
|
|
|
4352
4352
|
|
|
@@ -4379,7 +4379,7 @@ console.log(r)
|
|
|
4379
4379
|
|
|
4380
4380
|
|
|
4381
4381
|
<div class="param-desc">
|
|
4382
|
-
<p>回傳Promise,resolve回傳
|
|
4382
|
+
<p>回傳Promise,resolve回傳{server,settings,getState,stop},其中server為hapi實例,getState為取環境狀態之async函數,stop為停止服務之async函數,reject回傳錯誤訊息</p>
|
|
4383
4383
|
</div>
|
|
4384
4384
|
|
|
4385
4385
|
|
|
@@ -4587,7 +4587,7 @@ console.log(r)
|
|
|
4587
4587
|
|
|
4588
4588
|
<dt class="tag-source">Source:</dt>
|
|
4589
4589
|
<dd class="tag-source"><ul class="dummy"><li>
|
|
4590
|
-
<a href="
|
|
4590
|
+
<a href="rmApiClient.mjs.html">rmApiClient.mjs</a>, <a href="rmApiClient.mjs.html#line81">line 81</a>
|
|
4591
4591
|
</li></ul></dd>
|
|
4592
4592
|
|
|
4593
4593
|
|
|
@@ -5440,7 +5440,7 @@ console.log(toSafeName(''))
|
|
|
5440
5440
|
<br class="clear">
|
|
5441
5441
|
|
|
5442
5442
|
<footer>
|
|
5443
|
-
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on
|
|
5443
|
+
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Wed Sep 02 2026 16:38:11 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
|
|
5444
5444
|
</footer>
|
|
5445
5445
|
|
|
5446
5446
|
<script>prettyPrint();</script>
|