[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:
parent
4959d6c1fe
commit
0a0f9c8463
16 changed files with 432 additions and 828 deletions
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue