diff options
author | RaindropsSys <raindrops@equestria.dev> | 2023-10-24 17:43:37 +0200 |
---|---|---|
committer | RaindropsSys <raindrops@equestria.dev> | 2023-10-24 17:43:37 +0200 |
commit | ae187b6d75c8079da0be1dc288613bad8466fe61 (patch) | |
tree | 5ea0d34185a2270f29ffaa65e1f5258028d7d5d0 /desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader | |
download | mist-ae187b6d75c8079da0be1dc288613bad8466fe61.tar.gz mist-ae187b6d75c8079da0be1dc288613bad8466fe61.tar.bz2 mist-ae187b6d75c8079da0be1dc288613bad8466fe61.zip |
Initial commit
Diffstat (limited to 'desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader')
8 files changed, 84 insertions, 0 deletions
diff --git a/desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader/LineBatch.d.ts b/desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader/LineBatch.d.ts new file mode 100644 index 0000000..74a0470 --- /dev/null +++ b/desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader/LineBatch.d.ts @@ -0,0 +1,16 @@ +export interface LineBatch { + /** + * Batch of lines available after this read operation. + */ + lines: string[]; + /** + * First part of a line that was split due to buffer boundary. + * It will be used in a subsequent read to complete the next line. + */ + rest: string; + /** + * Whether we reached end of file. + */ + reachedEof: boolean; +} +//# sourceMappingURL=LineBatch.d.ts.map
\ No newline at end of file diff --git a/desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader/LineBatch.d.ts.map b/desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader/LineBatch.d.ts.map new file mode 100644 index 0000000..2b17f98 --- /dev/null +++ b/desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader/LineBatch.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"LineBatch.d.ts","sourceRoot":"","sources":["../../../../../src/fileCompareHandler/lines/lineReader/LineBatch.ts"],"names":[],"mappings":"AACA,MAAM,WAAW,SAAS;IACtB;;OAEG;IACH,KAAK,EAAE,MAAM,EAAE,CAAA;IACf;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,UAAU,EAAE,OAAO,CAAA;CACtB"}
\ No newline at end of file diff --git a/desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader/LineBatch.js b/desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader/LineBatch.js new file mode 100644 index 0000000..a6f78b2 --- /dev/null +++ b/desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader/LineBatch.js @@ -0,0 +1,3 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +//# sourceMappingURL=LineBatch.js.map
\ No newline at end of file diff --git a/desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader/LineBatch.js.map b/desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader/LineBatch.js.map new file mode 100644 index 0000000..6d42ea9 --- /dev/null +++ b/desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader/LineBatch.js.map @@ -0,0 +1 @@ +{"version":3,"file":"LineBatch.js","sourceRoot":"","sources":["../../../../../src/fileCompareHandler/lines/lineReader/LineBatch.ts"],"names":[],"mappings":""}
\ No newline at end of file diff --git a/desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader/readBufferedLines.d.ts b/desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader/readBufferedLines.d.ts new file mode 100644 index 0000000..5e2c85e --- /dev/null +++ b/desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader/readBufferedLines.d.ts @@ -0,0 +1,14 @@ +/// <reference types="node" /> +import { LineBatch } from './LineBatch'; +/** + * Reads lines from given buffer. + * @param buf Buffer to read lines from. + * @param size Size of data available in buffer. + * @param allocatedBufferSize Maximum buffer storage. + * @param rest Part of a line that was split at buffer boundary in a previous read. + * Will be added to result. + * @param restLines Lines that remain unprocessed from a previous read due to unbalanced buffers. + * Will be added to result. + */ +export declare function readBufferedLines(buf: Buffer, size: number, allocatedBufferSize: number, rest: string, restLines: string[]): LineBatch; +//# sourceMappingURL=readBufferedLines.d.ts.map
\ No newline at end of file diff --git a/desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader/readBufferedLines.d.ts.map b/desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader/readBufferedLines.d.ts.map new file mode 100644 index 0000000..cc2dcc0 --- /dev/null +++ b/desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader/readBufferedLines.d.ts.map @@ -0,0 +1 @@ +{"version":3,"file":"readBufferedLines.d.ts","sourceRoot":"","sources":["../../../../../src/fileCompareHandler/lines/lineReader/readBufferedLines.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAA;AAKvC;;;;;;;;;GASG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,EAAE,GAAG,SAAS,CAmBtI"}
\ No newline at end of file diff --git a/desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader/readBufferedLines.js b/desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader/readBufferedLines.js new file mode 100644 index 0000000..fe1f768 --- /dev/null +++ b/desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader/readBufferedLines.js @@ -0,0 +1,47 @@ +"use strict"; +Object.defineProperty(exports, "__esModule", { value: true }); +exports.readBufferedLines = void 0; +const LINE_TOKENIZER_REGEXP = /[^\n]+\n?|\n/g; +/** + * Reads lines from given buffer. + * @param buf Buffer to read lines from. + * @param size Size of data available in buffer. + * @param allocatedBufferSize Maximum buffer storage. + * @param rest Part of a line that was split at buffer boundary in a previous read. + * Will be added to result. + * @param restLines Lines that remain unprocessed from a previous read due to unbalanced buffers. + * Will be added to result. + */ +function readBufferedLines(buf, size, allocatedBufferSize, rest, restLines) { + if (size === 0 && rest.length === 0) { + return { lines: [...restLines], rest: '', reachedEof: true }; + } + if (size === 0) { + return { lines: [...restLines, rest], rest: '', reachedEof: true }; + } + const fileContent = rest + buf.toString('utf8', 0, size); + const lines = [...restLines, ...fileContent.match(LINE_TOKENIZER_REGEXP)]; + const reachedEof = size < allocatedBufferSize; + if (reachedEof) { + return { + lines, rest: '', reachedEof: true + }; + } + return removeLastLine(lines); +} +exports.readBufferedLines = readBufferedLines; +/** + * Last line is usually incomplete because our buffer rarely matches exactly the end of a line. + * So we remove it from the line batch. + * The deleted line is returned as the 'rest' parameter and will be incorporate at the beginning + * of next read operation. + */ +function removeLastLine(lines) { + const lastLine = lines[lines.length - 1]; + return { + lines: lines.slice(0, lines.length - 1), + rest: lastLine, + reachedEof: false + }; +} +//# sourceMappingURL=readBufferedLines.js.map
\ No newline at end of file diff --git a/desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader/readBufferedLines.js.map b/desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader/readBufferedLines.js.map new file mode 100644 index 0000000..6b2f7e1 --- /dev/null +++ b/desktop/node_modules/dir-compare/build/src/fileCompareHandler/lines/lineReader/readBufferedLines.js.map @@ -0,0 +1 @@ +{"version":3,"file":"readBufferedLines.js","sourceRoot":"","sources":["../../../../../src/fileCompareHandler/lines/lineReader/readBufferedLines.ts"],"names":[],"mappings":";;;AAGA,MAAM,qBAAqB,GAAG,eAAe,CAAA;AAE7C;;;;;;;;;GASG;AACH,SAAgB,iBAAiB,CAAC,GAAW,EAAE,IAAY,EAAE,mBAA2B,EAAE,IAAY,EAAE,SAAmB;IACvH,IAAI,IAAI,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE;QACjC,OAAO,EAAE,KAAK,EAAE,CAAC,GAAG,SAAS,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE,UAAU,EAA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