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

lowdb

Package Overview
Dependencies
Maintainers
1
Versions
76
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lowdb

Small JSON database for Node, Electron and the browser. Powered by Lodash.

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
337K
decreased by-50.72%
Maintainers
1
Weekly downloads
 
Created

What is lowdb?

Lowdb is a small local JSON database for Node, Electron, and the browser. It's a simple and lightweight way to store data locally using a JSON file. It is ideal for small projects, quick prototypes, and applications that do not require a full-fledged database.

What are lowdb's main functionalities?

Create and Read Data

This feature allows you to create and read data from a JSON file. The code initializes a lowdb instance, sets default values, adds a new post, and retrieves it.

const low = require('lowdb');
const FileSync = require('lowdb/adapters/FileSync');

const adapter = new FileSync('db.json');
const db = low(adapter);

db.defaults({ posts: [] }).write();

db.get('posts').push({ id: 1, title: 'lowdb is awesome' }).write();

const post = db.get('posts').find({ id: 1 }).value();
console.log(post);

Update Data

This feature allows you to update existing data in the JSON file. The code updates the title of the post with id 1 and retrieves the updated post.

db.get('posts').find({ id: 1 }).assign({ title: 'lowdb is super awesome' }).write();
const updatedPost = db.get('posts').find({ id: 1 }).value();
console.log(updatedPost);

Delete Data

This feature allows you to delete data from the JSON file. The code removes the post with id 1 and retrieves the remaining posts.

db.get('posts').remove({ id: 1 }).write();
const posts = db.get('posts').value();
console.log(posts);

Other packages similar to lowdb

Keywords

FAQs

Package last updated on 31 Aug 2017

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

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