9 lines
270 B
JavaScript
9 lines
270 B
JavaScript
// Convert a JSON object to a buffer for the DB
|
|
exports.JsonToBuffer = (jsonObject) => {
|
|
return Buffer.from(JSON.stringify(jsonObject))
|
|
}
|
|
|
|
// Convert a buffer from the DB to JSON object
|
|
exports.BufferToJson = (buffer) => {
|
|
return JSON.parse(buffer.toString());
|
|
} |