easy-api.ts
Version:
A powerful library to create your own API with ease.
1 lines • 796 B
JavaScript
Object.defineProperty(exports,"__esModule",{value:!0});let tslib_1=require("tslib"),APIFunction_1=require("../../classes/structures/APIFunction"),Error_1=require("../../classes/structures/Error"),fs_1=tslib_1.__importDefault(require("fs"));class FileExists extends APIFunction_1.APIFunction{name="$fileExists";description="Check if the provided file exists.";parameters=[{name:"Path",description:"The path of the file to be checked.",type:APIFunction_1.ParamType.String,required:!0,rest:!1,defaultValue:null}];usage="$fileExists[path]";returns=APIFunction_1.ParamType.Boolean;compile=!0;aliases=[];async run(e,[t]){try{fs_1.default.existsSync(t)}catch(t){throw new Error_1.EATS_Error(["Unable to check the file path: "+e.function?.name,"with reason: "+t].join("\n"))}}}exports.default=FileExists;