8b10b 中文文档教程
8b10b
8b10b 行编解码器的 ECMAScript 实现。
使用它将字节转换为 10 位符号,反之亦然。 它只与数据符号相互转换; 控制符号应由您的应用程序拦截和处理。
Installation
npm install --save 8b10b
Usage
const { Encoder, Decoder } = require('8b10b');
const encoder = new Encoder(),
decoder = new Decoder();
const encoded = encoder.encode(42);
// => 345
decoder.decode(encoded);
// => 42
Testing
测试使用带 Chai 的 Mocha。 要运行,请使用 npm run test
。
License
请参阅 LICENSE.txt
Thanks
大多数编码器已从 fontesrp/encoding_8b10b。
8b10b
An ECMAScript implementation of the 8b10b line codec.
Use it to convert bytes to 10-bit symbols and vise-versa. It only converts to and from data symbols; control symbols should be intercepted and handled by your application.
Installation
npm install --save 8b10b
Usage
const { Encoder, Decoder } = require('8b10b');
const encoder = new Encoder(),
decoder = new Decoder();
const encoded = encoder.encode(42);
// => 345
decoder.decode(encoded);
// => 42
Testing
Tests use Mocha w/ Chai. To run, use npm run test
.
License
See LICENSE.txt
Thanks
Most of the encoder was converted to JavaScript from fontesrp/encoding_8b10b.