New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@inrixia/db

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@inrixia/db

Transparent object storage

latest
Source
npmnpm
Version
2.0.2
Version published
Weekly downloads
15
1400%
Maintainers
1
Weekly downloads
 
Created
Source

@inrixia/db

This project provides a function that returns a object, all changes to that object are synchronously persisted to disk as json.

Encryption and live updates are supported.

Installation

npm install @inrixia/db

Usage

import db from "@inrixia/db";

type MyObjectType = {
	name: string;
	age: number;
	hobbies: string[];
};

const myObject = db<MyObjectType>("./filename.json", {
	template: {
		name: "Bob",
		age: 128,
		hobbies: [],
	},
	forceCreate: true,
	pretty: true,
});

// use myObject as you wish, all changes will be persisted to disk

Options

The following options are supported:

db("./filename.json", {
	// Template object to initialize with.
	template: {},
	// Key to use for encryption. (Enables encryption if specified)
	cryptKey: "secret",
	// Pretty print the JSON file. (Default: false)
	pretty: true,
	// Write out to file if it doesn't exist. (Default: false)
	forceCreate: true,
	// Asynchronously live update the object when the file is changed externally.
	// Will enable forceCreate if true. (Default: false)
	updateOnExternalChanges: true,
});

FAQs

Package last updated on 19 Sep 2022

Did you know?

Socket

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.

Install

Related posts