MCPcopy Create free account
hub / github.com/banga/git-split-diffs / transformContentsStreaming

Function transformContentsStreaming

src/transformContentsStreaming.ts:8–43  ·  view source on GitHub ↗
(
    context: Context,
    input: Readable,
    output: Writable
)

Source from the content-addressed store, hash-verified

6import { iterWithNewlines } from './iterWithNewlines';
7
8export function transformContentsStreaming(
9 context: Context,
10 input: Readable,
11 output: Writable
12): Promise<void> {
13 return new Promise((resolve, reject) => {
14 const transformedInput = Readable.from(
15 iterWithNewlines(
16 context,
17 iterSideBySideDiffs(
18 context,
19 iterReplaceTabsWithSpaces(
20 context,
21 iterlinesFromReadable(input)
22 )
23 )
24 )
25 );
26
27 stream.pipeline(transformedInput, output, (err) => {
28 if (err) {
29 switch (err.code) {
30 case 'EPIPE':
31 // This can happen if the process exits while we are still
32 // processing the input and writing to stdout.
33 resolve();
34 return;
35 default:
36 reject(err);
37 return;
38 }
39 }
40 resolve();
41 });
42 });
43}

Callers 3

transformFunction · 0.90
mainFunction · 0.90
previewThemeFunction · 0.90

Calls 4

iterWithNewlinesFunction · 0.90
iterSideBySideDiffsFunction · 0.90
iterlinesFromReadableFunction · 0.90

Tested by 1

transformFunction · 0.72