Package Exports
- docker-frame
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (docker-frame) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
docker-frame
create a docker stream frame (header and payload)
Usage
var createDockerFrame = require('docker-frame');
var str = hello;
var frame = createDockerFrame(1, str); // accepts string or buffer
// header
console.log(frame.readUInt8(0)); // payload-type: 1
console.log(frame.readUInt32BE(4)) // payload-size: 5 // 'hello'.length
// payload
console.log(frame.slice(8).toString()) // payload: hello
Docs
/**
* Create a docker stream frame (header and payload)
* @param {number} type - 2=stderr, 1=stdout, 0=stdin
* @param {string|buffer} payload
* @returns {buffer} frame - frame header (type, length) and payload as buffer
*/
License
MIT