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

@types/readable-stream

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/readable-stream

TypeScript definitions for readable-stream

  • 2.3.14
  • ts4.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.7M
decreased by-5.79%
Maintainers
1
Weekly downloads
 
Created

What is @types/readable-stream?

The @types/readable-stream package provides TypeScript type definitions for the readable-stream package, which is a userland implementation of the Streams API from Node.js. This allows developers to use and interact with streams in a type-safe manner, ensuring that the code adheres to the expected interfaces and behaviors of streams.

What are @types/readable-stream's main functionalities?

Creating a readable stream

This feature allows you to create a readable stream that you can push data into. The stream can then be consumed by other parts of your application.

import { Readable } from 'readable-stream';

const readable = new Readable({
  read(size) {
    this.push('some data');
    this.push(null); // No more data
  }
});
readable.on('data', (chunk) => console.log(chunk.toString()));

Piping a readable stream to a writable stream

This demonstrates how to pipe data from a readable stream directly into a writable stream, effectively transferring data from one source to a destination.

import { Readable, Writable } from 'readable-stream';

const readable = new Readable({
  read(size) {
    this.push('data to write');
    this.push(null); // No more data
  }
});

const writable = new Writable({
  write(chunk, encoding, callback) {
    console.log(chunk.toString());
    callback();
  }
});

readable.pipe(writable);

Other packages similar to @types/readable-stream

FAQs

Package last updated on 17 Jul 2022

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