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.4 to 0.0.5

62

lib/stream.js

@@ -33,3 +33,3 @@ 'use strict';

this._buffer = Buffer.alloc(this._options.initialSize);
this._size = 0;
this.size = 0;
this._posWrite = 0;

@@ -56,2 +56,6 @@ this._fileSize = 0;

set posWrite(value) {
this._posWrite = value;
}
get posRead() {

@@ -61,2 +65,6 @@ return this._posRead;

set posRead(value) {
this._posRead = value;
}
get size() {

@@ -66,2 +74,6 @@ return this._size;

set size(value) {
this._size = value;
}
get fileSize() {

@@ -71,2 +83,6 @@ return this._fileSize;

set fileSize(value) {
this._fileSize = value;
}
get fileName() {

@@ -82,3 +98,3 @@ return this._fileName;

return new Promise((resolve, reject) => {
fs.write(this._fd, buffer, 0, buffer.length, this._fileSize, (err) => {
fs.write(this._fd, buffer, 0, buffer.length, this.fileSize, (err) => {
if (!!err) {

@@ -88,3 +104,3 @@ return reject(err);

this._fileSize += buffer.length;
this.fileSize += buffer.length;

@@ -100,3 +116,3 @@ resolve();

.then(() => {
this._posWrite = 0;
this.posWrite = 0;

@@ -107,3 +123,3 @@ if (chunk.length >= this._options.maxSize) {

chunk.copy(this._buffer, this.posWrite, 0);
this._posWrite += chunk.length;
this.posWrite += chunk.length;

@@ -154,3 +170,3 @@ return Promise.resolve();

chunk.copy(this._buffer, this.posWrite, 0);
this._posWrite += chunk.length;
this.posWrite += chunk.length;

@@ -161,3 +177,3 @@ return resolve();

chunk.copy(this._buffer, this.posWrite, 0);
this._posWrite += chunk.length;
this.posWrite += chunk.length;

@@ -172,3 +188,3 @@ return resolve();

.then(() => {
this._size += chunk.length;
this.size += chunk.length;
cb();

@@ -221,3 +237,3 @@ })

return new Promise((resolve, reject) => {
let size = this._fileSize;
let size = this.fileSize;
amount = Math.min(amount, size - this.posRead);

@@ -234,6 +250,8 @@ this._readFile(this._fd,

}) => {
const tmp = buffer.slice(0, bytesRead);
this._posRead += tmp.length;
this.push(tmp);
return Promise.resolve();
if (!this.isPaused()) {
const tmp = buffer.slice(0, bytesRead);
this.posRead += tmp.length;
this.push(tmp);
return Promise.resolve();
}
})

@@ -261,11 +279,13 @@ .then(resolve)

} else {
const chunk = Buffer.alloc(amount);
if (!this.isPaused()) {
const chunk = Buffer.alloc(amount);
this._buffer.copy(chunk,
0,
this._posRead - this._fileSize,
amount + this._posRead - this._fileSize
);
this.push(chunk);
this._posRead += chunk.length;
this._buffer.copy(chunk,
0,
this.posRead - this.fileSize,
amount + this.posRead - this.fileSize
);
this.push(chunk);
this.posRead += chunk.length;
}
}

@@ -272,0 +292,0 @@ }

{
"name": "stream-storage",
"version": "0.0.4",
"version": "0.0.5",
"description": "Node duplex buffer stream for caching data.",

@@ -5,0 +5,0 @@ "main": "index.js",

# Node stream storage
![Version](https://img.shields.io/badge/version-0.0.3-green.svg)
![Version](https://img.shields.io/badge/version-0.0.5-green.svg)
![npm](https://img.shields.io/npm/dy/stream-storage)

@@ -50,1 +50,10 @@

```
## versions
- **0.0.1** - init
- **0.0.2**
- **0.0.3**
- **0.0.4**
- **0.0.5** - fix pause
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