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

@novemberizing/storage

v0.0.33

Published

NOVEMBERIZING STORAGE =====================

Downloads

38

Readme

NOVEMBERIZING STORAGE

ENGLISH | 한국어

Node js JavaScript

Github issues GitHub license GitHub release Npm version


"Novemberizing storage" is a library made in JavaScript that allows you to access storage and easily perform tasks such as creating, deleting, and modifying resources.

The goal of "Novemberizing storage" is to support memory, file system, and database as well as various other storage types so that storage can be changed easily by changing the "URL".

Class Diagram Log

The storage class has adapter: Adapter that executes actual commands and extension: Extension that can define additional commands as members. For example, in the case of a file system, adapter: Adapter basically has simple commands such as get(), set(value), del() to read, write, Only the method that can be deleted is implemented, but if you use extension: ExtensionJson, you can access the Json file and use a specific key value to define and use methods that can search, modify, or delete with a specific key of the Json object. .

const o = new Storage({ url: 'fs://./configure.json' });

console.log(o.set("hello.world", {}));
console.log(o.get("hello"));
console.log(o.del("hello"));

INSTALL

The storage library can be installed using "npm".

npm install --save @novemberizing/storage

USAGE

You can create storage objects with URL and execute commands.

const o = new Storage({ url:"fs://./configure.json" });

console.log(o.set("hello", "world"));
console.log(o.get(""));
console.log(o.del("hello"));

USE MEMORY STORAGE

To create and use memory-based storage, simply specify the protocol (mem:), host, and path in the URL. In the case of memory-based storage, all values in the storage are initialized when the application is created, and all values are lost when the application is closed. However, if an already created memory storage exists while the application is running, the previously saved value can be used.

const o = new Storage({ url: "mem://./configure.json" });

console.log(o.set("hello", "world"));
console.log(o.get(""));
console.log(o.del("hello"));

USE FILE STORAGE

File storage can be created by specifying the protocol (fs:), host, and path in URL just like memory storage. In the case of file storage, unlike memory storage, stored data can be used depending on the existence of a file, independent of application creation and termination.

const o = new Storage({ url: "fs://./configure.json" });

console.log(o.set("hello", "world"));
console.log(o.get(""));
console.log(o.del("hello"));

USE MYSQL DATABASE STORAGE

MYSQL database storage is used by internally creating an adapter that can use the database as a storage. In case of MYSQL database, if you want to use it like a file or memory, you can additionally define and use the extension setting. You can define and use get, set, del to use it like a JSON memory or file.

const o = new Storage({
    url: "mysql://user@localhost:3306/databasename",
    adapter: {
        password: "password"
    },
    extension: {
        get: { sql: "..." },
        set: { sql: "..." },
        del: { sql: "..." },
    }
});

console.log(o.set("hello", "world"));
console.log(o.get(""));
console.log(o.del("hello"));

USE JSON EXTENSION

You can use the JSON extension by specifying .json in the file extension. However, in the case of a database, methods such as get(key): object, set(key, value): object, del(key): object must be defined and used.

const fs = new Storage({ url: "fs://./configure.json" });

console.log(fs.set("hello", "world"));
console.log(fs.get(""));
console.log(fs.del("hello"));

const mem = new Storage({ url: "mem://./configure.json" });

console.log(mem.set("hello", "world"));
console.log(mem.get(""));
console.log(mem.del("hello"));

const mysql = new Storage({
    url: "mysql://user@localhost:3306/db",
    adapter: {
        password: "password"
    },
    extension: {
        get: { sql: "..." },
        set: { sql: "..." },
        del: { sql: "..." },
    }
});

console.log(mysql.set("hello", "world"));
console.log(mysql.get(""));
console.log(mysql.del("hello"));

DOCUMENT

Novemberizing storage api