[FEATURE] Initial FS traversal
This commit is contained in:
parent
af44ff710f
commit
e66e685903
11 changed files with 1260 additions and 108 deletions
|
@ -6,6 +6,19 @@ export async function listFiles(req, res) {
|
|||
if (!serverSpec) return res.sendStatus(400);
|
||||
if (!serverSpec.name) return res.status(400).send("Server name required!");
|
||||
listServerFiles(serverSpec)
|
||||
.then(() => res.sendStatus(200))
|
||||
.then((f) => {
|
||||
const fileData = f.map((fi, i) => ({
|
||||
name: fi.name,
|
||||
isDir: fi.type === 2,
|
||||
id: `${fi.name}-${i}`,
|
||||
isHidden: fi.name.startsWith("."),
|
||||
isSymLink: !!fi.link,
|
||||
size: fi.size,
|
||||
}));
|
||||
console.log(fileData);
|
||||
res.json(fileData);
|
||||
})
|
||||
.catch(sendError(res));
|
||||
}
|
||||
|
||||
export async function uploadFile(req, res) {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue