
Research
5 Malicious Chrome Extensions Enable Session Hijacking in Enterprise HR and ERP Systems
Five coordinated Chrome extensions enable session hijacking and block security controls across enterprise HR and ERP platforms.
jsonfile-commentless
Advanced tools
Easily read/write JSON files.
Writing JSON.stringify() and then fs.writeFile() and JSON.parse() with fs.readFile() enclosed in try/catch blocks became annoying. Then not being able to strip comments with the standard jsonfile package also became annoying.
npm install --save jsonfile-commentless
options (object, default undefined): Pass in any fs.readFile options or set reviver for a JSON reviver.
throws (boolean, default: true). If JSON.parse throws an error, pass this error to the callback.
If false, returns null for the object.var jsonfile = require('jsonfile-commentless')
var file = '/tmp/data.json'
jsonfile.readFile(file, function(err, obj) {
console.dir(obj)
})
options (object, default undefined): Pass in any fs.readFileSync options or set reviver for a JSON reviver.
throws (boolean, default: true). If an error is encountered reading or parsing the file, throw the error. If false, returns null for the object.var jsonfile = require('jsonfile-commentless')
var file = '/tmp/data.json'
console.dir(jsonfile.readFileSync(file))
options: Pass in any fs.writeFile options or set replacer for a JSON replacer. Can also pass in spaces and override EOL string.
var jsonfile = require('jsonfile-commentless')
var file = '/tmp/data.json'
var obj = {name: 'JP'}
jsonfile.writeFile(file, obj, function (err) {
console.error(err)
})
formatting with spaces:
var jsonfile = require('jsonfile-commentless')
var file = '/tmp/data.json'
var obj = {name: 'JP'}
jsonfile.writeFile(file, obj, {spaces: 2}, function(err) {
console.error(err)
})
overriding EOL:
var jsonfile = require('jsonfile-commentless')
var file = '/tmp/data.json'
var obj = {name: 'JP'}
jsonfile.writeFile(file, obj, {spaces: 2, EOL: '\r\n'}, function(err) {
console.error(err)
})
appending to an existing JSON file:
You can use fs.writeFile option {flag: 'a'} to achieve this.
var jsonfile = require('jsonfile-commentless')
var file = '/tmp/mayAlreadyExistedData.json'
var obj = {name: 'JP'}
jsonfile.writeFile(file, obj, {flag: 'a'}, function (err) {
console.error(err)
})
options: Pass in any fs.writeFileSync options or set replacer for a JSON replacer. Can also pass in spaces and override EOL string.
var jsonfile = require('jsonfile-commentless')
var file = '/tmp/data.json'
var obj = {name: 'JP'}
jsonfile.writeFileSync(file, obj)
formatting with spaces:
var jsonfile = require('jsonfile-commentless')
var file = '/tmp/data.json'
var obj = {name: 'JP'}
jsonfile.writeFileSync(file, obj, {spaces: 2})
overriding EOL:
var jsonfile = require('jsonfile-commentless')
var file = '/tmp/data.json'
var obj = {name: 'JP'}
jsonfile.writeFileSync(file, obj, {spaces: 2, EOL: '\r\n'})
appending to an existing JSON file:
You can use fs.writeFileSync option {flag: 'a'} to achieve this.
var jsonfile = require('jsonfile-commentless')
var file = '/tmp/mayAlreadyExistedData.json'
var obj = {name: 'JP'}
jsonfile.writeFileSync(file, obj, {flag: 'a'})
(MIT License)
Original Work : https://github.com/jprichardson/node-jsonfile
Copyright 2012-2016, JP Richardson jprichardson@gmail.com
Modified Work : https://github.com/z3dtech/node-jsonfile
Copyright 2017, z3dtech z@z3d.tech
FAQs
Easily read/write JSON files. Also strips comments.
We found that jsonfile-commentless demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.

Research
Five coordinated Chrome extensions enable session hijacking and block security controls across enterprise HR and ERP platforms.

Research
Node.js patched a crash bug where AsyncLocalStorage could cause stack overflows to bypass error handlers and terminate production servers.

Research
/Security News
A malicious Chrome extension steals newly created MEXC API keys, exfiltrates them to Telegram, and enables full account takeover with trading and withdrawal rights.