https://github.com/csimi/amf-packet
AMF0 packet serializer and deserializer
https://github.com/csimi/amf-packet
Last synced: 4 months ago
JSON representation
AMF0 packet serializer and deserializer
- Host: GitHub
- URL: https://github.com/csimi/amf-packet
- Owner: csimi
- License: isc
- Created: 2021-01-20T22:59:01.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2024-03-27T07:41:53.000Z (about 2 years ago)
- Last Synced: 2025-10-29T06:46:55.230Z (8 months ago)
- Language: JavaScript
- Size: 78.1 KB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license
Awesome Lists containing this project
README
[](https://www.npmjs.com/package/amf-packet)
[](https://github.com/csimi/amf-packet/actions)
[](https://codecov.io/gh/csimi/amf-packet)
# 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](https://www.npmjs.com/package/amf-codec).