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

jsonverse

Package Overview
Dependencies
Maintainers
1
Versions
26
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

jsonverse - npm Package Compare versions

Comparing version 1.0.3 to 1.0.11

SECURITY.md

21

index.js

@@ -12,3 +12,3 @@ const fs = require("fs").promises;

return randomUUID();
}
}

@@ -38,3 +38,16 @@ getFilePath(dataName) {

try {
await fs.writeFile(filePath, JSON.stringify(newData, null, 2), "utf8");
let existingData = await this.readDataFromFile(dataName);
if (existingData === null) {
existingData = [];
}
if (existingData.length === 0) {
existingData.push(...newData);
} else {
existingData.push(newData);
}
await fs.writeFile(
filePath,
JSON.stringify(existingData, null, 2),
"utf8"
);
} catch (error) {

@@ -87,3 +100,5 @@ console.error(`Error writing to file ${filePath}: ${error}`);

existingData.push(newData);
// Insert the newData object at the beginning of the existing data array
existingData.unshift(newData);
await this.writeDataByFileName(dataName, existingData);

@@ -90,0 +105,0 @@ }

2

package.json
{
"name": "jsonverse",
"version": "1.0.3",
"version": "1.0.11",
"description": "jsonVerse is a lightweight JSON-based database package for Node.js. It provides a simple interface to store, retrieve, and manage data using JSON files.",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -19,8 +19,6 @@ # jsonVerse

const router = express.Router();
const jsonVerse = require("jsonVerse");
// Specify the data folder path
const dataFolderPath = path.join(__dirname, "../Data");
const jsonverse = require("jsonverse");
// Initialize the JSONDatabase instance
const db = new jsonVerse(dataFolderPath);
const db = new jsonverse("./path/to/your/data/folder"); // add the path to the data folder for example "./Data"
```

@@ -43,8 +41,6 @@ ```javascript

const { dataName, name, social, rank, competition, date, edu } = req.body; // here you have to add the dataName which is where you want to save the data in the json files you have, here i store the name of the dataName from the UI (User interface - Front end)
// dataName is where you want to add the data (the json file)
// Generate a random unique ID
// this is a package you have to install
const uniqueID = uuid.v4();
// the data that you will store from the front end and save in the database
const newData = {
id: uniqueID,
social,

@@ -51,0 +47,0 @@ name,

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