npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

bulbat

v0.0.2

Published

In-Memory storage that could be synced to encrypted file

Downloads

4

Readme

Bulbat

bulbat

The name is from random generated Pokémon, between Bulbasaur and Golbat.

This is in-memory quick storage that could be synced to the disk if neaded inside an encrypted file.

WARNING

The current implementation is pretty basic in terms of encryption. So don't put any sensitive data

Usage

Install the package with

npm install --save bulbat

Import and use

import { Database } from 'bulbat';

const db = new Database();

const post = {
  id: 42,
  title: 'Welcome to my blog!',
  content: '...'
};

db.collection('posts').insert(post);

db.collection('posts').data.map((post) => {
  console.log(post);
});

You could use the Collection only without the need of the Database instance:

import { Collection } from 'bulbat'

const posts = new Collection('posts');

posts.insert(/* data */);

posts.data.map((post) => {
  console.log(post)
});

The collection provide an reduce method that could be used to sort or change the content of the collection, internal state. Right now the only way to make bulk actions to the storage.

import { Collection } from 'bulbat';

const col = new Collection('posts');

// insert some data into the collection

col.reduce((result, post) => {
  if (post.status !== 'deleted') {
    result.push(post);
  }
  return result;
});

col.data
// => only posts that are not `deleted`

Collection require to have name as first argument - this is the minimum requirment. CollectionProps could be passed to all collections when using the Database and overwrite/extend for each collections from the Collection constructor or as second argument to Database#add method.

const db = Database({ path: `./db` });
db.add('posts', { path: './posts' });

Encryption, every collection by default will try to store it's state to the disk inside a encrypted file.The file is locked with default password of '<empty-string>'. You could change this by passing password to all collections or per collection - you will need to set CollectionProps.password. Created collection could not change there password (for now).

const db = Database({ password: 'not-qwerty' });
db.add('posts', { password: 'qwerty' }); // will use 'qwerty' for password
db.add('images'); // will use 'not-qwerty' as password

Development

npm install

To start development run:

npm run develop

Other commands:

# to code format the code with prettier
npm run format

# to lint the code for errors with tslint
npm run lint

# to build the project
npm run build

# to run tests
npm run test

# or
npm run test:watch

Changelog

It's located into the root CHANGELOG.md file