1.0.31-beta.5 • Published 9 months ago
npm-package-nodejs-utils-lda v1.0.31-beta.5
npm-package-nodejs-utils
Este projeto tem como fins de criar e abstrair módulos basicos e utilidades para o node js
requires .env file config.json file data folder
automatic create requires folders and files.
Functions
fopen(filePath);
fwrite(filePath, data);
fwriteBin(filePath, data);
stringToBinary(str, binaryLenght);
freadBin(filePath);
binaryToString(binary, binaryLenght);
checkHeaderMiddleware(app);
sendMail(email, subject, text, function(error,data));
fetchGet(url, header, callback);
fetchPost(url, payload, header, function(error,data));
httpsSecurityMiddleware(req, res, next)
getRandomInt(max);
getRandomBin(max);
getRandomHex(max);
generateToken();
validadeApiKey(req,res,key);
forbidden(res);
unauthorized(res);
notfound(res);
discordLogs(title, message)
autoLoader(app);
spaceUsed(space, used);
serverTry(res,callback)user system
insertUser(name,userdata);
return userdata saved
selectUser(ID);
return userdata
usersList();
return users ID,name
deleteUser(ID);
alterUser(ID, name, newUserData);
disableUser(ID);
reactivateUser(ID);mongo DB
mongoConnect(connectionString)
// SET 'MONGO_CONNECTION_STRING' VARIABLE IN .ENV FILE FOR SECURE AND AUTOMATIC CONNECTION
mongoConnect()
// connection = await mongoConnect(connectionString);
select(connection, database, table)
return all data of selected table
insert(connection, database, table, data)
return mongoClient or connectionconfig.json
{
"methods": "GET,HEAD,PUT,PATCH,POST,DELETE",
"emailSystem":{
"service": "Gmail",
"host":null,
"port":null,
"ssl_tls":true
}
}Usage
import { fopen, fwrite, generateToken, fetchGet } from "npm-package-nodejs-utils-lda";
const filePath = "database.json"
// Usando as funções
const data = fopen(filePath);
data.push("X");
fwrite(filePath, data);
const token = generateToken();
fetchGet("https://example.com",null, (onError,data)=>{
if(onError){
res.send(error);
}
res.send(data);
});
```1.0.19
11 months ago
1.0.18
12 months ago
1.0.17
12 months ago
1.0.16
12 months ago
1.0.9
12 months ago
1.0.29-beta.2
9 months ago
1.0.22
10 months ago
1.0.21
11 months ago
1.0.20
11 months ago
1.0.26
9 months ago
1.0.25
9 months ago
1.0.24
9 months ago
1.0.23
10 months ago
1.0.29
9 months ago
1.0.28
9 months ago
1.0.27
9 months ago
1.0.31-beta.1
9 months ago
1.0.11
12 months ago
1.0.10
12 months ago
1.0.31
9 months ago
1.0.30
9 months ago
1.0.31-beta.5
9 months ago
1.0.15
12 months ago
1.0.31-beta.4
9 months ago
1.0.14
12 months ago
1.0.31-beta.3
9 months ago
1.0.13
12 months ago
1.0.12
12 months ago
1.0.8
1 year ago
1.0.7
1 year ago
1.0.6
1 year ago
1.0.5
1 year ago
1.0.4
1 year ago
1.0.3
1 year ago
1.0.2
1 year ago
1.0.1
1 year ago
1.0.0
1 year ago