🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

frax

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

frax

Frame extractor from data stream.

0.0.2
latest
Source
npm
Version published
Weekly downloads
8
100%
Maintainers
1
Weekly downloads
 
Created
Source

frax

Frame extractor from data stream (e.g. TCP).

Installation

$ npm install frax

Features

  • Extracts frames delimited by frame header (frame length)
  • Supports various frame header lengths (1, 2, 4 bytes)
  • Frame header length 2 is equivalent to RFC 4571.
+--+-------------+--+-------------+--+-------------+
|FH|   Frame 1   |FH|   Frame 2   |FH|   Frame 3   | ...
+--+-------------+--+-------------+--+-------------+
FH: Frame header contains frame length in bytes (big-endian)
    The length does not include the frame header itself.
Frame: Application data.

API

Module method

  • create([headerLen]) Creates an instance of frax. The headerLen should either be 1, 2 or 4, or defaults to 2 otherwise.

Instance method

  • frax.input(buf) - Input stream data. The buf is of type Buffer.
  • frax.headerSize (getter) - Returns frame header size used by the instance.
  • frax.reset() - Reset the internal state. Probably useless expect for test purposes.
  • Event: 'data' - Emitted when a complete frame is ready. The argument buf will be a Buffer.

Example

var frax = require('frax').create();

// Set up data event handler
frax.on('data', function (frame) {
    console.log('%d bytes of frame received', frame.length);
});

// Pass incoming data into frax directly.
soc.on('data', function (buf) {
    frax.input(buf);
});

Keywords

Framing

FAQs

Package last updated on 25 Jul 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts