peek-readable
Advanced tools
Comparing version 5.0.0-alpha.3 to 5.0.0-alpha.4
@@ -5,2 +5,4 @@ import { EndOfStreamError } from './EndOfFileStream.js'; | ||
constructor() { | ||
this.resolve = () => null; | ||
this.reject = () => null; | ||
this.promise = new Promise((resolve, reject) => { | ||
@@ -16,2 +18,6 @@ this.reject = reject; | ||
this.s = s; | ||
/** | ||
* Deferred read request | ||
*/ | ||
this.request = null; | ||
this.endOfStream = false; | ||
@@ -61,2 +67,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,2 +119,4 @@ buffer.set(peekData.subarray(0, lenCopy), offset + bytesRead); | ||
tryRead() { | ||
if (!this.request) | ||
throw new Error('this.request should be defined'); | ||
const readBuffer = this.s.read(this.request.length); | ||
@@ -113,0 +123,0 @@ if (readBuffer) { |
{ | ||
"name": "peek-readable", | ||
"version": "5.0.0-alpha.3", | ||
"version": "5.0.0-alpha.4", | ||
"description": "Read and peek from a readable stream", | ||
@@ -28,3 +28,3 @@ "author": { | ||
"engines": { | ||
"node": ">=12.20" | ||
"node": "^12.20.0 || ^14.13.1 || >=16.0.0" | ||
}, | ||
@@ -48,6 +48,7 @@ "repository": { | ||
"devDependencies": { | ||
"@types/chai": "^4.2.21", | ||
"@types/mocha": "^9.0.0", | ||
"@types/node": "^16.4.6", | ||
"@types/node": "^16.4.10", | ||
"@typescript-eslint/eslint-plugin": "^4.28.5", | ||
"@typescript-eslint/parser": "^4.28.3", | ||
"@typescript-eslint/parser": "^4.28.5", | ||
"add": "^2.0.6", | ||
@@ -58,3 +59,3 @@ "c8": "^7.8.0", | ||
"del-cli": "^4.0.1", | ||
"eslint": "^7.30.0", | ||
"eslint": "^7.32.0", | ||
"mocha": "^9.0.3", | ||
@@ -61,0 +62,0 @@ "remark-cli": "^9.0.0", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13619
196
16