UNPKG

easy-api.ts

Version:

A powerful library to create your own API with ease.

1 lines 1.01 kB
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 AppendContent extends APIFunction_1.APIFunction{name="$writeFile";description="Replaces the previews content with the content provided into the provided file.";parameters=[{name:"Path",description:"The path of the file to write content to.",type:APIFunction_1.ParamType.String,required:!0,rest:!1,defaultValue:null},{name:"Content",description:"The content to write in the file.",type:APIFunction_1.ParamType.String,required:!0,rest:!1,defaultValue:null}];usage="$writeFile[path;content]";returns=APIFunction_1.ParamType.Unknown;compile=!0;aliases=[];async run(e,[t,n]){try{fs_1.default.writeFileSync(t,n)}catch(t){throw new Error_1.EATS_Error(["Unable to write content in file: "+e.function?.name,"with reason: "+t].join("\n"))}}}exports.default=AppendContent;