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

promise-readable

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

promise-readable - npm Package Compare versions

Comparing version 5.0.4 to 6.0.0

6

CHANGELOG.md
# Changelog
## v6.0.0 2020-08-09
- Requires Node >= 10.
- Converted from tslint to eslint.
- Uses @types/node v14.npm
## v5.0.4 2019-12-24

@@ -4,0 +10,0 @@

4

lib/promise-readable.d.ts

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

readonly stream: TReadable;
static [Symbol.hasInstance](instance: any): boolean;
readonly _isPromiseReadable: boolean;
_errored?: Error;
constructor(stream: TReadable);
static [Symbol.hasInstance](instance: any): boolean;
read(size?: number): Promise<Buffer | string | undefined>;
readAll(): Promise<Buffer | string | undefined>;
setEncoding(encoding: string): this;
setEncoding(encoding: BufferEncoding): this;
once(event: "close" | "end" | "error"): Promise<void>;

@@ -19,0 +19,0 @@ once(event: "open"): Promise<number>;

"use strict";
/// <reference types="node" />
Object.defineProperty(exports, "__esModule", { value: true });
exports.PromiseReadable = void 0;
require("core-js/modules/es.symbol.async-iterator");

@@ -189,16 +190,15 @@ class PromiseReadable {

},
next() {
async next() {
if (wasEof) {
return Promise.resolve({ value: "", done: true });
return { value: "", done: true };
}
else {
return promiseReadable.read(size).then(value => {
if (value === undefined) {
wasEof = true;
return { value: "", done: true };
}
else {
return { value, done: false };
}
});
const value = await promiseReadable.read(size);
if (value === undefined) {
wasEof = true;
return { value: "", done: true };
}
else {
return { value, done: false };
}
}

@@ -205,0 +205,0 @@ },

{
"name": "promise-readable",
"version": "5.0.4",
"version": "6.0.0",
"description": "Return promise for readable stream",

@@ -23,33 +23,36 @@ "main": "lib/promise-readable.js",

"engines": {
"node": ">=6.0.0"
"node": ">=10.0.0"
},
"dependencies": {
"core-js": "^3.6.1"
"core-js": "^3.6.5"
},
"devDependencies": {
"@types/chai": "^4.2.7",
"@types/chai": "^4.2.12",
"@types/core-js": "^2.5.3",
"@types/dirty-chai": "^2.0.2",
"@types/mocha": "^5.2.7",
"@types/node": "^12.12.22",
"@types/semver": "^6.2.0",
"@types/mocha": "^8.0.1",
"@types/node": "^14.0.27",
"@types/semver": "^7.3.1",
"@typescript-eslint/eslint-plugin": "^3.8.0",
"@typescript-eslint/eslint-plugin-tslint": "^3.8.0",
"@typescript-eslint/parser": "^3.8.0",
"chai": "^4.2.0",
"changelog-parser": "^2.8.0",
"coveralls": "^3.0.9",
"cross-env": "^6.0.3",
"coveralls": "^3.1.0",
"cross-env": "^7.0.2",
"dirty-chai": "^2.0.1",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.7.0",
"eslint-plugin-import": "^2.19.1",
"eslint-plugin-node": "^10.0.0",
"markdownlint-cli": "^0.20.0",
"mocha": "^6.2.2",
"eslint": "^7.6.0",
"eslint-config-prettier": "^6.11.0",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jsdoc": "^30.2.1",
"eslint-plugin-node": "^11.1.0",
"markdownlint-cli": "^0.23.2",
"mocha": "^8.1.1",
"mocha-steps": "^1.3.0",
"nyc": "^15.0.0",
"prettier": "^1.19.1",
"semver": "^7.1.1",
"nyc": "^15.1.0",
"prettier": "^2.0.5",
"semver": "^7.3.2",
"shx": "^0.3.2",
"ts-node": "^8.5.4",
"tslint": "^5.20.1",
"tslint-config-prettier": "^1.18.0",
"typescript": "^3.7.4"
"ts-node": "^8.10.2",
"typescript": "^3.9.7"
},

@@ -61,3 +64,9 @@ "scripts": {

"clean:coverage": "shx rm -rf coverage .nyc_output",
"lint": "npm run compile && tsc --pretty -p examples && tsc --pretty -p test && eslint . && tslint -t stylish -p . && tslint -t stylish -p examples && tslint -t stylish -p test && prettier --ignore-path .gitignore --list-different '**/*.{js,json,md,ts,yml}' && markdownlint \"*.md\"",
"lint": "npm run lint:tsc:src && npm run lint:tsc:test && npm run lint:tsc:examples && npm run lint:eslint && npm run lint:prettier && npm run lint:markdownlint",
"lint:tsc:examples": "tsc --noEmit --pretty --project examples",
"lint:tsc:src": "tsc --noEmit --pretty --project .",
"lint:tsc:test": "tsc --noEmit --pretty --project test",
"lint:eslint": "eslint --ext .js,.ts .",
"lint:prettier": "prettier --ignore-path .gitignore --list-different '**/*.{js,json,md,ts,yml}'",
"lint:markdownlint": "markdownlint \"*.md\"",
"postpublish": "node -e \"require(\\\"changelog-parser\\\")(\\\"CHANGELOG.md\\\").then(ch => console.log(ch.versions.filter(v => v.version === \\\"$npm_package_version\\\").map(v => \\\"v$npm_package_version\\n\\n\\\" + v.body).concat(\\\"Release v$npm_package_version\\\")[0]))\" | xargs -0 git tag v$npm_package_version -a -m && git push --tags",

@@ -64,0 +73,0 @@ "prepack": "npm run compile",

@@ -13,6 +13,2 @@ /// <reference types="node" />

export class PromiseReadable<TReadable extends ReadableStream> implements AsyncIterable<Buffer | string> {
static [Symbol.hasInstance](instance: any): boolean {
return instance._isPromiseReadable
}
readonly _isPromiseReadable: boolean = true

@@ -26,2 +22,6 @@

static [Symbol.hasInstance](instance: any): boolean {
return instance._isPromiseReadable
}
read(size?: number): Promise<Buffer | string | undefined> {

@@ -143,3 +143,3 @@ const stream = this.stream

setEncoding(encoding: string): this {
setEncoding(encoding: BufferEncoding): this {
this.stream.setEncoding(encoding)

@@ -241,14 +241,13 @@ return this

next(): Promise<IteratorResult<Buffer | string>> {
async next(): Promise<IteratorResult<Buffer | string>> {
if (wasEof) {
return Promise.resolve({value: "", done: true})
return {value: "", done: true}
} else {
return promiseReadable.read(size).then(value => {
if (value === undefined) {
wasEof = true
return {value: "", done: true}
} else {
return {value, done: false}
}
})
const value = await promiseReadable.read(size)
if (value === undefined) {
wasEof = true
return {value: "", done: true}
} else {
return {value, done: false}
}
}

@@ -255,0 +254,0 @@ },

@@ -6,3 +6,3 @@ {

"importHelpers": true,
"lib": ["es6"],
"lib": ["es2018"],
"module": "commonjs",

@@ -16,3 +16,3 @@ "noImplicitAny": true,

"strict": true,
"target": "es6",
"target": "es2018",
"typeRoots": ["node_modules/@types"]

@@ -19,0 +19,0 @@ },

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