Socket
Socket
Sign inDemoInstall

@types/readable-stream

Package Overview
Dependencies
3
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @types/readable-stream

TypeScript definitions for readable-stream


Version published
Weekly downloads
1.2M
decreased by-0.78%
Maintainers
1
Install size
2.06 MB
Created
Weekly downloads
 

Package description

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

Readme

Source

Installation

npm install --save @types/readable-stream

Summary

This package contains type definitions for readable-stream (https://github.com/nodejs/readable-stream).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/readable-stream.

Additional Details

  • Last updated: Sun, 17 Mar 2024 16:35:17 GMT
  • Dependencies: @types/node, safe-buffer

Credits

These definitions were written by TeamworkGuy2, and markdreyer.

FAQs

Last updated on 17 Mar 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc