Add function to get all client IDs from JSON file #7
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
// Debug
|
||||
const { DebugBuilder } = require("../utilities/debugBuilder");
|
||||
const { readFileSync } = require('fs');
|
||||
const log = new DebugBuilder("server", "utils");
|
||||
const path = require('path');
|
||||
|
||||
// Convert a JSON object to a buffer for the DB
|
||||
exports.JsonToBuffer = (jsonObject) => {
|
||||
@@ -72,4 +74,13 @@ exports.isJsonString = (str) => {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get all client IDs from the saved JSON file
|
||||
*
|
||||
* @returns Object of Client IDs
|
||||
*/
|
||||
exports.getAllClientIds = () => {
|
||||
return Object(JSON.parse(readFileSync(path.resolve(__dirname, '../clientIds.json'))));
|
||||
}
|
||||
Reference in New Issue
Block a user