18 lines
543 B
TypeScript
18 lines
543 B
TypeScript
import { Socket } from "socket.io";
|
|
function rm(args:Array<string>, curdir:any, socket:Socket):string {
|
|
var buf = "";
|
|
if (curdir[socket.id][args[0]] != undefined) {
|
|
if (typeof curdir[socket.id][args[0]] == "string") {
|
|
delete curdir[socket.id][args[0]];
|
|
buf += "File " + args[0] + " removed\n";
|
|
}
|
|
else {
|
|
buf += "Error: " + args[0] + " is not a file\n";
|
|
}
|
|
}
|
|
else {
|
|
buf += "Error: " + args[0] + " does not exist\n";
|
|
}
|
|
return buf;
|
|
}
|
|
export { rm }; |