src/vs/base/node/nodeStreams.ts

62 LOC · 60 covered · 2 uncovered · 11 ranges · 5 concepts · 4 introducers · 8 tests

File neighbourhood

The centred file is linked to every concept that introduces one of its ranges, every test that runs code from the file, and the gray connector concepts standing between those tests and the file's own introducer concepts. Undirected links join concepts to every file where they introduce source and concepts to the tests they introduce; arrows show specialization between the displayed concepts and bridge only concepts omitted from this view. Concept colors match the source ranges below; connector concepts have no source color and are shown in gray.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the file

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the related-file, concept, and source links on this page.

Focused file, its introducer and connector concepts, their introduced files, and tests that run code from the fileextHostMcpNode.ts ×8 · 45 introduced LOCextHostMcpNode.ts ×8nodeStreams.ts ×1 · 1 introduced LOCnodeStreams.ts ×1nodeStreams.ts ×1 · 1 introduced LOCnodeStreams.ts ×1nodeStreams.ts ×5 · 34 introduced LOCnodeStreams.ts ×5nodeStreams.ts ×4 · 24 introduced LOCnodeStreams.ts ×4nodeStreams.test|title=StreamSplitter should split a stream on a multi-character splitter|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/node/nodeStreams.test|title=StreamSplitter should split a stream on a multi-character splitter|occurrence=1nodeStreams.test|title=S…nodeStreams.test|title=StreamSplitter should split a stream on a single character splitter|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/base/test/node/nodeStreams.test|title=StreamSplitter should split a stream on a single character splitter|occurrence=1nodeStreams.test|title=S…extHostMcpNode.test|title=extHostMcpNode - escapeCmdArg does not add stray ^ to argument values|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/node/extHostMcpNode.test|title=extHostMcpNode - escapeCmdArg does not add stray ^ to argument values|occurrence=1extHostMcpNode.test|titl…extHostMcpNode.test|title=extHostMcpNode - escapeCmdArg doubles embedded double quotes (cmd.exe convention)|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/node/extHostMcpNode.test|title=extHostMcpNode - escapeCmdArg doubles embedded double quotes (cmd.exe convention)|occurrence=1extHostMcpNode.test|titl…extHostMcpNode.test|title=extHostMcpNode - escapeCmdArg neutralizes cmd.exe metacharacters inside quotes (CVE-2024-27980)|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/node/extHostMcpNode.test|title=extHostMcpNode - escapeCmdArg neutralizes cmd.exe metacharacters inside quotes (CVE-2024-27980)|occurrence=1extHostMcpNode.test|titl…extHostMcpNode.test|title=extHostMcpNode - escapeCmdArg preserves paths with parentheses without injecting ^|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/node/extHostMcpNode.test|title=extHostMcpNode - escapeCmdArg preserves paths with parentheses without injecting ^|occurrence=1extHostMcpNode.test|titl…extHostMcpNode.test|title=extHostMcpNode - escapeCmdArg preserves paths with spaces|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/node/extHostMcpNode.test|title=extHostMcpNode - escapeCmdArg preserves paths with spaces|occurrence=1extHostMcpNode.test|titl…extHostMcpNode.test|title=extHostMcpNode - escapeCmdArg wraps simple values in double quotes|occurrence=1 · introduced test · mocha:v1|namespace=vscode@05c208e9e28d8c1c723fa08f85e2b7a96092e8e5|file=vs/workbench/api/test/node/extHostMcpNode.test|title=extHostMcpNode - escapeCmdArg wraps simple values in double quotes|occurrence=1extHostMcpNode.test|titl…Focused file · src/vs/base/node/nodeStreams.ts · 62 LOCnode/nodeStreams.ts

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the related-file, concept, and source links on this page while the interactive map is unavailable.

1 > /*--------------------------------------------------------------------------------------------- nodeStreams.ts ×4
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 > import { Transform } from 'stream';
6 > import { binaryIndexOf } from '../common/buffer.js';
7 >
8 > /**
9 > * A Transform stream that splits the input on the "splitter" substring.
10 > * The resulting chunks will contain (and trail with) the splitter match.
11 > * The last chunk when the stream ends will be emitted even if a splitter
12 > * is not encountered.
13 > */
14 > export class StreamSplitter extends Transform {
15 > private buffer: Buffer | undefined;
16 > private readonly splitter: Buffer | number;
17 > private readonly spitterLen: number;
18 >
19 > constructor(splitter: string | number | Buffer) {
20 > super(); nodeStreams.ts ×5
21 > if (typeof splitter === 'number') {
22 this.splitter = splitter;
23 this.spitterLen = 1;
24 > } else { nodeStreams.ts ×5
25 > const buf = Buffer.isBuffer(splitter) ? splitter : Buffer.from(splitter);
26 > this.splitter = buf.length === 1 ? buf[0] : buf;
27 > this.spitterLen = buf.length;
28 > }
29 > }
31 > override _transform(chunk: Buffer, _encoding: string, callback: (error?: Error | null, data?: Buffer) => void): void {
32 > if (!this.buffer) { nodeStreams.ts ×5
33 > this.buffer = chunk;
34 > } else {
35 > this.buffer = Buffer.concat([this.buffer, chunk]);
36 > }
37 >
38 > let offset = 0;
39 > while (offset < this.buffer.length) {
40 > const index = typeof this.splitter === 'number'
41 > ? this.buffer.indexOf(this.splitter, offset) nodeStreams.ts ×1
42 > : binaryIndexOf(this.buffer, this.splitter, offset); nodeStreams.ts ×1
43 > if (index === -1) { nodeStreams.ts ×5
44 > break;
45 > }
46 >
47 > this.push(this.buffer.slice(offset, index + this.spitterLen));
48 > offset = index + this.spitterLen;
49 > }
50 >
51 > this.buffer = offset === this.buffer.length ? undefined : this.buffer.slice(offset);
52 > callback();
53 > }
55 > override _flush(callback: (error?: Error | null, data?: Buffer) => void): void {
56 > if (this.buffer) { nodeStreams.ts ×5
57 > this.push(this.buffer);
58 > }
59 >
60 > callback();
61 > }