New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

stream-storage

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

stream-storage - npm Package Compare versions

Comparing version 0.0.5 to 1.0.0

.eslintrc.json

19

package.json
{
"name": "stream-storage",
"version": "0.0.5",
"version": "1.0.0",
"description": "Node duplex buffer stream for caching data.",
"main": "index.js",
"keywords": [
"main": "index.mjs",
"keywords": [
"memory streams",

@@ -13,6 +13,8 @@ "streams",

"scripts": {
"test": "mocha"
"test": "mocha",
"lint": "eslint --color lib/*.mjs test/*.mjs *.mjs",
"prettier": "prettier lib/*.mjs test/*.mjs *.mjs --write"
},
"engines": {
"node": ">= 12.0.0"
"node": ">= 14.0.0"
},

@@ -31,4 +33,9 @@ "author": "dmitriym09 <dmitriym.09.12.1989@gmail.com>",

"chai": "^4.2.0",
"mocha": "^6.2.0"
"eslint": "^7.7.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-jsdoc": "^30.2.4",
"eslint-plugin-prettier": "^3.1.4",
"mocha": "^8.1.1",
"prettier": "^2.1.0"
}
}
# Node stream storage
![Version](https://img.shields.io/badge/version-0.0.5-green.svg)
![Version](https://img.shields.io/badge/version-1.0.0-green.svg)
![npm](https://img.shields.io/npm/dy/stream-storage)

@@ -8,5 +8,7 @@

## Installing
```bash
npm install stream-storage
```
npm install stream-storage --save
```

@@ -16,6 +18,6 @@ ## Usage

```js
const { StreamStorage } = require('stream-storage');
import { StreamStorage } from 'stream-storage';
const streamStorage = new StreamStorage();
// using ...
streamStorage.destroy();
streamStorage.clear();
```

@@ -25,3 +27,3 @@

**StreamStorage** extends the standard [stream.Duplex](https://nodejs.org/api/stream.html#stream_class_stream_duplex) interface. All writes data to this stream will accumulate in internal [Buffer](https://nodejs.org/api/buffer.html). If the internal buffer overflows it will be resized automatically. The initial size of the Buffer and the amount in which it grows can be configured in the constructor. Data exceeding the *maxSize* of the size will be saved to a file.
**StreamStorage** extends the standard [stream.Duplex](https://nodejs.org/api/stream.html#stream_class_stream_duplex) interface. All writes data to this stream will accumulate in internal [Buffers](https://nodejs.org/api/buffer.html). Data exceeding the *maxMemorySize* of the size will be saved to a file.

@@ -32,13 +34,17 @@ You can change default options:

const streamStorage = new StreamStorage({
initialSize: (8 * 1024), // initial memory buffer size
incrementAmount: (16 * 1024), // grow size after buffer overflows
maxSize: (32 * 1024), // max size buffer: will be saved to a file
tmpDir: '.', // temp dir for a file
chunkSize: (8 * 1024) // max reading chunk
maxMemorySize: (32 * 1024), // max memory size, bytes
tmpDir: '.', // temp dir for a file
pushMsec: 1, // pushed data interval, msec
chunkSize: (8 * 1024), // pushed data chunk size, bytes
});
```
For rereading data you can move current stream to new by `StreamStorage.move()`.
More using cases and examples you can see in [test](test/test.mjs).
## Contributors
* dmitriym09 <dmitriym.09.12.1989@gmail.com>
- dmitriym09 <dmitriym.09.12.1989@gmail.com>
Thanks to the [node-stream-buffer](https://github.com/samcday/node-stream-buffer) for inspiration!

@@ -51,2 +57,3 @@

For run test:
```js

@@ -56,3 +63,2 @@ npm run test

## versions

@@ -65,1 +71,2 @@

- **0.0.5** - fix pause
- **1.0.0** - .mjs, impl StreamStorage.move()
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