Skip to content

PrinOrange/simple-oss

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Simple OSS

This is a local object storage tool written in Node.js.
It allows you to store arbitrary serializable data in json format.

Start

Install the dependencies.

npm install

And run build to generate two target library for ESModule and CommonJS Module.

npm run build

Usage

import the module. This library offers two library for ESM and CommonJS module.

import SimpleOSS from 'simple-oss';   // For ESM

var SimpleOSS = require('simple-oss') // For CommonJS module.

And then create an SimpleOSS instance.

const OSS = SimpleOSS.createSimpleOSS('/path/to/storage');

The path/to/storage means that the storage directory for data. It stores serialized object data.

And next you can do operators such as set, get and del.

For example, to set an value.

const value = { prop: 'data' }
OSS.set(value,'key-name')

And get the value for specified key. It will return null if the key does not exist.

OSS.get('key-name') // { prop: 'data'}
OSS.get('other') // null

To delete the key-value.

OSS.del('key-name')

To check if key-value pair exists

OSS.exist('key-name') // false

About

The simple OSS (Object Storage Service) for nodejs

Resources

Stars

Watchers

Forks

Packages

 
 
 

Contributors