Skip to content

Instantly share code, notes, and snippets.

@gabonator
gabonator / alifeng.js
Created December 2, 2017 12:01
Ali tech stb (abcom cryptobox) protocol including RTSP video streaming to VLC
var net = require('net');
const zlib = require('zlib');
Ali =
{
_decompress: (buffer, handler) => zlib.unzip(buffer, {}, (err, buffer) => err ? handler() : handler(buffer.toString())),
_alibuffer: (buffer) => "Start" + ("0000000" + buffer.length).substr(-7) + "End" + buffer,
_alijson: (json) => Ali._alibuffer(JSON.stringify(json)),
_requestBytes: 0,
_responseBuffers: [],