@onurege3467/zerohelper
Version:
ZeroHelper is a versatile JavaScript library offering helper functions and database utilities for developers. It supports MongoDB, MySQL, SQLite, Redis, and PostgreSQL.
15 lines (11 loc) • 528 B
JavaScript
;
const errors = require("../errors/strings.js");
module.exports = async function (key, table = "default") {
if (!table || typeof table !== "string")
throw new TypeError(errors.table.replace("{received}", typeof table));
if (!key || typeof key !== "string")
throw new TypeError(errors.key.replace("{received}", typeof key));
let data = await this.get(table, key);
if (typeof data !== "string") throw new TypeError(errors.baseNotString);
return Buffer.from(data, "base64").toString("binary");
};