[FEATURE] Several QOL Updates (#18)

Co-authored-by: Dunemask <dunemask@gmail.com>
Reviewed-on: https://gitea.dunemask.dev/elysium/minecluster/pulls/18
This commit is contained in:
dunemask 2024-02-11 03:57:01 +00:00
parent 4959d6c1fe
commit 0a0f9c8463
16 changed files with 432 additions and 828 deletions

View file

@ -86,12 +86,22 @@ export async function uploadServerItem(serverSpec, file) {
}).catch(handleError);
}
export async function getServerItem(serverSpec, writableStream) {
export async function getServerItem(serverSpec) {
const { path } = serverSpec;
const ds = new Transform({ transform: (c, e, cb) => cb(null, c) });
const ds = new Transform({ transform: (c, _e, cb) => cb(null, c) });
pathSecurityCheck(path);
const ftpTransfer = useServerFtp(serverSpec, async (c) => {
await c.downloadTo(ds, path);
}).catch(handleError);
return { ds, ftpTransfer };
}
export async function moveServerItems(serverSpec) {
const { destination, origin, files } = serverSpec;
useServerFtp(serverSpec, async (c) =>
Promise.all(
files.map((f) => c.rename(`${origin}/${f}`, `${destination}/${f}`)),
),
).catch(handleError);
return files;
}