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

pipe-io

Package Overview
Dependencies
Maintainers
1
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pipe-io - npm Package Compare versions

Comparing version 1.2.8 to 2.0.0

legacy/index.js

68

lib/pipe.js
'use strict';
var fs = require('fs');
var zlib = require('zlib');
var assert = require('assert');
var pullout = require('pullout/legacy');
const fs = require('fs');
const zlib = require('zlib');
const assert = require('assert');
module.exports = all;
module.exports.getBody = function getBody(readStream, callback) {
return pullout(readStream, 'string', callback);
}
function all(streams, options, callback) {
module.exports = (streams, options, callback) => {
if (!callback) {

@@ -21,4 +14,5 @@ callback = options;

};
} else if (typeof options.end === 'undefined')
} else if (typeof options.end === 'undefined') {
options.end = true;
}

@@ -32,3 +26,3 @@ assert(streams, 'streams could not be empty!');

function pipe(allStreams, options, callback) {
var error, finish, end, open,
let error, finish, end, open,
readError, writeError,

@@ -42,15 +36,15 @@

isFsWrite = write instanceof fs.WriteStream,
isGunzip = allStreams.some(function(write) {
isGunzip = allStreams.some((write) => {
return write instanceof zlib.Gunzip
}),
isGzip = allStreams.some(function(write) {
isGzip = allStreams.some((write) => {
return write instanceof zlib.Gzip
}),
rm = function(event, stream, fn) {
rm = (event, stream, fn) => {
stream.removeListener(event, fn);
},
rmAll = function() {
rmAll = () => {
rm('error', write, onWriteError);

@@ -68,6 +62,6 @@ rm('error', read, onReadError);

callWhenOpen(write, function(e) {
callWhenOpen(write, (e) => {
if (e) {
onWriteError(e);
read.on('readable', function() {
read.on('readable', () => {
read.resume();

@@ -120,4 +114,4 @@ });

function onResult() {
var justEnd = end && !options.end;
var bothFinish = end && finish;
const justEnd = end && !options.end;
const bothFinish = end && finish;

@@ -151,14 +145,14 @@ if (readError && finish) {

function callWhenOpen(stream, fn) {
var isFsWrite = stream instanceof fs.WriteStream,
on = function(error) {
var isError = error instanceof Error;
stream.removeListener('open', on);
stream.removeListener('error', on);
if (isError)
fn(error);
else
fn();
};
const isFsWrite = stream instanceof fs.WriteStream;
const on = (error) => {
const isError = error instanceof Error;
stream.removeListener('open', on);
stream.removeListener('error', on);
if (isError)
fn(error);
else
fn();
};

@@ -174,5 +168,5 @@ if (!isFsWrite) {

function fullPipe(streams, options) {
var main;
let main;
streams.forEach(function(stream) {
streams.forEach((stream) => {
if (!main)

@@ -188,3 +182,3 @@ main = stream;

function setListeners(streams, fn) {
streams.forEach(function(stream) {
streams.forEach((stream) => {
stream.on('error', fn);

@@ -195,5 +189,5 @@ });

function unsetListeners(streams, fn) {
streams.forEach(function(stream) {
streams.forEach((stream) => {
stream.removeListener('error', fn);
});
}
{
"name": "pipe-io",
"version": "1.2.8",
"version": "2.0.0",
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)",

@@ -16,13 +16,16 @@ "description": "Pipe streams and handle events",

"scripts": {
"test": "tape test/*.js",
"lint": "redrun lint:*",
"lint:lib": "eslint lib",
"lint:test": "eslint --rule 'no-console:0' test",
"test": "tape test/*.js",
"watch:test": "nodemon -w lib -w test -x \"npm test\"",
"watch:test": "npm run watcher -- \"npm test\"",
"watcher": "nodemon -w lib -w test -x",
"coverage": "nyc npm test",
"report": "nyc report --reporter=text-lcov | coveralls"
"report": "nyc report --reporter=text-lcov | coveralls",
"wisdom": "npm run build",
"6to5": "buble lib -o legacy",
"build": "redrun 6to5 legacy",
"legacy": "echo \"module.exports = require('./pipe');\" > legacy/index.js"
},
"dependencies": {
"pullout": "^1.0.0"
},
"dependencies": {},
"license": "MIT",

@@ -34,2 +37,3 @@ "engines": {

"devDependencies": {
"buble": "^0.14.2",
"coveralls": "^2.11.6",

@@ -39,2 +43,3 @@ "eslint": "^3.8.1",

"nyc": "^8.3.2",
"pullout": "^1.0.1",
"redrun": "^5.9.2",

@@ -41,0 +46,0 @@ "tape": "^4.2.0",

@@ -43,2 +43,11 @@ Pipe-io [![License][LicenseIMGURL]][LicenseURL] [![NPM version][NPMIMGURL]][NPMURL] [![Dependency Status][DependencyStatusIMGURL]][DependencyStatusURL] [![Build Status][BuildStatusIMGURL]][BuildStatusURL] [![Coverage Status][CoverageIMGURL]][CoverageURL]

```
## Environments
In old `node.js` environments that not fully supports `es2015`, `pullout` could be used with:
```js
var pipe = require('pipe-io/legacy');
```
## Related

@@ -45,0 +54,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