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

1.1.0 • Public • Published

StreamUDP

npm Build Status

Blazing-fast Node Stream implementation over UDP. You can stream your Stream using UDP protocol.

Install

npm i stream-udp

Usage

Typescript:

import { StreamUDP } from 'stream-udp'

// Create a new UDPStream socket instance
let socket = new StreamUDP()

// Connect to another StreamUDP socket (just as a UDP socket)
socket.connect('localhost', 42069)

// Now you can send data...
ABeautifuldReadableStream.pipe(socket)

// ...Or receive it
socket.pipe(CoolWritableStream)

Javascript:

const streamSocket = require('stream-udp')

// Create a new UDPStream socket instance
let socket = new streamSocket.StreamUDP()

// Connect to another StreamUDP socket (just as a UDP socket)
socket.connect('localhost', 42069)

// Now you can send data...
ABeautifuldReadableStream.pipe(socket)

// ...Or receive it
socket.pipe(CoolWritableStream)

Reminder: UDP is a connectionless protocol which means there are no clients or servers. It's just two socket sending data to each other, without retrasmission nor datagram reordering.

API

StreamUDP Class extends Duplex Stream so you can call all of its methods.

Method Description
bind(port: number) Bind the underlying socket to the provided port
connect(address:string, port: number, callback) Connect the socket

Contributing

Feel free to contribute, just open a PR. I apologize for any errors but this is my first repo of a public NPM Pakckage, also english is not my first language.

Dependents (0)

Package Sidebar

Install

npm i stream-udp

Weekly Downloads

5

Version

1.1.0

License

GPL-3.0

Unpacked Size

42.2 kB

Total Files

5

Last publish

Collaborators

  • ferrohd