New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

duplex-through-with-error-handling

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

duplex-through-with-error-handling

A simple utility to create duplex streams with bidirectional error handling.

  • 1.0.11
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
3
decreased by-85.71%
Maintainers
0
Weekly downloads
 
Created
Source

Duplex Through With Error Handling

A simple utility to create duplex streams with bidirectional error handling.

Uses duplex-through

Installation

To install run:

npm install duplex-through-with-error-handling

Usage

import { duplexThrough } from 'duplex-through-with-error-handling';

const [d1, d2] = duplexThrough({ /* options for duplex streams */ });

// Write data to the stream 1
d1.write('some data');

// Read data from the stream 2
d2.on('data', (data) => {
    // data === "some data"
});

d2.on("error", e => {
    // e.message === "some error from d1"
});

d1.on("error", e => {
    // e.message === "some error from d1" 
});

d1.destroy(new Error("some error from d1"))

Features

  • Creates duplex streams
  • Handles errors bidirectionally to prevent unhandled error events
  • Ensures cleanup of error handlers on stream close

FAQs

Package last updated on 31 Aug 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

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