wsemi 1.8.85 → 1.8.86

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.
Files changed (484) hide show
  1. package/README.md +1 -1
  2. package/dist/wsemi.umd.js +2 -2
  3. package/dist/wsemi.umd.js.map +1 -1
  4. package/docs/-_class.mjs.html +1 -1
  5. package/docs/ab2blob.mjs.html +1 -1
  6. package/docs/ab2u8arr.mjs.html +1 -1
  7. package/docs/addExcelWorksheetFromData.mjs.html +1 -1
  8. package/docs/addMonth.mjs.html +1 -1
  9. package/docs/aes2str.mjs.html +1 -1
  10. package/docs/alive.mjs.html +1 -1
  11. package/docs/arr2dt.mjs.html +1 -1
  12. package/docs/arrAccum.mjs.html +1 -1
  13. package/docs/arrAdd.mjs.html +1 -1
  14. package/docs/arrAt.mjs.html +1 -1
  15. package/docs/arrDiff.mjs.html +1 -1
  16. package/docs/arrFilterByKeywords.mjs.html +1 -1
  17. package/docs/arrFilterByNum.mjs.html +1 -1
  18. package/docs/arrFilterByPnum.mjs.html +1 -1
  19. package/docs/arrFilterByPnumAndToLog.mjs.html +1 -1
  20. package/docs/arrFind.mjs.html +1 -1
  21. package/docs/arrGroupByMaxmin.mjs.html +1 -1
  22. package/docs/arrHas.mjs.html +1 -1
  23. package/docs/arrInsert.mjs.html +1 -1
  24. package/docs/arrLookupByMaxmin.mjs.html +1 -1
  25. package/docs/arrMax.mjs.html +1 -1
  26. package/docs/arrMin.mjs.html +1 -1
  27. package/docs/arrMulti.mjs.html +1 -1
  28. package/docs/arrNorm.mjs.html +1 -1
  29. package/docs/arrProduct.mjs.html +1 -1
  30. package/docs/arrPull.mjs.html +1 -1
  31. package/docs/arrPullAt.mjs.html +1 -1
  32. package/docs/arrReduce.mjs.html +1 -1
  33. package/docs/arrReverse.mjs.html +1 -1
  34. package/docs/arrSep.mjs.html +1 -1
  35. package/docs/arrSort.mjs.html +1 -1
  36. package/docs/asind.mjs.html +1 -1
  37. package/docs/atan2d.mjs.html +1 -1
  38. package/docs/atand.mjs.html +1 -1
  39. package/docs/attstr.mjs.html +1 -1
  40. package/docs/b642obj.mjs.html +1 -1
  41. package/docs/b642str.mjs.html +1 -1
  42. package/docs/b642u16arr.mjs.html +1 -1
  43. package/docs/b642u8arr.mjs.html +1 -1
  44. package/docs/binstr.mjs.html +1 -1
  45. package/docs/blob2ab.mjs.html +1 -1
  46. package/docs/blob2b64.mjs.html +1 -1
  47. package/docs/blob2str.mjs.html +1 -1
  48. package/docs/blob2u8arr.mjs.html +1 -1
  49. package/docs/blobs2b64s.mjs.html +1 -1
  50. package/docs/blobs2u8arrs.mjs.html +1 -1
  51. package/docs/bodyLog.mjs.html +1 -1
  52. package/docs/browserView.mjs.html +1 -1
  53. package/docs/browserViewFromBlob.mjs.html +1 -1
  54. package/docs/browserViewFromText.mjs.html +1 -1
  55. package/docs/browserViewFromU8arr.mjs.html +1 -1
  56. package/docs/bs2u8arr.mjs.html +1 -1
  57. package/docs/bufRead.mjs.html +1 -1
  58. package/docs/bufReadDbl.mjs.html +1 -1
  59. package/docs/bufWrite.mjs.html +1 -1
  60. package/docs/bufWriteDbl.mjs.html +1 -1
  61. package/docs/cache.mjs.html +1 -1
  62. package/docs/cacheBd.mjs.html +1 -1
  63. package/docs/cacheSt.mjs.html +1 -1
  64. package/docs/cbol.mjs.html +1 -1
  65. package/docs/cdbl.mjs.html +1 -1
  66. package/docs/ceil.mjs.html +1 -1
  67. package/docs/cfilesize.mjs.html +1 -1
  68. package/docs/cfinancial.mjs.html +1 -1
  69. package/docs/cint.mjs.html +1 -1
  70. package/docs/clearXSS.mjs.html +1 -1
  71. package/docs/clearXSSDyn.mjs.html +1 -1
  72. package/docs/color.mjs.html +1 -1
  73. package/docs/composeToTree.mjs.html +1 -1
  74. package/docs/convertToTree.mjs.html +1 -1
  75. package/docs/copyStrToClipboard.mjs.html +1 -1
  76. package/docs/cosd.mjs.html +1 -1
  77. package/docs/cotd.mjs.html +1 -1
  78. package/docs/createExcelWorkbook.mjs.html +1 -1
  79. package/docs/cscd.mjs.html +1 -1
  80. package/docs/cstr.mjs.html +1 -1
  81. package/docs/day2cht.mjs.html +1 -1
  82. package/docs/debounce.mjs.html +1 -1
  83. package/docs/delay.mjs.html +1 -1
  84. package/docs/dig.mjs.html +1 -1
  85. package/docs/digExp.mjs.html +1 -1
  86. package/docs/domAlert.mjs.html +1 -1
  87. package/docs/domAppend.mjs.html +1 -1
  88. package/docs/domCancelEvent.mjs.html +1 -1
  89. package/docs/domCompareText.mjs.html +1 -1
  90. package/docs/domConvertToPic.mjs.html +1 -1
  91. package/docs/domConvertToPicDyn.mjs.html +1 -1
  92. package/docs/domDetect.mjs.html +1 -1
  93. package/docs/domDrag.mjs.html +1 -1
  94. package/docs/domDragBarAndScroll.mjs.html +1 -1
  95. package/docs/domDragPreview.mjs.html +1 -1
  96. package/docs/domDropFiles.mjs.html +1 -1
  97. package/docs/domElementsFromPoint.mjs.html +1 -1
  98. package/docs/domFadeIn.mjs.html +1 -1
  99. package/docs/domFadeOut.mjs.html +1 -1
  100. package/docs/domFind.mjs.html +1 -1
  101. package/docs/domFinds.mjs.html +1 -1
  102. package/docs/domGetAttr.mjs.html +1 -1
  103. package/docs/domGetBoudRect.mjs.html +1 -1
  104. package/docs/domGetBoudRectRefSelf.mjs.html +1 -1
  105. package/docs/domGetFileAccept.mjs.html +1 -1
  106. package/docs/domGetFiles.mjs.html +1 -1
  107. package/docs/domGetParents.mjs.html +1 -1
  108. package/docs/domGetPointFromEvent.mjs.html +1 -1
  109. package/docs/domGetScrollableParent.mjs.html +1 -1
  110. package/docs/domGetWindowSize.mjs.html +1 -1
  111. package/docs/domIsClientXYIn.mjs.html +1 -1
  112. package/docs/domIsFocused.mjs.html +1 -1
  113. package/docs/domIsStable.mjs.html +1 -1
  114. package/docs/domIsVisible.mjs.html +1 -1
  115. package/docs/domPrepend.mjs.html +1 -1
  116. package/docs/domRemove.mjs.html +1 -1
  117. package/docs/domRenderMarkdownMind.mjs.html +1 -1
  118. package/docs/domRenderMarkdownMindDyn.mjs.html +1 -1
  119. package/docs/domRipple.mjs.html +1 -1
  120. package/docs/domScrollIntoView.mjs.html +1 -1
  121. package/docs/domScrollTo.mjs.html +1 -1
  122. package/docs/domSetAttr.mjs.html +1 -1
  123. package/docs/domShowImages.mjs.html +1 -1
  124. package/docs/domShowImagesDyn.mjs.html +1 -1
  125. package/docs/domShowInputAndGetFiles.mjs.html +1 -1
  126. package/docs/domShowInputAndGetFilesU8Arrs.mjs.html +1 -1
  127. package/docs/domShowInputDatatime.mjs.html +1 -1
  128. package/docs/domTooltip.mjs.html +1 -1
  129. package/docs/domTriggerEvent.mjs.html +1 -1
  130. package/docs/domVirtualCreate.mjs.html +1 -1
  131. package/docs/domVirtualCreateQueue.mjs.html +1 -1
  132. package/docs/downloadExcelFileFromData.mjs.html +1 -1
  133. package/docs/downloadExcelFileFromDataDyn.mjs.html +1 -1
  134. package/docs/downloadFileFromB64.mjs.html +1 -1
  135. package/docs/downloadFileFromBlob.mjs.html +1 -1
  136. package/docs/downloadFileFromText.mjs.html +1 -1
  137. package/docs/downloadFileFromU8Arr.mjs.html +1 -1
  138. package/docs/dtmapping.mjs.html +1 -1
  139. package/docs/dtpick.mjs.html +1 -1
  140. package/docs/estimateTicks.mjs.html +1 -1
  141. package/docs/evem.mjs.html +1 -1
  142. package/docs/examples/ex-blob2b64.html +1 -1
  143. package/docs/examples/ex-clearXSS.html +1 -1
  144. package/docs/examples/ex-clearXSSDyn.html +1 -1
  145. package/docs/examples/ex-colorConverter.html +1 -1
  146. package/docs/examples/ex-domCompareText.html +1 -1
  147. package/docs/examples/ex-domConvertToPic.html +1 -1
  148. package/docs/examples/ex-domDrag.html +1 -1
  149. package/docs/examples/ex-domDropFiles.html +1 -1
  150. package/docs/examples/ex-domIsVisible.html +1 -1
  151. package/docs/examples/ex-domRenderMarkdownMind.html +1 -1
  152. package/docs/examples/ex-domRenderMarkdownMindDyn.html +1 -1
  153. package/docs/examples/ex-domRipple.html +1 -1
  154. package/docs/examples/ex-domScrollIntoView.html +1 -1
  155. package/docs/examples/ex-domScrollTo.html +1 -1
  156. package/docs/examples/ex-domShowImages.html +1 -1
  157. package/docs/examples/ex-domShowImagesDyn.html +1 -1
  158. package/docs/examples/ex-domShowInputAndGetFiles.html +1 -1
  159. package/docs/examples/ex-domTooltip.html +1 -1
  160. package/docs/examples/ex-getFileHash.html +1 -1
  161. package/docs/examples/ex-getUserAgent.html +1 -1
  162. package/docs/examples/ex-getUserAgentDyn.html +1 -1
  163. package/docs/examples/ex-html2str.html +1 -1
  164. package/docs/examples/ex-obj2u8arr-u8arr2obj.html +1 -1
  165. package/docs/examples/ex-openLink.html +1 -1
  166. package/docs/examples/ex-str2aes-aes2str.html +1 -1
  167. package/docs/examples/ex-str2b64-b642str.html +1 -1
  168. package/docs/examples/ex-strFindFuzz.html +1 -1
  169. package/docs/examples/ex-timeTZ2expire-timeTZ2past.html +1 -1
  170. package/docs/examples/ex-xlsx.html +1 -1
  171. package/docs/execCli.mjs.html +1 -1
  172. package/docs/execCliCore.mjs.html +1 -1
  173. package/docs/execCliJsonRpc.mjs.html +1 -1
  174. package/docs/execCliSession.mjs.html +1 -1
  175. package/docs/execJsCode.mjs.html +1 -1
  176. package/docs/execProcess.mjs.html +1 -1
  177. package/docs/execProcessKillPid.mjs.html +1 -1
  178. package/docs/filepathToTree.mjs.html +1 -1
  179. package/docs/files2data.mjs.html +1 -1
  180. package/docs/flattenToConn.mjs.html +1 -1
  181. package/docs/flattenTree.mjs.html +1 -1
  182. package/docs/floor.mjs.html +1 -1
  183. package/docs/fsBuildReadStreamText.mjs.html +1 -1
  184. package/docs/fsBuildWriteStreamText.mjs.html +1 -1
  185. package/docs/fsCleanFolder.mjs.html +1 -1
  186. package/docs/fsCleanFolderCore.mjs.html +1 -1
  187. package/docs/fsCopyFile.mjs.html +1 -1
  188. package/docs/fsCopyFileCore.mjs.html +1 -1
  189. package/docs/fsCopyFolder.mjs.html +1 -1
  190. package/docs/fsCopyFolderCore.mjs.html +1 -1
  191. package/docs/fsCreateFile.mjs.html +1 -1
  192. package/docs/fsCreateFileCore.mjs.html +1 -1
  193. package/docs/fsCreateFolder.mjs.html +1 -1
  194. package/docs/fsCreateFolderCore.mjs.html +1 -1
  195. package/docs/fsDeleteFile.mjs.html +1 -1
  196. package/docs/fsDeleteFileCore.mjs.html +1 -1
  197. package/docs/fsDeleteFileSafe.mjs.html +1 -1
  198. package/docs/fsDeleteFileSafeCore.mjs.html +1 -1
  199. package/docs/fsDeleteFolder.mjs.html +1 -1
  200. package/docs/fsDeleteFolderCore.mjs.html +1 -1
  201. package/docs/fsDeleteFolderSafe.mjs.html +1 -1
  202. package/docs/fsDeleteFolderSafeCore.mjs.html +1 -1
  203. package/docs/fsDownloadFile.mjs.html +1 -1
  204. package/docs/fsDownloadFileCore.mjs.html +1 -1
  205. package/docs/fsEvem.mjs.html +1 -1
  206. package/docs/fsExists.mjs.html +1 -1
  207. package/docs/fsExistsCore.mjs.html +1 -1
  208. package/docs/fsGetFileBasicHash.mjs.html +1 -1
  209. package/docs/fsGetFileBasicHashCore.mjs.html +1 -1
  210. package/docs/fsGetFileHash.mjs.html +1 -1
  211. package/docs/fsGetFileHashCore.mjs.html +1 -1
  212. package/docs/fsGetFileXxHash.mjs.html +1 -1
  213. package/docs/fsGetFileXxHashCore.mjs.html +1 -1
  214. package/docs/fsGetFilesInFolder.mjs.html +1 -1
  215. package/docs/fsGetFilesInFolderCore.mjs.html +1 -1
  216. package/docs/fsGetFilesWithHashInFolder.mjs.html +1 -1
  217. package/docs/fsGetFilesWithHashInFolderCore.mjs.html +1 -1
  218. package/docs/fsGetFolderBasicHash.mjs.html +1 -1
  219. package/docs/fsGetFolderBasicHashCore.mjs.html +1 -1
  220. package/docs/fsGetFoldersInFolder.mjs.html +1 -1
  221. package/docs/fsGetFoldersInFolderCore.mjs.html +1 -1
  222. package/docs/fsIsFile.mjs.html +1 -1
  223. package/docs/fsIsFileCore.mjs.html +1 -1
  224. package/docs/fsIsFolder.mjs.html +1 -1
  225. package/docs/fsIsFolderCore.mjs.html +1 -1
  226. package/docs/fsMergeFiles.mjs.html +1 -1
  227. package/docs/fsMergeFilesCore.mjs.html +100 -48
  228. package/docs/fsReadJson.mjs.html +1 -1
  229. package/docs/fsReadText.mjs.html +1 -1
  230. package/docs/fsReadTextCore.mjs.html +1 -1
  231. package/docs/fsRenameFile.mjs.html +1 -1
  232. package/docs/fsRenameFileCore.mjs.html +1 -1
  233. package/docs/fsRenameFolder.mjs.html +1 -1
  234. package/docs/fsRenameFolderCore.mjs.html +1 -1
  235. package/docs/fsSrlog.mjs.html +1 -1
  236. package/docs/fsSyncFolder.mjs.html +1 -1
  237. package/docs/fsSyncFolderCore.mjs.html +1 -1
  238. package/docs/fsTask.mjs.html +1 -1
  239. package/docs/fsTaskCp.mjs.html +1 -1
  240. package/docs/fsTreeFolder.mjs.html +1 -1
  241. package/docs/fsTreeFolderCore.mjs.html +1 -1
  242. package/docs/fsTreeFolderWithHash.mjs.html +1 -1
  243. package/docs/fsTreeFolderWithHashCore.mjs.html +1 -1
  244. package/docs/fsWatchFile.mjs.html +1 -1
  245. package/docs/fsWatchFolder.mjs.html +1 -1
  246. package/docs/fsWriteJson.mjs.html +1 -1
  247. package/docs/fsWriteText.mjs.html +1 -1
  248. package/docs/fsWriteTextCore.mjs.html +1 -1
  249. package/docs/genGradientColor.mjs.html +1 -1
  250. package/docs/genID.mjs.html +1 -1
  251. package/docs/genIDSeq.mjs.html +1 -1
  252. package/docs/genPm.mjs.html +1 -1
  253. package/docs/getBufferSize.mjs.html +1 -1
  254. package/docs/getClearPathName.mjs.html +1 -1
  255. package/docs/getCsvStrFromData.mjs.html +1 -1
  256. package/docs/getDataFromExcelFileU8Arr.mjs.html +1 -1
  257. package/docs/getDataFromExcelFileU8ArrDyn.mjs.html +1 -1
  258. package/docs/getEnv.mjs.html +1 -1
  259. package/docs/getErrorMessage.mjs.html +1 -1
  260. package/docs/getExcelU8ArrFromData.mjs.html +1 -1
  261. package/docs/getExcelU8ArrFromWorkbook.mjs.html +1 -1
  262. package/docs/getExcelWorkbookFromData.mjs.html +1 -1
  263. package/docs/getExcelWorkbookFromWorksheet.mjs.html +1 -1
  264. package/docs/getExcelWorksheetFromData.mjs.html +1 -1
  265. package/docs/getFileAccept.mjs.html +1 -1
  266. package/docs/getFileBasicHash.mjs.html +1 -1
  267. package/docs/getFileHash.mjs.html +1 -1
  268. package/docs/getFileName.mjs.html +1 -1
  269. package/docs/getFileNameExt.mjs.html +1 -1
  270. package/docs/getFileTrueName.mjs.html +1 -1
  271. package/docs/getFileType.mjs.html +1 -1
  272. package/docs/getFileXxHash.mjs.html +1 -1
  273. package/docs/getGlobal.mjs.html +1 -1
  274. package/docs/getObjSize.mjs.html +1 -1
  275. package/docs/getPathParent.mjs.html +1 -1
  276. package/docs/getTimeBetween.mjs.html +1 -1
  277. package/docs/getTimeFromUnit.mjs.html +1 -1
  278. package/docs/getTimeHp.mjs.html +1 -1
  279. package/docs/getTimeObject.mjs.html +1 -1
  280. package/docs/getTimeRange.mjs.html +1 -1
  281. package/docs/getUserAgent.mjs.html +1 -1
  282. package/docs/getUserAgentDyn.mjs.html +1 -1
  283. package/docs/getltdtkeys.mjs.html +1 -1
  284. package/docs/global.html +1 -1
  285. package/docs/haskey.mjs.html +1 -1
  286. package/docs/html2str.mjs.html +1 -1
  287. package/docs/htmlDecode.mjs.html +1 -1
  288. package/docs/htmlEncode.mjs.html +1 -1
  289. package/docs/importResources.mjs.html +1 -1
  290. package/docs/index.html +1 -1
  291. package/docs/interp1.mjs.html +1 -1
  292. package/docs/isDate.mjs.html +1 -1
  293. package/docs/isDev.mjs.html +1 -1
  294. package/docs/isEle.mjs.html +1 -1
  295. package/docs/isEleExistByID.mjs.html +1 -1
  296. package/docs/isEmail.mjs.html +1 -1
  297. package/docs/isErr.mjs.html +1 -1
  298. package/docs/isIE.mjs.html +1 -1
  299. package/docs/isNarrow.mjs.html +1 -1
  300. package/docs/isStrHasCapital.mjs.html +1 -1
  301. package/docs/isStrHasLetter.mjs.html +1 -1
  302. package/docs/isStrHasLowerCase.mjs.html +1 -1
  303. package/docs/isStrHasNumber.mjs.html +1 -1
  304. package/docs/isStrHasSpace.mjs.html +1 -1
  305. package/docs/isStrHasSymbol.mjs.html +1 -1
  306. package/docs/isUserIdentify.mjs.html +1 -1
  307. package/docs/isUserName.mjs.html +1 -1
  308. package/docs/isUserPw.mjs.html +1 -1
  309. package/docs/isWindow.mjs.html +1 -1
  310. package/docs/isab.mjs.html +1 -1
  311. package/docs/isarr.mjs.html +1 -1
  312. package/docs/isarr0.mjs.html +1 -1
  313. package/docs/isbigint.mjs.html +1 -1
  314. package/docs/isblob.mjs.html +1 -1
  315. package/docs/isbol.mjs.html +1 -1
  316. package/docs/isday.mjs.html +1 -1
  317. package/docs/isearr.mjs.html +1 -1
  318. package/docs/iseobj.mjs.html +1 -1
  319. package/docs/iser.mjs.html +1 -1
  320. package/docs/isernot.mjs.html +1 -1
  321. package/docs/isestr.mjs.html +1 -1
  322. package/docs/isfile.mjs.html +1 -1
  323. package/docs/isfun.mjs.html +1 -1
  324. package/docs/isint.mjs.html +1 -1
  325. package/docs/ismonth.mjs.html +1 -1
  326. package/docs/isn0int.mjs.html +1 -1
  327. package/docs/isn0num.mjs.html +1 -1
  328. package/docs/isnan.mjs.html +1 -1
  329. package/docs/isnbr.mjs.html +1 -1
  330. package/docs/isnint.mjs.html +1 -1
  331. package/docs/isnnum.mjs.html +1 -1
  332. package/docs/isnull.mjs.html +1 -1
  333. package/docs/isnum.mjs.html +1 -1
  334. package/docs/isobj.mjs.html +1 -1
  335. package/docs/isobj0.mjs.html +1 -1
  336. package/docs/isp0int.mjs.html +1 -1
  337. package/docs/isp0num.mjs.html +1 -1
  338. package/docs/ispint.mjs.html +1 -1
  339. package/docs/ispm.mjs.html +1 -1
  340. package/docs/ispnum.mjs.html +1 -1
  341. package/docs/isstr.mjs.html +1 -1
  342. package/docs/isstr0.mjs.html +1 -1
  343. package/docs/istime.mjs.html +1 -1
  344. package/docs/istimeTZ.mjs.html +1 -1
  345. package/docs/istimems.mjs.html +1 -1
  346. package/docs/istimemsTZ.mjs.html +1 -1
  347. package/docs/isu16arr.mjs.html +1 -1
  348. package/docs/isu8arr.mjs.html +1 -1
  349. package/docs/isundefined.mjs.html +1 -1
  350. package/docs/j2o.mjs.html +1 -1
  351. package/docs/judge.mjs.html +1 -1
  352. package/docs/keysmat2ltdt.mjs.html +1 -1
  353. package/docs/ltdt2vrtsable.mjs.html +1 -1
  354. package/docs/ltdtDiff.mjs.html +1 -1
  355. package/docs/ltdtDiffByKey.mjs.html +1 -1
  356. package/docs/ltdtkeys2mat.mjs.html +1 -1
  357. package/docs/ltdtkeysheads2mat.mjs.html +1 -1
  358. package/docs/ltdtmapping.mjs.html +1 -1
  359. package/docs/ltdtmerge.mjs.html +1 -1
  360. package/docs/ltdtpick.mjs.html +1 -1
  361. package/docs/ltdtpull.mjs.html +1 -1
  362. package/docs/mat2ltdt.mjs.html +1 -1
  363. package/docs/matConcat.mjs.html +1 -1
  364. package/docs/matDiff.mjs.html +1 -1
  365. package/docs/matat.mjs.html +1 -1
  366. package/docs/now2str.mjs.html +1 -1
  367. package/docs/now2strp.mjs.html +1 -1
  368. package/docs/nowDay2str.mjs.html +1 -1
  369. package/docs/nowms2str.mjs.html +1 -1
  370. package/docs/nowms2strp.mjs.html +1 -1
  371. package/docs/o2j.mjs.html +1 -1
  372. package/docs/obj2b64.mjs.html +1 -1
  373. package/docs/obj2pb64.mjs.html +1 -1
  374. package/docs/obj2str.mjs.html +1 -1
  375. package/docs/obj2stru8arr.mjs.html +1 -1
  376. package/docs/obj2u8arr.mjs.html +1 -1
  377. package/docs/objSortBy.mjs.html +1 -1
  378. package/docs/objSortByKeys.mjs.html +1 -1
  379. package/docs/oo.mjs.html +1 -1
  380. package/docs/openLink.mjs.html +1 -1
  381. package/docs/pb642obj.mjs.html +1 -1
  382. package/docs/pmChain.mjs.html +1 -1
  383. package/docs/pmConvertResolve.mjs.html +1 -1
  384. package/docs/pmDebounce.mjs.html +1 -1
  385. package/docs/pmHook.mjs.html +1 -1
  386. package/docs/pmHookReject.mjs.html +1 -1
  387. package/docs/pmIni.mjs.html +1 -1
  388. package/docs/pmInvResolve.mjs.html +1 -1
  389. package/docs/pmKeyMutex.mjs.html +1 -1
  390. package/docs/pmMap.mjs.html +1 -1
  391. package/docs/pmQueue.mjs.html +1 -1
  392. package/docs/pmSeries.mjs.html +1 -1
  393. package/docs/pmThrottle.mjs.html +1 -1
  394. package/docs/pmTimeout.mjs.html +1 -1
  395. package/docs/preciseNum.mjs.html +1 -1
  396. package/docs/pseudoRandom.mjs.html +1 -1
  397. package/docs/pseudoRandomIntRange.mjs.html +1 -1
  398. package/docs/pseudoRandomIntsNdpRange.mjs.html +1 -1
  399. package/docs/pseudoRandomIntsRange.mjs.html +1 -1
  400. package/docs/pseudoRandomRange.mjs.html +1 -1
  401. package/docs/pseudoRandomsRange.mjs.html +1 -1
  402. package/docs/queue.mjs.html +1 -1
  403. package/docs/random.mjs.html +1 -1
  404. package/docs/randomIntRange.mjs.html +1 -1
  405. package/docs/randomIntsNdpRange.mjs.html +1 -1
  406. package/docs/randomIntsRange.mjs.html +1 -1
  407. package/docs/randomRange.mjs.html +1 -1
  408. package/docs/randomsRange.mjs.html +1 -1
  409. package/docs/rang.mjs.html +1 -1
  410. package/docs/rep.mjs.html +1 -1
  411. package/docs/repObj.mjs.html +1 -1
  412. package/docs/replace.mjs.html +1 -1
  413. package/docs/replaceObj.mjs.html +1 -1
  414. package/docs/replacePlus.mjs.html +1 -1
  415. package/docs/round.mjs.html +1 -1
  416. package/docs/secd.mjs.html +1 -1
  417. package/docs/sep.mjs.html +1 -1
  418. package/docs/sepInt.mjs.html +1 -1
  419. package/docs/setIntervalHp.mjs.html +1 -1
  420. package/docs/setTimeoutHp.mjs.html +1 -1
  421. package/docs/sind.mjs.html +1 -1
  422. package/docs/split.mjs.html +1 -1
  423. package/docs/str2aes.mjs.html +1 -1
  424. package/docs/str2b64.mjs.html +1 -1
  425. package/docs/str2hint.mjs.html +1 -1
  426. package/docs/str2md5.mjs.html +1 -1
  427. package/docs/str2obj.mjs.html +1 -1
  428. package/docs/str2sha.mjs.html +1 -1
  429. package/docs/str2sha512.mjs.html +1 -1
  430. package/docs/str2u8arr.mjs.html +1 -1
  431. package/docs/strCompare.mjs.html +1 -1
  432. package/docs/strCompareForVersion.mjs.html +1 -1
  433. package/docs/strDiff.mjs.html +1 -1
  434. package/docs/strDiffToHtml.mjs.html +1 -1
  435. package/docs/strFindFuzz.mjs.html +1 -1
  436. package/docs/strFindSimilar.mjs.html +1 -1
  437. package/docs/strTruncate.mjs.html +1 -1
  438. package/docs/strdelleft.mjs.html +1 -1
  439. package/docs/strdelright.mjs.html +1 -1
  440. package/docs/strleft.mjs.html +1 -1
  441. package/docs/strmid.mjs.html +1 -1
  442. package/docs/strright.mjs.html +1 -1
  443. package/docs/stru8arr2obj.mjs.html +1 -1
  444. package/docs/tand.mjs.html +1 -1
  445. package/docs/time2day.mjs.html +1 -1
  446. package/docs/time2hour.mjs.html +1 -1
  447. package/docs/time2min.mjs.html +1 -1
  448. package/docs/timeTZ2day.mjs.html +1 -1
  449. package/docs/timeTZ2expire.mjs.html +1 -1
  450. package/docs/timeTZ2hour.mjs.html +1 -1
  451. package/docs/timeTZ2min.mjs.html +1 -1
  452. package/docs/timeTZ2past.mjs.html +1 -1
  453. package/docs/timems2day.mjs.html +1 -1
  454. package/docs/timems2hour.mjs.html +1 -1
  455. package/docs/timems2min.mjs.html +1 -1
  456. package/docs/timems2time.mjs.html +1 -1
  457. package/docs/timemsTZ2day.mjs.html +1 -1
  458. package/docs/timemsTZ2expire.mjs.html +1 -1
  459. package/docs/timemsTZ2hour.mjs.html +1 -1
  460. package/docs/timemsTZ2min.mjs.html +1 -1
  461. package/docs/timemsTZ2past.mjs.html +1 -1
  462. package/docs/timemsTZ2time.mjs.html +1 -1
  463. package/docs/treeObj.mjs.html +1 -1
  464. package/docs/treeToFilepath.mjs.html +1 -1
  465. package/docs/trim.mjs.html +1 -1
  466. package/docs/u16arr2b64.mjs.html +1 -1
  467. package/docs/u16arr2u8arr.mjs.html +1 -1
  468. package/docs/u8arr2ab.mjs.html +1 -1
  469. package/docs/u8arr2b64.mjs.html +1 -1
  470. package/docs/u8arr2blob.mjs.html +1 -1
  471. package/docs/u8arr2bs.mjs.html +1 -1
  472. package/docs/u8arr2obj.mjs.html +1 -1
  473. package/docs/u8arr2str.mjs.html +1 -1
  474. package/docs/u8arr2u16arr.mjs.html +1 -1
  475. package/docs/urlParse.mjs.html +1 -1
  476. package/docs/verifyValue.mjs.html +1 -1
  477. package/docs/waitFun.mjs.html +1 -1
  478. package/docs/wsemi.html +2 -2
  479. package/package.json +2 -2
  480. package/src/fsMergeFilesCore.mjs +98 -46
  481. package/test/fsMergeFiles.test.mjs +192 -0
  482. package/toolfp/dist/wsemip.umd.js +1 -1
  483. package/toolparfor/dist/wpf.umd.js +1 -1
  484. package/toolparfor/dist/wpf_pmSeries.umd.js +1 -1
