Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
parse-json-from-buffer
Advanced tools
A very simple module that transform a buffer to a JS object. It takes a buffer, convert it to string then parse the JSON and return the javascript object.
const {parseJsonFromBuffer,encodeObjectToString} = require('parse-json-from-buffer');
const secrets = {secretOne: "changeMe", secretTwo: "changeMeToo"};
// encode your js object (must be allow JSON.STRINGIFY)
const encodedSecrets = encodeObjectToString(secrets, 'base64');
const testBuffer = Buffer.from(encodedSecrets) // json stringified base64 string
// revert the process
const result = parseJsonFromBuffer(testBuffer, 'base64') // output {secretOne: "changeMe", secretTwo: "changeMeToo"};
import parseJsonFromBuffer,encodeObjectToString from 'parse-json-from-buffer';
const secrets = {secretOne: "changeMe", secretTwo: "changeMeToo"};
// encode your js object (must be allow JSON.STRINGIFY)
const encodedSecrets = encodeObjectToString(secrets, 'base64');
const testBuffer = Buffer.from(encodedSecrets) // json stringified base64 string
// revert the process
const result = parseJsonFromBuffer(testBuffer, 'base64') // output {secretOne: "changeMe", secretTwo: "changeMeToo"};
You can run tests with this command:
npm test
FAQs
parse a json form a buffer
The npm package parse-json-from-buffer receives a total of 2 weekly downloads. As such, parse-json-from-buffer popularity was classified as not popular.
We found that parse-json-from-buffer demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.