Socket
Socket
Sign inDemoInstall

peek-readable

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

peek-readable - npm Package Compare versions

Comparing version 4.0.0 to 4.0.1

0

lib/EndOfFileStream.d.ts

@@ -0,0 +0,0 @@ export declare const defaultMessages = "End-Of-Stream";

@@ -0,0 +0,0 @@ "use strict";

@@ -0,0 +0,0 @@ /// <reference types="node" />

16

lib/index.js

@@ -9,2 +9,4 @@ "use strict";

constructor() {
this.resolve = () => null;
this.reject = () => null;
this.promise = new Promise((resolve, reject) => {

@@ -20,2 +22,6 @@ this.reject = reject;

this.s = s;
/**
* Deferred read request
*/
this.request = null;
this.endOfStream = false;

@@ -65,2 +71,4 @@ /**

const peekData = this.peekQueue.pop(); // Front of queue
if (!peekData)
throw new Error('peekData should be defined');
const lenCopy = Math.min(peekData.length, remaining);

@@ -111,10 +119,8 @@ buffer.set(peekData.subarray(0, lenCopy), offset + bytesRead);

});
return this.request.deferred.promise.then(n => {
return n;
}, err => {
throw err;
});
return this.request.deferred.promise;
}
}
tryRead() {
if (!this.request)
throw new Error('this.request should be defined');
const readBuffer = this.s.read(this.request.length);

@@ -121,0 +127,0 @@ if (readBuffer) {

{
"name": "peek-readable",
"version": "4.0.0",
"version": "4.0.1",
"description": "Read and peek from a readable stream",

@@ -45,6 +45,7 @@ "author": {

"devDependencies": {
"@types/mocha": "^8.2.3",
"@types/node": "^16.3.2",
"@typescript-eslint/eslint-plugin": "^4.28.3",
"@typescript-eslint/parser": "^4.28.3",
"@types/chai": "^4.2.21",
"@types/mocha": "^9.0.0",
"@types/node": "^16.4.10",
"@typescript-eslint/eslint-plugin": "^4.28.5",
"@typescript-eslint/parser": "^4.28.5",
"add": "^2.0.6",

@@ -54,4 +55,4 @@ "chai": "^4.3.4",

"del-cli": "^4.0.1",
"eslint": "^7.30.0",
"mocha": "^9.0.2",
"eslint": "^7.32.0",
"mocha": "^9.0.3",
"nyc": "^15.1.0",

@@ -58,0 +59,0 @@ "remark-cli": "^9.0.0",

@@ -0,0 +0,0 @@ ![Node.js CI](https://github.com/Borewit/peek-readable/workflows/Node.js%20CI/badge.svg)

Sorry, the diff of this file is not supported yet

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