@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/cli.cjs
CHANGED
|
@@ -143545,6 +143545,10 @@ async function listDirectories(absolutePath) {
|
|
|
143545
143545
|
const entries = await (0, import_promises11.readdir)(absolutePath, { withFileTypes: true });
|
|
143546
143546
|
return entries.filter((e) => e.isDirectory()).map((e) => ({ name: e.name })).sort((a, b2) => a.name.localeCompare(b2.name));
|
|
143547
143547
|
}
|
|
143548
|
+
async function listFiles(absolutePath) {
|
|
143549
|
+
const entries = await (0, import_promises11.readdir)(absolutePath, { withFileTypes: true });
|
|
143550
|
+
return entries.filter((e) => e.isFile()).map((e) => ({ name: e.name })).sort((a, b2) => a.name.localeCompare(b2.name));
|
|
143551
|
+
}
|
|
143548
143552
|
async function createDirectory(parentAbsolutePath, name) {
|
|
143549
143553
|
if (name.includes("/") || name.includes("\\") || name === ".." || name === ".") {
|
|
143550
143554
|
throw new Error("Invalid directory name");
|
|
@@ -153127,8 +153131,11 @@ var StreamerServer = class {
|
|
|
153127
153131
|
const relativePath = url2.searchParams.get("path") ?? "";
|
|
153128
153132
|
try {
|
|
153129
153133
|
const resolved = await resolveBrowsePath(this.browseRoot, relativePath);
|
|
153130
|
-
const directories = await
|
|
153131
|
-
|
|
153134
|
+
const [directories, files] = await Promise.all([
|
|
153135
|
+
listDirectories(resolved),
|
|
153136
|
+
listFiles(resolved)
|
|
153137
|
+
]);
|
|
153138
|
+
json2(res, 200, { path: relativePath, directories, files });
|
|
153132
153139
|
} catch (err) {
|
|
153133
153140
|
const message = err instanceof Error ? err.message : "Browse failed";
|
|
153134
153141
|
if (err instanceof BrowsePathNotFoundError) {
|