• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nikelborm / fetch-github-folder / 12823494188

17 Jan 2025 05:51AM UTC coverage: 55.378%. Remained the same
12823494188

push

github

nikelborm
quick save: Fri Jan 17 06:13:09 MSK 2025

53 of 64 branches covered (82.81%)

Branch coverage included in aggregate %.

39 of 89 new or added lines in 9 files covered. (43.82%)

24 existing lines in 4 files now uncovered.

328 of 624 relevant lines covered (52.56%)

2.37 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/unpackRepoFolderTarGzStreamToFs.ts
NEW
1
import { Effect, gen, tryPromise } from 'effect/Effect';
×
2
import { Readable } from 'node:stream';
3
import { pipeline } from 'node:stream/promises';
4
import { createGunzip } from 'node:zlib';
5
import { extract } from 'tar-fs';
6
import { OutputConfigTag } from './config.js';
7
import { TaggedErrorVerifyingCause } from './TaggedErrorVerifyingCause.js';
8

9
export const unpackRepoFolderTarGzStreamToFs = <E, R>(
×
10
  self: Effect<Readable, E, R>,
×
11
) =>
NEW
12
  gen(function* () {
×
NEW
13
    const tarGzStream = yield* self;
×
14

NEW
15
    const {
×
NEW
16
      localPathAtWhichEntityFromRepoWillBeAvailable:
×
NEW
17
        pathToLocalDirWhichWillHaveContentsOfRepoDir,
×
NEW
18
    } = yield* OutputConfigTag;
×
19

NEW
20
    yield* tryPromise({
×
NEW
21
      try: signal =>
×
22
        pipeline(
×
23
          tarGzStream,
×
UNCOV
24
          createGunzip(),
×
UNCOV
25
          extract(pathToLocalDirWhichWillHaveContentsOfRepoDir, {
×
UNCOV
26
            map: header => {
×
27
              // GitHub creates archive with nested dir inside which has all
28
              // the files we need, so we remove this dir's name from the
29
              // beginning
30
              header.name = header.name.replace(/^[^/]*\/(.*)/, '$1');
×
31
              return header;
×
32
            },
×
33
          }),
×
34
          { signal },
×
35
        ),
×
NEW
36
      catch: cause =>
×
NEW
37
        new FailedToUnpackRepoFolderTarGzStreamToFs({ cause }),
×
NEW
38
    });
×
NEW
39
  });
×
40

NEW
41
export class FailedToUnpackRepoFolderTarGzStreamToFs extends TaggedErrorVerifyingCause<{
×
42
  cause: unknown;
NEW
43
}>()(
×
NEW
44
  'FailedToUnpackRepoFolderTarGzStreamToFs',
×
NEW
45
  'Error: Failed to unpack to fs received from GitHub .tar.gz stream of repo folder contents',
×
NEW
46
) {}
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc