This is an AMF library supporting AMF0 and AMF3. It's written to be as accurate as possible to AMF in Actionscript.
npm install node-amf
You can find tests in /spec/
using tape
.
A simple usage example:
const AMF0 = require("node-amf")
const amf = new AMF() // AMF3
amf.writeData({ id: 1 })
amf.readData() // { id: 1 }
amf.version = 0 // AMF0
amf.writeData({ id: 1 })
amf.readData() // { id: 1 }
Type | Write | Read | Reason for exclusion |
---|---|---|---|
Number | ✔ | ✔ | - |
Boolean | ✔ | ✔ | - |
String | ✔ | ✔ | - |
Object | ✔ | ✔ | - |
Null | ✔ | ✔ | - |
Undefined | ✔ | ✔ | - |
Reference | ✔ | ✔ | - |
ECMA array | ✔ | ✔ | - |
Strict array | ✗ | ✔ | AMF0 standards to ECMA array for writing |
Date | ✔ | ✔ | - |
Long string | ✔ | ✔ | - |
XML document | ✗ | ✗ | Who needs XML? |
Typed object | ✔ | ✔ | - |
Type | Write | Read | Reason for exclusion |
---|---|---|---|
Undefined | ✔ | ✔ | - |
Null | ✔ | ✔ | - |
Boolean | ✔ | ✔ | - |
Integer | ✔ | ✔ | - |
Double | ✔ | ✔ | - |
String | ✔ | ✔ | - |
XML document | ✗ | ✗ | Who needs XML? |
Date | ✔ | ✔ | - |
Array | ✔ | ✔ | - |
Object | ✔ | ✔ | - |
XML | ✗ | ✗ | Who needs XML? |
ByteArray | ✔ | ✔ | - |
Vector | ✗ | ✗ | No type in JS |
Dictionary | ✗ | ✗ | No type in JS |