Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simple-json-db

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-json-db - npm Package Compare versions

Comparing version 1.2.2 to 1.2.3

index.d.ts

11

index.js

@@ -5,7 +5,8 @@ const fs = require("fs");

* Default configuration values.
* @type {{asyncWrite: boolean, syncOnWrite: boolean}}
* @type {{asyncWrite: boolean, syncOnWrite: boolean, jsonSpaces: number}}
*/
const defaultOptions = {
asyncWrite: false,
syncOnWrite: true
syncOnWrite: true,
jsonSpaces: 4
};

@@ -33,2 +34,4 @@

* @param {boolean} [options.syncOnWrite] Makes the storage be written to disk after every modification. Enabled by default.
* @param {boolean} [options.syncOnWrite] Makes the storage be written to disk after every modification. Enabled by default.
* @param {number} [options.jsonSpaces] How many spaces to use for indentation in the output json files. Default = 4
* @constructor

@@ -146,3 +149,3 @@ */

if (this.options && this.options.asyncWrite) {
fs.writeFile(this.filePath, JSON.stringify(this.storage, null, 4), (err) => {
fs.writeFile(this.filePath, JSON.stringify(this.storage, null, this.options.jsonSpaces), (err) => {
if (err) throw err;

@@ -152,3 +155,3 @@ });

try {
fs.writeFileSync(this.filePath, JSON.stringify(this.storage, null, 4));
fs.writeFileSync(this.filePath, JSON.stringify(this.storage, null, this.options.jsonSpaces));
} catch (err) {

@@ -155,0 +158,0 @@ if (err.code === 'EACCES') {

{
"name": "simple-json-db",
"version": "1.2.2",
"version": "1.2.3",
"description": "A simple, no-frills, JSON storage engine for Node.JS",
"main": "index.js",
"types": "index.d.ts",
"engines": {

@@ -7,0 +8,0 @@ "node": ">=6.0"

@@ -31,2 +31,3 @@ # Simple JSONdb [![npm](https://img.shields.io/npm/v/simple-json-db)](https://www.npmjs.com/package/simple-json-db) [![npm](https://img.shields.io/npm/dw/simple-json-db)](https://www.npmjs.com/package/simple-json-db) [![Minimum NodeJS version](https://img.shields.io/node/v/simple-json-db)](https://www.npmjs.com/package/simple-json-db) [![Dependents (via libraries.io)](https://img.shields.io/librariesio/dependents/npm/simple-json-db)](https://libraries.io/npm/simple-json-db/dependents) [![Snyk Vulnerabilities for npm package](https://img.shields.io/snyk/vulnerabilities/npm/simple-json-db)](https://snyk.io/vuln/search?q=simple-json-db&type=npm)

| syncOnWrite | _Boolean_ | Makes the storage be written to disk after every modification. | _**true**_ |
| jsonSpaces | _Number_ | The number of spaces used for indentation in the output JSON. | _**4**_ |

@@ -33,0 +34,0 @@ ### Set a key

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc