UNPKG

w-puppeteer-uitest

Version:
99 lines (61 loc) 2.87 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>getFiles.mjs - Documentation</title> <script src="scripts/prettify/prettify.js"></script> <script src="scripts/prettify/lang-css.js"></script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc.css"> <script src="scripts/nav.js" defer></script> <meta name="viewport" content="width=device-width, initial-scale=1.0"> </head> <body> <input type="checkbox" id="nav-trigger" class="nav-trigger" /> <label for="nav-trigger" class="navicon-button x"> <div class="navicon"></div> </label> <label for="nav-trigger" class="overlay"></label> <nav > <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="w-puppeteer-uitest.html">w-puppeteer-uitest</a><ul class='methods'><li data-type='method'><a href="w-puppeteer-uitest.html#.build">build</a></li><li data-type='method'><a href="w-puppeteer-uitest.html#.compareB64">compareB64</a></li><li data-type='method'><a href="w-puppeteer-uitest.html#.expBuild">expBuild</a></li><li data-type='method'><a href="w-puppeteer-uitest.html#.expTest">expTest</a></li><li data-type='method'><a href="w-puppeteer-uitest.html#.getB64">getB64</a></li><li data-type='method'><a href="w-puppeteer-uitest.html#.getFiles">getFiles</a></li><li data-type='method'><a href="w-puppeteer-uitest.html#.readJson">readJson</a></li><li data-type='method'><a href="w-puppeteer-uitest.html#.test">test</a></li></ul></li></ul> </nav> <div id="main"> <h1 class="page-title">getFiles.mjs</h1> <section> <article> <pre class="prettyprint source linenums"><code>import fs from 'fs' /** * 取得資料夾內檔案,可使用havsStr過濾檔名含有之字串 * * @memberOf w-puppeteer-uitest * @param {String} fd * @returns {Array} 回傳檔案名稱字串陣列 */ async function getFiles(fd, havsStr = '') { let fsp = fs.promises let ltfs = await fsp.readdir(fd) //filter if (havsStr !== '') { ltfs = ltfs.filter(function (fn) { return fn.indexOf(havsStr) >= 0 }) } return ltfs } export default getFiles </code></pre> </article> </section> </div> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 4.0.2</a> on Sat Mar 23 2024 23:37:02 GMT+0800 (台北標準時間) using the <a href="https://github.com/clenemt/docdash">docdash</a> theme. </footer> <script>prettyPrint();</script> <script src="scripts/polyfill.js"></script> <script src="scripts/linenumber.js"></script> </body> </html>