async-mutex-stream
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

async-mutex-stream

npm version npm downloads

This package is a TypeScript library for handling asynchronous streams with mutex locking and piping capabilities.

Installation

npm install async-mutex-stream
# or
pnpm add async-mutex-stream

Dependencies

This package requires the following dependencies:

Features

  • Mutex-based synchronization for stream operations
  • Support for async generators
  • Piping between streams
  • Error handling and state management
  • Strict type checking
  • Stream multicasting

Basic Usage

Simple Stream

Create a basic stream that processes string data:

import { AsyncMutexStream } from 'async-mutex-stream';

const stream = new AsyncMutexStream({
	start: async () => {
		// Optional initialization
		console.log('Stream started');
	},
	write: async (data: string) => {
		// Process the data
		console.log(`Processing: ${data}`);
	},
	end: async () => {
		// Optional cleanup
		console.log('Stream ended');
	},
});
// Use the stream
await stream.write('Hello');
await stream.write('World');
await stream.end();

License

MIT License

Package Sidebar

Install

npm i async-mutex-stream

Weekly Downloads

1

Version

0.1.0

License

MIT

Unpacked Size

14.6 kB

Total Files

7

Last publish

Collaborators

  • arumi-s