0.4.0 • Published 3 years ago

@sz-md/postman v0.4.0

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

@sz-md/postman

A very simple asynchronous protocol using a 2 byte packet size header allowing for data transfers of up to 64kBytes.

This protcol is intended for local inter process communication (IPC), but can be used outside of that scope.

API:

const postman = require("@sz-md/postman")
const instance = await postman.create(options)

// You need to provide read/write functions like this:
instance.sendBytes = function(bytes) {
	// Send "bytes" array, bytes is an Uint8Array
}

// Call receiveBytes to process incoming data (Uint8Array)
instance.receiveBytes(buffer)

// Sending messages...
instance.send("A string")
instance.send({
	value: 100
})

// Receiving them:
await instance.receive()

Where options is an object:

{
	_maxQueueLength: 10 /* see @sz-md/mutex */
}
0.4.0

3 years ago

0.3.0

3 years ago

0.2.0

3 years ago

0.1.2

3 years ago

0.1.1

3 years ago

0.1.0

3 years ago