npm.io
1.0.3 • Published 2 months ago

amf-packet

Licence
ISC
Version
1.0.3
Deps
1
Size
5 kB
Vulns
0
Weekly
0
Stars
1

npm version build status codecov

About

AMF0 packet serializer and deserializer.

Usage

Install using npm:

$ npm install amf-packet

Serialize

const { serializeAMF } = require('amf-packet');

const headers = {
	'foo': 'bar',
};
const messages = [{
	'targetUri': 'Service.doSomething',
	'responseUri': '/0',
	'body': [],
}];

console.log(serializeAMF(headers, messages));

Deserialize

const { deserializeAMF } = require('amf-packet');

const {
	headers,
	messages,
} = deserializeAMF(buf);
const {
	targetUri,
	responseUri,
	body,
} = messages[0];

Implementation notes

The must-understand flag of headers is not implemented.

Message body can be any value supported by amf-codec.

Keywords