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

@types/concat-stream

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/concat-stream

TypeScript definitions for concat-stream

  • 2.0.0
  • ts3.8
  • ts3.9
  • ts4.0
  • ts4.1
  • ts4.2
  • ts4.3
  • ts4.4
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1.4M
increased by5.14%
Maintainers
1
Weekly downloads
 
Created

What is @types/concat-stream?

The @types/concat-stream package provides TypeScript type definitions for concat-stream, a writable stream that concatenates data and calls a callback with the result. It is useful for collecting stream data and processing it once the stream ends. This package does not contain functionality by itself but offers type support for TypeScript users of concat-stream.

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

Concatenating Buffer objects

This feature allows for concatenating multiple Buffer objects into a single Buffer. The code sample demonstrates how to use concat-stream with TypeScript to concatenate 'Hello', ' ', and 'World' into a single Buffer and log it.

import concat from 'concat-stream';
const write = concat((data: Buffer) => {
  console.log(data);
});
write.write(Buffer.from('Hello'));
write.write(Buffer.from(' '));
write.write(Buffer.from('World'));
write.end();

Concatenating strings

This feature enables the concatenation of string data. The example shows how to specify the encoding as 'string' to ensure that the callback receives a concatenated string instead of a Buffer.

import concat from 'concat-stream';
const write = concat({ encoding: 'string' }, (data: string) => {
  console.log(data);
});
write.write('Hello');
write.write(' ');
write.write('World');
write.end();

Concatenating typed arrays

This functionality allows for the concatenation of typed arrays, such as Uint8Array. The code sample demonstrates concatenating encoded strings into a single Uint8Array and decoding it back to a string for logging.

import concat from 'concat-stream';
const write = concat((data: Uint8Array) => {
  console.log(new TextDecoder().decode(data));
});
write.write(new TextEncoder().encode('Hello'));
write.write(new TextEncoder().encode(' '));
write.write(new TextEncoder().encode('World'));
write.end();

Other packages similar to @types/concat-stream

FAQs

Package last updated on 01 Feb 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