minimalistic-server 0.0.59 → 0.0.60

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 (2) hide show
  1. package/index.mjs +4 -4
  2. package/package.json +1 -1
package/index.mjs CHANGED
@@ -1883,22 +1883,22 @@ export class FileResponse extends Response {
1883
1883
  <body>
1884
1884
  ${urlPath ? `<a href="/${parentUrlPath}">Up</a><hr>` : ''}
1885
1885
  `;
1886
-
1887
- const files = await currentFsPromiseModule.readdir(filePath);
1886
+ const entries = await currentFsPromiseModule.readdir(filePath, { withFileTypes: true });
1888
1887
  let counter = 0;
1889
1888
 
1890
- for (const file of files) {
1889
+ for (const entry of entries) {
1891
1890
  if (this.#blocked) {
1892
1891
  break;
1893
1892
  }
1894
1893
 
1895
1894
  if (counter === 100) {
1896
1895
  await new Promise(resolve => setTimeout(resolve, 50));
1896
+ counter = 0;
1897
1897
  }
1898
1898
 
1899
1899
  ++counter;
1900
1900
 
1901
- yield `<a href="/${urlPath}/${encodeURIComponent(file)}">${escapeHtml(file)}</a><br>`;
1901
+ yield `<a${entry.isFile ? '' : ' target="_blank"'} href="/${urlPath}/${encodeURIComponent(entry.name)}">${escapeHtml(entry.name)}</a><br>`;
1902
1902
  }
1903
1903
 
1904
1904
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minimalistic-server",
3
- "version": "0.0.59",
3
+ "version": "0.0.60",
4
4
  "engines" : {
5
5
  "npm" : ">=8.6.0",
6
6
  "node" : ">=22.0.0"