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

project-slippi / slippi-js / 19633247421

24 Nov 2025 11:49AM UTC coverage: 81.438% (+0.05%) from 81.39%
19633247421

Pull #150

github

web-flow
Merge 17de4f634 into 02a2c65e6
Pull Request #150: Refactor SlippiGame to be web-compatible by default

694 of 926 branches covered (74.95%)

Branch coverage included in aggregate %.

156 of 177 new or added lines in 15 files covered. (88.14%)

1956 of 2328 relevant lines covered (84.02%)

120332.04 hits per line

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

80.0
/src/node/utils/slpFileInputRef.ts
1
import fs from "fs";
12✔
2

3
import type { SlpInputRef } from "../../common/utils/slpInputRef";
4

5
export class SlpFileInputRef implements SlpInputRef {
12✔
6
  private fileDescriptor: number | null = null;
82✔
7

8
  public constructor(private readonly filePath: string) {}
82✔
9

10
  public open(): void {
11
    if (this.fileDescriptor) {
177✔
12
      // File is already open so do nothing
13
      return;
86✔
14
    }
15
    this.fileDescriptor = fs.openSync(this.filePath, "r");
91✔
16
  }
17

18
  public size(): number {
19
    if (!this.fileDescriptor) {
182!
NEW
20
      throw new Error("Tried to get the size of a closed SLP file");
×
21
    }
22
    return fs.fstatSync(this.fileDescriptor).size;
182✔
23
  }
24

25
  public close(): void {
26
    if (this.fileDescriptor) {
87✔
27
      fs.closeSync(this.fileDescriptor);
87✔
28
      this.fileDescriptor = null;
87✔
29
    }
30
  }
31

32
  public read(targetBuffer: Uint8Array, offset: number, length: number, position: number): number {
33
    if (!this.fileDescriptor) {
2,640,254!
NEW
34
      throw new Error("Tried to read from a closed SLP file");
×
35
    }
36

37
    return fs.readSync(this.fileDescriptor, targetBuffer, offset, length, position);
2,640,254✔
38
  }
39
}
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

© 2025 Coveralls, Inc