@threadbase-sh/streamer 1.51.0 → 1.52.0
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/dist/cli.cjs +9 -2
- package/dist/cli.cjs.map +1 -1
- package/dist/index.cjs +9 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -6368,6 +6368,10 @@ async function listDirectories(absolutePath) {
|
|
|
6368
6368
|
const entries = await (0, import_promises2.readdir)(absolutePath, { withFileTypes: true });
|
|
6369
6369
|
return entries.filter((e) => e.isDirectory()).map((e) => ({ name: e.name })).sort((a, b) => a.name.localeCompare(b.name));
|
|
6370
6370
|
}
|
|
6371
|
+
async function listFiles(absolutePath) {
|
|
6372
|
+
const entries = await (0, import_promises2.readdir)(absolutePath, { withFileTypes: true });
|
|
6373
|
+
return entries.filter((e) => e.isFile()).map((e) => ({ name: e.name })).sort((a, b) => a.name.localeCompare(b.name));
|
|
6374
|
+
}
|
|
6371
6375
|
async function createDirectory(parentAbsolutePath, name) {
|
|
6372
6376
|
if (name.includes("/") || name.includes("\\") || name === ".." || name === ".") {
|
|
6373
6377
|
throw new Error("Invalid directory name");
|
|
@@ -15357,8 +15361,11 @@ var StreamerServer = class {
|
|
|
15357
15361
|
const relativePath = url.searchParams.get("path") ?? "";
|
|
15358
15362
|
try {
|
|
15359
15363
|
const resolved = await resolveBrowsePath(this.browseRoot, relativePath);
|
|
15360
|
-
const directories = await
|
|
15361
|
-
|
|
15364
|
+
const [directories, files] = await Promise.all([
|
|
15365
|
+
listDirectories(resolved),
|
|
15366
|
+
listFiles(resolved)
|
|
15367
|
+
]);
|
|
15368
|
+
json(res, 200, { path: relativePath, directories, files });
|
|
15362
15369
|
} catch (err) {
|
|
15363
15370
|
const message = err instanceof Error ? err.message : "Browse failed";
|
|
15364
15371
|
if (err instanceof BrowsePathNotFoundError) {
|