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

scattered-store

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

scattered-store - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

spec/support/jasmine.json

2

lib/persistence.js

@@ -13,3 +13,3 @@ "use strict";

var dateParser = function (key, value) {
var reISO = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2}(?:\.\d*))(?:Z|(\+|-)([\d|:]*))?$/;
var reISO = /^(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})\.(\d{3})Z$/;
if (typeof value === 'string') {

@@ -16,0 +16,0 @@ if (reISO.exec(value)) {

{
"name": "scattered-store",
"description": "Key-value store for large datasets",
"version": "0.1.3",
"version": "0.1.4",
"author": "Jakub Szwacz <jakub@szwacz.com>",

@@ -18,7 +18,7 @@ "keywords": [

"devDependencies": {
"jasmine-node": "1.14.x",
"jasmine": "^2.1.0",
"underscore": "^1.7.0"
},
"scripts": {
"test": "node_modules/.bin/jasmine-node spec",
"test": "node_modules/.bin/jasmine",
"benchmark": "node benchmark/benchmark"

@@ -25,0 +25,0 @@ },

@@ -6,3 +6,10 @@ scattered-store

### In what cases can it be useful?
- For some reason you can't or don't want to use serious database engine.
- For archiving data (you have a lot of rarely accessed data).
### How much data can it handle?
I would draw the line of sanity around 10M items in store, and max size of one item around 10MB. However only your disk size and used file system are real limitations.
# Way of storing data

@@ -27,11 +34,11 @@

## Pros
Every entry is stored in separate file what means:
### Pros
Every entry is stored in separate file what means...
* Implementation is very, very simple. All heavy lifting is done by file system.
* Dataset can safely grow to ridiculous size.
* Quite linear performance with growing dataset.
## Cons
Every entry is stored in separate file what means:
### Cons
Every entry is stored in separate file what means...
* If the entry is 10 bytes of data, it still occupies whole block on disk.
* Every operation is a separate I/O. Not much room for performance improvements with bulk tasks.
* Every operation is performed as separate I/O. Can't speed things up very much with bulk inserts or reads.

@@ -52,4 +59,6 @@

var store = scatteredStore.create('path/to/my/store', function (err) {
// This is optional callback function so you can know
// when the initialization is done.
if (err) {
// Oops! Something went wrong with initialization.
// Oops! Something went wrong.
} else {

@@ -60,4 +69,4 @@ // Initialization done!

// You don't have to wait for initialization to be done before calling API methods.
// All calls will be queued and delayed until initialization is ready.
// You don't have to wait for initialization to end before calling API methods.
// All calls will be queued and delayed automatically.
store.set('abc', 'Hello World!')

@@ -92,4 +101,4 @@ .then(function () {

## get(key)
Returns value stored on given `key`. If given `key` doesn't exist in database `null` is returned.
**Returns:** promise which when resolved returns value
Returns value stored on given `key`. If given `key` doesn't exist `null` is returned.
**Returns:** promise

@@ -116,3 +125,3 @@ ```js

stream.on('end', function () {
// All entries you asked for has been delivered.
// All entries you asked for had been delivered.
});

@@ -119,0 +128,0 @@ ```

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