package/docs/wsemi.html CHANGED
@@ -47554,7 +47554,7 @@ if (true) {
47554
47554
 
47555
47555
  <dt class="tag-source">Source:</dt>
47556
47556
  <dd class="tag-source"><ul class="dummy"><li>
47557
- <a href="fsMergeFilesCore.mjs.html">fsMergeFilesCore.mjs</a>, <a href="fsMergeFilesCore.mjs.html#line30">line 30</a>
47557
+ <a href="fsMergeFilesCore.mjs.html">fsMergeFilesCore.mjs</a>, <a href="fsMergeFilesCore.mjs.html#line31">line 31</a>
47558
47558
  </li></ul></dd>
47559
47559
 
47560
47560
 
@@ -99069,7 +99069,7 @@ console.log(strTruncate('abcdefghij', -1))
99069
99069
  <br class="clear">
99070
99070
 
99071
99071
  <footer>
99072
- Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Sat Sep 05 2026 17:59:44 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
99072
+ Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.5</a> on Mon Sep 07 2026 22:43:32 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme.
99073
99073
  </footer>
99074
99074
 
99075
99075
  <script>prettyPrint();</script>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wsemi",
3
- "version": "1.8.85",
3
+ "version": "1.8.86",
4
4
  "main": "dist/wsemi.umd.js",
5
5
  "dependencies": {
6
6
  "@zumer/snapdom": "^2.24.15",
@@ -27,7 +27,7 @@
27
27
  "xxhash-wasm": "^1.1.0"
28
28
  },
29
29
  "devDependencies": {
30
- "w-package-tools": "^1.1.15"
30
+ "w-package-tools": "^1.1.16"
31
31
  },
32
32
  "scripts": {
33
33
  "test": "mocha --parallel --timeout 60000",
@@ -1,3 +1,4 @@
1
+ import { once } from 'events'
1
2
  import get from 'lodash-es/get.js'
2
3
  import genPm from './genPm.mjs'
3
4
  import isearr from './isearr.mjs'
@@ -54,17 +55,58 @@ async function fsMergeFilesCore(fpsIn, fpOut, opt = {}) {
54
55
 
55
56
  //pm
56
57
  let pm = genPm()
58
+ pm.catch(() => {}) //寫入流之error監聽會於逐片await期間(本函數尚未return pm, 無人持有pm)即reject, 無此空catch即成為unhandledRejection; 呼叫端持有之async外層promise會adopt此rejection, 呼叫端未接時仍會被回報, 不會吞錯
59
+
60
+ //streamWrite, errWrite, pmWrite
61
+ //寫入流之error監聽須於建立後立即掛上, 不可等到全部切片pipe完才掛: 開檔失敗(EISDIR/EACCES/EPERM/ENOENT)或寫入中出錯(ENOSPC)之error事件
62
+ //會在逐片await期間發出, 無人監聽即成為uncaughtException(於worker內即為崩潰), 且該片之promise永不settle使呼叫端永久懸置
63
+ //pmWrite供等待drain時競速: 寫入流出錯後drain永不觸發, 無競速即懸置
64
+ let streamWrite = null
65
+ let errWrite = null
66
+ let pmWrite = genPm()
67
+ pmWrite.catch(() => {}) //write於兩片之間(無人race時)出錯, pmWrite之reject會成為unhandledRejection, 故先掛空catch標記已處理; 實際處置在下方error監聽與迴圈頂端之errWrite檢查
57
68
 
58
69
  //攔截錯誤, 注意stream是非同步故try catch是無法攔截的, 須各自監聽read與write串流的error事件處理, 此處是攔截串流以外的錯誤
59
70
  try {
60
71
 
61
72
  //streamWrite
62
- let streamWrite = fs.createWriteStream(fpOut)
73
+ streamWrite = fs.createWriteStream(fpOut)
74
+
75
+ //error, 若有error則不會觸發finish
76
+ streamWrite.on('error', (err) => {
77
+ // console.log(`merge filename[${filename}] err`, err)
78
+ errWrite = err
79
+ errTemp = err.message
80
+ pmWrite.reject(err)
81
+ pm.reject(errTemp)
82
+ })
83
+
84
+ //finish, end之後檔案未必完成寫入會有時間差, 得要監聽finish才能確定寫入檔案完成
85
+ streamWrite.on('finish', () => {
86
+ // console.log(`merge filename[${filename}] end`)
87
+
88
+ //r
89
+ let r = {
90
+ filename: fnOut,
91
+ path: fpOut,
92
+ }
93
+ // let s = fs.statSync(fpOut)
94
+ // console.log('s.size', s.size)
95
+
96
+ //resolve
97
+ pm.resolve(r)
98
+
99
+ })
63
100
 
64
101
  // pathUploadTemp, packageId, chunkTotal, filename,
65
102
 
66
103
  for (let i = 0; i < fpsIn.length; i++) {
67
104
 
105
+ //check, 寫入流已出錯則不再處理後續切片
106
+ if (errWrite !== null) {
107
+ throw errWrite
108
+ }
109
+
68
110
  //fpIn
69
111
  let fpIn = fpsIn[i]
70
112
  // console.log('fpIn', fpIn)
@@ -82,31 +124,58 @@ async function fsMergeFilesCore(fpsIn, fpOut, opt = {}) {
82
124
  // //fsDeleteFileCore
83
125
  // fsDeleteFileCore(fpIn)
84
126
 
85
- //transfer
86
- let transfer = () => {
87
- let pmc = genPm()
127
+ //transfer, 逐chunk讀取並寫入, 以本片最後一個chunk之write callback作為「本片已完整寫入」之屏障, 確認無誤後才刪除切片
128
+ //不用pipe+read'end'刪切片: read之end只代表資料已交給寫入流之緩衝, 寫入是否成功要等write callback(真實ENOSPC為非同步回報),
129
+ //小切片會end先於error到達而把資料未寫成功之切片誤刪; 零長度write亦不可當屏障(Writable會直接短路回呼不進佇列)
130
+ let transfer = async () => {
88
131
 
89
- //streamRead
132
+ //streamRead, for await之下read出錯會直接拋出, 中途throw亦會自動destroy
90
133
  let streamRead = fs.createReadStream(fpIn)
91
134
  // console.log('fpIn',fpIn)
92
135
 
93
- //監測錯誤
94
- streamRead.on('error', (err) => {
95
- errTemp = err.message
96
- pmc.reject(err)
97
- })
98
-
99
- //監測串流結束
100
- streamRead.on('end', () => {
101
- fsDeleteFileCore(fpIn, { fs })
102
- pmc.resolve()
103
- })
136
+ //pmLast, 本片最後一個chunk之write callback
137
+ let pmLast = null
138
+
139
+ for await (let chunk of streamRead) {
140
+
141
+ //check, 寫入流已出錯則中止本片
142
+ if (errWrite !== null) {
143
+ throw errWrite
144
+ }
145
+
146
+ //write, callback依序觸發, 故最後一個callback成功即代表本片全部chunk皆已寫入成功
147
+ let needDrain = false
148
+ let pmw = new Promise((resolve, reject) => {
149
+ needDrain = !streamWrite.write(chunk, (err) => {
150
+ if (err) {
151
+ reject(err)
152
+ }
153
+ else {
154
+ resolve()
155
+ }
156
+ })
157
+ })
158
+ pmw.catch(() => {}) //僅await最後一個, 其餘先掛空catch避免成為unhandledRejection
159
+ pmLast = pmw
160
+
161
+ //背壓, write回傳false時等待drain; 須與pmWrite競速, 否則寫入流出錯後drain永不觸發而懸置
162
+ if (needDrain) {
163
+ await Promise.race([once(streamWrite, 'drain'), pmWrite])
164
+ }
165
+
166
+ }
167
+
168
+ //屏障, 等待本片最後一個write完成(出錯即拋出)
169
+ if (pmLast !== null) {
170
+ await pmLast
171
+ }
172
+ if (errWrite !== null) {
173
+ throw errWrite
174
+ }
175
+
176
+ //fsDeleteFileCore, 本片確認寫入成功後才刪除
177
+ fsDeleteFileCore(fpIn, { fs })
104
178
 
105
- //pipe, 將讀取流接入寫入流, 會自動調節讀寫速率處理背壓
106
- //注意pipe不會自動處理錯誤, 若read出錯也不會因pipe轉移至write, 故read的錯誤得要獨立監聽處理
107
- streamRead.pipe(streamWrite, { end: false })
108
-
109
- return pmc
110
179
  }
111
180
  await transfer()
112
181
 
@@ -115,33 +184,16 @@ async function fsMergeFilesCore(fpsIn, fpOut, opt = {}) {
115
184
  //end
116
185
  streamWrite.end()
117
186
 
118
- //error, 若有error則不會觸發finish
119
- streamWrite.on('error', (err) => {
120
- // console.log(`merge filename[${filename}] err`, err)
121
- errTemp = err.message
122
- pm.reject(errTemp)
123
- })
124
-
125
- //finish, end之後檔案未必完成寫入會有時間差, 得要監聽finish才能確定寫入檔案完成
126
- streamWrite.on('finish', () => {
127
- // console.log(`merge filename[${filename}] end`)
128
-
129
- //r
130
- let r = {
131
- filename: fnOut,
132
- path: fpOut,
133
- }
134
- // let s = fs.statSync(fpOut)
135
- // console.log('s.size', s.size)
136
-
137
- //resolve
138
- pm.resolve(r)
139
-
140
- })
141
-
142
187
  }
143
188
  catch (err) {
144
- errTemp = err.message
189
+ errTemp = get(err, 'message', String(err))
190
+
191
+ //destroy, 釋放fd: throw路徑(如切片缺失)之寫入流已成功開檔, 不destroy則fd殘留至程序結束; 已出錯之寫入流destroy為無害重複
192
+ try {
193
+ streamWrite.destroy()
194
+ }
195
+ catch (e) {}
196
+
145
197
  pm.reject(errTemp)
146
198
  }
147
199
 
@@ -3,6 +3,7 @@ import assert from 'assert'
3
3
  import fsCreateFolder from '../src/fsCreateFolder.mjs'
4
4
  import fsDeleteFolder from '../src/fsDeleteFolder.mjs'
5
5
  import fsMergeFiles from '../src/fsMergeFiles.mjs'
6
+ import fsMergeFilesCore from '../src/fsMergeFilesCore.mjs'
6
7
 
7
8
 
8
9
  describe(`fsMergeFiles`, function() {
@@ -62,3 +63,194 @@ describe(`fsMergeFiles`, function() {
62
63
  })
63
64
 
64
65
  })
66
+
67
+
68
+ describe(`fsMergeFiles error paths`, function() {
69
+
70
+ //失敗路徑涉及stream事件與樹殺等待, 放寬逾時
71
+ this.timeout(15000)
72
+
73
+ let fdt = './_test_fsMergeFiles_err'
74
+
75
+ //計數: 任何失敗路徑皆不得產生uncaughtException或unhandledRejection(寫入流之error若無監聽者即為uncaughtException, 於worker內即崩潰)
76
+ let nUncaught = 0
77
+ let nUnhandled = 0
78
+ let onUncaught = () => {
79
+ nUncaught += 1
80
+ }
81
+ let onUnhandled = () => {
82
+ nUnhandled += 1
83
+ }
84
+
85
+ before(function() {
86
+ fs.rmSync(fdt, { recursive: true, force: true })
87
+ fs.mkdirSync(fdt, { recursive: true })
88
+ process.on('uncaughtException', onUncaught)
89
+ process.on('unhandledRejection', onUnhandled)
90
+ })
91
+
92
+ after(function() {
93
+ process.off('uncaughtException', onUncaught)
94
+ process.off('unhandledRejection', onUnhandled)
95
+ fs.rmSync(fdt, { recursive: true, force: true })
96
+ })
97
+
98
+ //settle: 5秒內須settle, 否則視為懸置(hang)
99
+ let settle = (pm) => Promise.race([
100
+ pm
101
+ .then((v) => ({ state: 'resolve', v }))
102
+ .catch((e) => ({ state: 'reject', e })),
103
+ new Promise((resolve) => setTimeout(() => resolve({ state: 'hang' }), 5000)),
104
+ ])
105
+
106
+ let delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms))
107
+
108
+ //mkProxy: 以fs代理攔截createWriteStream取得寫入流實例, 供斷言失敗後是否destroy(fd是否釋放)
109
+ //failOnWriteIndex為第N次_write時模擬ENOSPC, 且以setImmediate非同步回呼仿真實fs(此時序會讓「read end即刪切片」之舊作法誤刪資料未寫成功之切片)
110
+ //highWaterMark可縮小寫入流緩衝以逼出背壓(drain)路徑
111
+ let mkProxy = (failOnWriteIndex = null, highWaterMark = undefined) => {
112
+ let st = { ws: null, nWrite: 0 }
113
+ let fsProxy = { ...fs }
114
+ fsProxy.createWriteStream = (p) => {
115
+ let ws = (highWaterMark === undefined) ? fs.createWriteStream(p) : fs.createWriteStream(p, { highWaterMark })
116
+ st.ws = ws
117
+ let _write = ws._write.bind(ws)
118
+ ws._write = (chunk, enc, cb) => {
119
+ st.nWrite += 1
120
+ if (failOnWriteIndex !== null && st.nWrite === failOnWriteIndex) {
121
+ return setImmediate(() => {
122
+ let e = new Error('ENOSPC: no space left on device, write')
123
+ e.code = 'ENOSPC'
124
+ cb(e)
125
+ })
126
+ }
127
+ return _write(chunk, enc, cb)
128
+ }
129
+ return ws
130
+ }
131
+ return { fsProxy, st }
132
+ }
133
+
134
+ it(`should reject (not hang) without uncaughtException when output path is a directory, and keep the slice`, async function() {
135
+ fs.writeFileSync(`${fdt}/b_0`, 'AAA')
136
+ fs.mkdirSync(`${fdt}/b.out`)
137
+ let before = nUncaught
138
+ let r = await settle(fsMergeFiles([`${fdt}/b_0`], `${fdt}/b.out`))
139
+ await delay(200)
140
+ // console.log('dir r', r)
141
+ assert.strict.deepStrictEqual(r.state, 'reject')
142
+ assert.strict.deepStrictEqual(typeof r.e, 'string')
143
+ assert.strict.deepStrictEqual(r.e.includes('EISDIR'), true)
144
+ assert.strict.deepStrictEqual(nUncaught - before, 0)
145
+ assert.strict.deepStrictEqual(fs.existsSync(`${fdt}/b_0`), true) //失敗時不得誤刪切片
146
+ })
147
+
148
+ it(`should reject when a slice is missing and destroy the write stream (release fd)`, async function() {
149
+ let { fsProxy, st } = mkProxy()
150
+ fs.writeFileSync(`${fdt}/c_0`, 'AAA')
151
+ let r = await settle(fsMergeFilesCore([`${fdt}/c_0`, `${fdt}/c_1`], `${fdt}/c.out`, { fs: fsProxy }))
152
+ await delay(300) //等open完成
153
+ // console.log('missing r', r, st.ws.destroyed, st.ws.fd)
154
+ assert.strict.deepStrictEqual(r.state, 'reject')
155
+ assert.strict.deepStrictEqual(r.e.includes('is not a file'), true)
156
+ //throw路徑之寫入流已成功開檔, 若未destroy則fd殘留
157
+ assert.strict.deepStrictEqual(st.ws.destroyed, true)
158
+ assert.strict.deepStrictEqual(st.ws.fd, null)
159
+ })
160
+
161
+ it(`should reject (not hang) when output file is read-only`, async function() {
162
+ //root不受檔案權限位元限制, 此案於root下無法成立
163
+ if (typeof process.getuid === 'function' && process.getuid() === 0) {
164
+ this.skip()
165
+ }
166
+ fs.writeFileSync(`${fdt}/d_0`, 'AAA')
167
+ fs.writeFileSync(`${fdt}/d.out`, 'OLD')
168
+ fs.chmodSync(`${fdt}/d.out`, 0o444)
169
+ let before = nUncaught
170
+ let r = await settle(fsMergeFiles([`${fdt}/d_0`], `${fdt}/d.out`))
171
+ await delay(200)
172
+ fs.chmodSync(`${fdt}/d.out`, 0o666)
173
+ // console.log('readonly r', r)
174
+ assert.strict.deepStrictEqual(r.state, 'reject')
175
+ assert.strict.deepStrictEqual(/EPERM|EACCES/.test(r.e), true)
176
+ assert.strict.deepStrictEqual(nUncaught - before, 0)
177
+ assert.strict.deepStrictEqual(fs.readFileSync(`${fdt}/d.out`, 'utf8'), 'OLD')
178
+ assert.strict.deepStrictEqual(fs.existsSync(`${fdt}/d_0`), true)
179
+ })
180
+
181
+ it(`should reject (not hang) when write fails mid-stream (ENOSPC on 2nd slice), destroy write stream, keep unmerged slices`, async function() {
182
+ let { fsProxy, st } = mkProxy(2)
183
+ fs.writeFileSync(`${fdt}/e_0`, 'AAA')
184
+ fs.writeFileSync(`${fdt}/e_1`, 'BBB')
185
+ fs.writeFileSync(`${fdt}/e_2`, 'CCC')
186
+ let before = nUncaught
187
+ let r = await settle(fsMergeFilesCore([`${fdt}/e_0`, `${fdt}/e_1`, `${fdt}/e_2`], `${fdt}/e.out`, { fs: fsProxy }))
188
+ await delay(300)
189
+ // console.log('enospc r', r, st.ws.destroyed)
190
+ assert.strict.deepStrictEqual(r.state, 'reject')
191
+ assert.strict.deepStrictEqual(r.e.includes('ENOSPC'), true)
192
+ assert.strict.deepStrictEqual(nUncaught - before, 0)
193
+ assert.strict.deepStrictEqual(st.ws.destroyed, true)
194
+ //已合併之切片刪除, 出錯與其後之切片保留
195
+ assert.strict.deepStrictEqual(fs.existsSync(`${fdt}/e_0`), false)
196
+ assert.strict.deepStrictEqual(fs.existsSync(`${fdt}/e_1`), true)
197
+ assert.strict.deepStrictEqual(fs.existsSync(`${fdt}/e_2`), true)
198
+ })
199
+
200
+ it(`should merge large slices correctly under backpressure (small highWaterMark forces drain waits)`, async function() {
201
+ let { fsProxy, st } = mkProxy(null, 1024)
202
+ let a = 'A'.repeat(300 * 1024)
203
+ let b = '中'.repeat(100 * 1024)
204
+ let c = 'C'.repeat(300 * 1024)
205
+ fs.writeFileSync(`${fdt}/g_0`, a)
206
+ fs.writeFileSync(`${fdt}/g_1`, b)
207
+ fs.writeFileSync(`${fdt}/g_2`, c)
208
+ let r = await settle(fsMergeFilesCore([`${fdt}/g_0`, `${fdt}/g_1`, `${fdt}/g_2`], `${fdt}/g.out`, { fs: fsProxy }))
209
+ await delay(200)
210
+ assert.strict.deepStrictEqual(r.state, 'resolve')
211
+ assert.strict.deepStrictEqual(st.nWrite > 3, true) //確有多次_write(多chunk), 背壓路徑被走到
212
+ assert.strict.deepStrictEqual(fs.readFileSync(`${fdt}/g.out`, 'utf8'), a + b + c)
213
+ assert.strict.deepStrictEqual([0, 1, 2].map((i) => fs.existsSync(`${fdt}/g_${i}`)), [false, false, false])
214
+ assert.strict.deepStrictEqual(st.ws.destroyed, true)
215
+ })
216
+
217
+ it(`should reject (not hang) when write fails while waiting for drain under backpressure, keeping the failing slice`, async function() {
218
+ //highWaterMark 1024 + 64KB chunk → 每次write皆回傳false而等drain; 第7次_write(落在第2片)失敗, 驗證drain競速不懸置
219
+ let { fsProxy, st } = mkProxy(7, 1024)
220
+ let a = 'A'.repeat(300 * 1024)
221
+ let b = 'B'.repeat(300 * 1024)
222
+ let c = 'C'.repeat(300 * 1024)
223
+ fs.writeFileSync(`${fdt}/h_0`, a)
224
+ fs.writeFileSync(`${fdt}/h_1`, b)
225
+ fs.writeFileSync(`${fdt}/h_2`, c)
226
+ let before = nUncaught
227
+ let r = await settle(fsMergeFilesCore([`${fdt}/h_0`, `${fdt}/h_1`, `${fdt}/h_2`], `${fdt}/h.out`, { fs: fsProxy }))
228
+ await delay(300)
229
+ // console.log('drain-fail r', r, st.nWrite)
230
+ assert.strict.deepStrictEqual(r.state, 'reject')
231
+ assert.strict.deepStrictEqual(r.e.includes('ENOSPC'), true)
232
+ assert.strict.deepStrictEqual(nUncaught - before, 0)
233
+ assert.strict.deepStrictEqual(st.ws.destroyed, true)
234
+ assert.strict.deepStrictEqual([0, 1, 2].map((i) => fs.existsSync(`${fdt}/h_${i}`)), [false, true, true])
235
+ })
236
+
237
+ it(`should still resolve on a normal merge through the same code path (regression)`, async function() {
238
+ let { fsProxy, st } = mkProxy()
239
+ fs.writeFileSync(`${fdt}/f_0`, 'AAA')
240
+ fs.writeFileSync(`${fdt}/f_1`, 'BBB')
241
+ let r = await settle(fsMergeFilesCore([`${fdt}/f_0`, `${fdt}/f_1`], `${fdt}/f.out`, { fs: fsProxy, fnOut: 'f.out' }))
242
+ await delay(200)
243
+ assert.strict.deepStrictEqual(r.state, 'resolve')
244
+ assert.strict.deepStrictEqual(r.v, { filename: 'f.out', path: `${fdt}/f.out` })
245
+ assert.strict.deepStrictEqual(fs.readFileSync(`${fdt}/f.out`, 'utf8'), 'AAABBB')
246
+ assert.strict.deepStrictEqual(fs.existsSync(`${fdt}/f_0`), false)
247
+ assert.strict.deepStrictEqual(fs.existsSync(`${fdt}/f_1`), false)
248
+ assert.strict.deepStrictEqual(st.ws.destroyed, true) //正常結束亦關閉
249
+ })
250
+
251
+ it(`should not produce any uncaughtException or unhandledRejection across all error paths`, async function() {
252
+ await delay(300)
253
+ assert.strict.deepStrictEqual([nUncaught, nUnhandled], [0, 0])
254
+ })
255
+
256
+ })
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wsemip v1.8.85
2
+ * wsemip v1.8.86
3
3
  * (c) 2018-2021 yuda-lyu(semisphere)
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wpf v1.8.85
2
+ * wpf v1.8.86
3
3
  * (c) 2018-2021 yuda-lyu(semisphere)
4
4
  * Released under the MIT License.
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * wpf_pmSeries v1.8.85
2
+ * wpf_pmSeries v1.8.86
3
3
  * (c) 2018-2021 yuda-lyu(semisphere)
4
4
  * Released under the MIT License.
5
5
  */