Dia antes primera install

This commit is contained in:
2025-12-08 15:20:28 -06:00
commit 1416478c9c
4130 changed files with 886376 additions and 0 deletions

21
node_modules/@serialport/parser-packet-length/LICENSE generated vendored Normal file
View File

@@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright 2010 Christopher Williams. All rights reserved.
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to
deal in the Software without restriction, including without limitation the
rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
sell copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
IN THE SOFTWARE.

View File

@@ -0,0 +1,3 @@
# @serialport/parser-packet-length
The documentation at https://serialport.io/docs/api-parser-packet-length

View File

@@ -0,0 +1,42 @@
/// <reference types="node" />
/// <reference types="node" />
import { Transform, TransformCallback, TransformOptions } from 'stream';
export interface PacketLengthOptions extends TransformOptions {
/** delimiter to use defaults to 0xaa */
delimiter?: number;
/** overhead of packet (including length, delimiter and any checksum / packet footer) defaults to 2 */
packetOverhead?: number;
/** number of bytes containing length defaults to 1 */
lengthBytes?: number;
/** offset of length field defaults to 1 */
lengthOffset?: number;
/** max packet length defaults to 0xff */
maxLen?: number;
}
/**
* A transform stream that decodes packets with a delimiter and length of payload
* specified within the data stream.
* @extends Transform
* @summary Decodes packets of the general form:
* [delimiter][len][payload0] ... [payload0 + len]
*
* The length field can be up to 4 bytes and can be at any offset within the packet
* [delimiter][header0][header1][len0][len1[payload0] ... [payload0 + len]
*
* The offset and number of bytes of the length field need to be provided in options
* if not 1 byte immediately following the delimiter.
*/
export declare class PacketLengthParser extends Transform {
buffer: Buffer;
start: boolean;
opts: {
delimiter: number;
packetOverhead: number;
lengthBytes: number;
lengthOffset: number;
maxLen: number;
};
constructor(options?: PacketLengthOptions);
_transform(chunk: Buffer, encoding: BufferEncoding, cb: TransformCallback): void;
_flush(cb: TransformCallback): void;
}

View File

@@ -0,0 +1,61 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PacketLengthParser = void 0;
const stream_1 = require("stream");
/**
* A transform stream that decodes packets with a delimiter and length of payload
* specified within the data stream.
* @extends Transform
* @summary Decodes packets of the general form:
* [delimiter][len][payload0] ... [payload0 + len]
*
* The length field can be up to 4 bytes and can be at any offset within the packet
* [delimiter][header0][header1][len0][len1[payload0] ... [payload0 + len]
*
* The offset and number of bytes of the length field need to be provided in options
* if not 1 byte immediately following the delimiter.
*/
class PacketLengthParser extends stream_1.Transform {
buffer;
start;
opts;
constructor(options = {}) {
super(options);
const { delimiter = 0xaa, packetOverhead = 2, lengthBytes = 1, lengthOffset = 1, maxLen = 0xff } = options;
this.opts = {
delimiter,
packetOverhead,
lengthBytes,
lengthOffset,
maxLen,
};
this.buffer = Buffer.alloc(0);
this.start = false;
}
_transform(chunk, encoding, cb) {
for (let ndx = 0; ndx < chunk.length; ndx++) {
const byte = chunk[ndx];
if (byte === this.opts.delimiter) {
this.start = true;
}
if (true === this.start) {
this.buffer = Buffer.concat([this.buffer, Buffer.from([byte])]);
if (this.buffer.length >= this.opts.lengthOffset + this.opts.lengthBytes) {
const len = this.buffer.readUIntLE(this.opts.lengthOffset, this.opts.lengthBytes);
if (this.buffer.length == len + this.opts.packetOverhead || len > this.opts.maxLen) {
this.push(this.buffer);
this.buffer = Buffer.alloc(0);
this.start = false;
}
}
}
}
cb();
}
_flush(cb) {
this.push(this.buffer);
this.buffer = Buffer.alloc(0);
cb();
}
}
exports.PacketLengthParser = PacketLengthParser;

View File

@@ -0,0 +1,24 @@
{
"name": "@serialport/parser-packet-length",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"scripts": {
"build": "tsc --build tsconfig-build.json"
},
"version": "12.0.0",
"engines": {
"node": ">=8.6.0"
},
"publishConfig": {
"access": "public"
},
"license": "MIT",
"repository": {
"type": "git",
"url": "git://github.com/serialport/node-serialport.git"
},
"devDependencies": {
"typescript": "5.2.2"
},
"gitHead": "f7e7bd53f9578a26c4f44cc1949fef396dc064c7"
}