{"_id":"slip","_rev":"5-787c68faf741727c132eb971edefb49c","name":"slip","description":"A Serial Line Internet Protocol (SLIP) library that runs in Node.js and the browser.","dist-tags":{"latest":"1.0.2"},"versions":{"1.0.1":{"name":"slip","main":"src/slip.js","version":"1.0.1","description":"A Serial Line Internet Protocol (SLIP) library that runs in Node.js and the browser.","author":{"name":"Colin Clark"},"homepage":"https://github.com/colinbdclark/slip.js","repository":{"type":"git","url":"git://github.com/colinbdclark/slip.js.git"},"bugs":{"url":"https://github.com/colinbdclark/slip.js/issues"},"licenses":[{"type":"MIT","url":"http://opensource.org/licenses/MIT"},{"type":"GPL","url":"http://opensource.org/licenses/GPL-3.0"}],"keywords":["Serial Line Internet Protocol","SLIP","Open Sound Control","OSC"],"devDependencies":{"qunit":"0.6.2","grunt":"~0.4.2","grunt-contrib-uglify":"~0.3.2","grunt-contrib-clean":"~0.4.1","grunt-contrib-jshint":"~0.8.0","grunt-contrib-qunit":"~0.5.1","grunt-node-qunit":"~2.0.2"},"dependencies":{},"_id":"slip@1.0.1","_shasum":"aae134dfc4add5de15ca59839058c8daa0218316","_from":"./","_npmVersion":"1.4.7","_npmUser":{"name":"colinbdclark","email":"colinbdclark@gmail.com"},"maintainers":[{"name":"colinbdclark","email":"colinbdclark@gmail.com"}],"dist":{"shasum":"aae134dfc4add5de15ca59839058c8daa0218316","tarball":"https://registry.npmjs.org/slip/-/slip-1.0.1.tgz","integrity":"sha512-n4qB2icbcZRQn2c3DADTgxyG6fDzv7rKdw67E+OBteBWCMK3tseYeb3VjjWiaNAp97e4rqM+hQTNIALahKP/KQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDYPz/99ppGvuBHeg7GAC2PFCtngJEpjM9tTjQz7Lk8dAIhAJC9VKQnDaXfhYkKswHujvmo2UeRoI0JtDAOvqKcqfWa"}]}},"1.0.2":{"name":"slip","main":"src/slip.js","version":"1.0.2","description":"A Serial Line Internet Protocol (SLIP) library that runs in Node.js and the browser.","author":{"name":"Colin Clark"},"homepage":"https://github.com/colinbdclark/slip.js","repository":{"type":"git","url":"git://github.com/colinbdclark/slip.js.git"},"bugs":{"url":"https://github.com/colinbdclark/slip.js/issues"},"license":"(MIT OR GPL-2.0)","keywords":["Serial Line Internet Protocol","SLIP","Open Sound Control","OSC"],"devDependencies":{"qunit":"0.6.2","grunt":"~0.4.2","grunt-contrib-uglify":"~0.3.2","grunt-contrib-clean":"~0.4.1","grunt-contrib-jshint":"~0.8.0","grunt-contrib-qunit":"~0.5.1","grunt-node-qunit":"~2.0.2"},"dependencies":{},"gitHead":"83cba9b1a5cd603c5794a45e64e42c2c0ad51938","_id":"slip@1.0.2","scripts":{},"_shasum":"ba45a923034d6cf41b1a27aebe7128282c8d551f","_from":".","_npmVersion":"2.12.1","_nodeVersion":"0.12.7","_npmUser":{"name":"colinbdclark","email":"colinbdclark@gmail.com"},"maintainers":[{"name":"colinbdclark","email":"colinbdclark@gmail.com"}],"dist":{"shasum":"ba45a923034d6cf41b1a27aebe7128282c8d551f","tarball":"https://registry.npmjs.org/slip/-/slip-1.0.2.tgz","integrity":"sha512-XrcHe3NAcyD3wO+O4I13RcS4/3AF+S9RvGNj9JhJeS02HyImwD2E3QWLrmn9hBfL+fB6yapagwxRkeyYzhk98g==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICfeOtmgocdTbsdmGwWIumjnkm4lC7sWXbS7igb4/kHFAiBNdM9CaXr4AQ03doS2PWOkGvr7DL+MB5riAaxoFcPH/w=="}]}}},"readme":"slip.js\n=======\n\nslip.js is a JavaScript library for encoding and decoding [Serial Line Internet Protocol](http://tools.ietf.org/html/rfc1055) packets. It works in both Node.js and in a web browser.\n\nHow Do I Use It?\n----------------\n\nslip.js provides two pieces of functionality: encoding and decoding messages.\n\n### Encoding\n\nEncoding is stateless and synchronous. `slip.encode()` takes any array-like object containing bytes, such as a Uint8Array, Node.js Buffer, ArrayBuffer, or plain JavaScript Array. It returns a Uint8Array containing the encoded message.\n\n#### Example\n\n```javascript\nvar message = new Uint8Array([99, 97, 116, 33]);\nvar slipEncoded = slip.encode(message); // Result is [192, 99, 97, 33, 192]\n```\n\n#### Options\n\n<table>\n    <tr>\n        <th>Option</th>\n        <th>Type</th>\n        <th>Description</th>\n        <th>Default value</th>\n    </tr>\n    <tr>\n        <td>bufferPadding</td>\n        <td><code>Number</code></td>\n        <td>_Optional_. The number of bytes to add to the message's length when initializing the encoder's internal buffer.</td>\n        <td>4</td>\n    </tr>\n    <tr>\n        <td>offset</td>\n        <td><code>Number</code></td>\n        <td>_Optional_. An offset index into the <code>data</code> argument to start reading the message from.</td>\n        <td><code>undefined</code></td>\n    </tr>\n    <tr>\n        <td>byteLength</td>\n        <td><code>Number</code></td>\n        <td>_Optional_. The number of bytes of the <code>data</code> argument to read.</td>\n        <td><code>undefined</code></td>\n    </tr>\n</table>\n\n### Decoding\n\nDecoding is stateful and asynchronous. You need to instantiate a `slip.Decoder` object, providing a callback that will be invoked whenever a complete message is received. By default, messages are limited to 10 MB in size. You can increase this value by providing a `maxBufferSize` option to the `Decoder` constructor, specified in bytes.\n\nTo decode a SLIP packet, call `decode()`. Whenever the `slip.Decoder` detects the end of an incoming message, it will call its `onMessage` callback.\n\n#### Example\n\n```javascript\nvar logMessage = function (msg) {\n    console.log(\"A SLIP message was received! Here is it: \" + msg);\n};\n\nvar decoder = new slip.Decoder({\n    onMessage: logMessage,\n    maxMessageSize: 209715200,\n    bufferSize: 2048\n});\n\ndecoder.decode(packet);\ndecoder.decode(otherPacket);\n```\n\n#### Options\n\n<table>\n    <tr>\n        <th>Option</th>\n        <th>Type</th>\n        <th>Description</th>\n        <th>Default value</th>\n    </tr>\n    <tr>\n        <td>bufferSize</td>\n        <td><code>Number</code></td>\n        <td>_Optional_. The initial size of the decoder's internal buffer. It will be resized as necessary.</td>\n        <td><code>1024</code></td>\n    </tr>\n    <tr>\n        <td>maxMessageSize</td>\n        <td><code>Number</code></td>\n        <td>_Optional_. The maximum size of incoming messages, in bytes. Messages larger than this value will cause the <code>onError</code> callback to be invoked.</td>\n        <td>10485760 (10 MB)</td>\n    </tr>\n    <tr>\n        <td>onMessage</td>\n        <td><code>Function</code></td>\n        <td>A callback that will be invoked whenever a complete message is decoded.</td>\n        <td><code>undefined</code></td>\n    </tr>\n    <tr>\n        <td>onError</td>\n        <td><code>Function</code></td>\n        <td>A callback that will be invoked whenever an error occurs.</td>\n        <td><code>undefined</code></td>\n    </tr>\n</table>\n\n#### Events\n\nThe `onMessage` callback's signature is:\n\n<table>\n    <tr>\n        <th>Argument</th>\n        <th>Type</th>\n        <th>Description</th>\n    </tr>\n    <tr>\n        <td>msg</td>\n        <td><code>Uint8Array</code></td>\n        <td>The decoded message, with SLIP characters removed.</td>\n    </tr>\n</table>\n\nThe `onError` callback's signature is:\n\n<table>\n    <tr>\n        <th>Argument</th>\n        <th>Type</th>\n        <th>Description</th>\n    </tr>\n    <tr>\n        <td>msgBuffer</td>\n        <td><code>Uint8Array</code></td>\n        <td>A copy of the internal message buffer.</td>\n    </tr>\n    <tr>\n        <td>errorMsg</td>\n        <td><code>String</code></td>\n        <td>The error message.</td>\n    </tr>\n</table>\n\nLicense\n-------\n\nslip.js is written by Colin Clark and distributed under the MIT and GPL 3 licenses.\n","maintainers":[{"name":"colinbdclark","email":"colinbdclark@gmail.com"}],"time":{"modified":"2022-06-26T21:00:03.564Z","created":"2014-06-01T21:11:22.758Z","1.0.1":"2014-06-01T21:11:22.758Z","1.0.2":"2015-07-25T20:34:26.784Z"},"homepage":"https://github.com/colinbdclark/slip.js","keywords":["Serial Line Internet Protocol","SLIP","Open Sound Control","OSC"],"repository":{"type":"git","url":"git://github.com/colinbdclark/slip.js.git"},"author":{"name":"Colin Clark"},"bugs":{"url":"https://github.com/colinbdclark/slip.js/issues"},"readmeFilename":"README.md","license":"(MIT OR GPL-2.0)"}