MCPcopy
hub / github.com/browserless/browserless / readWithTimeout

Function readWithTimeout

src/monitoring.ts:15–22  ·  view source on GitHub ↗
(
  path: string,
  readFile: ReadFileFn = defaultReadFile,
  timeoutMs: number = READ_TIMEOUT_MS,
)

Source from the content-addressed store, hash-verified

13 fsReadFile(path, { encoding: 'utf8', signal });
14
15export async function readWithTimeout(
16 path: string,
17 readFile: ReadFileFn = defaultReadFile,
18 timeoutMs: number = READ_TIMEOUT_MS,
19): Promise<string> {
20 const signal = AbortSignal.timeout(timeoutMs);
21 return readFile(path, signal);
22}
23
24export function parseCpuMax(content: string): number | null {
25 const trimmed = content.trim();

Callers 5

monitoring.spec.tsFile · 0.85
readCpuMethod · 0.85
readMemoryMethod · 0.85
readCpuMethod · 0.85
readMemoryMethod · 0.85

Calls 1

readFileFunction · 0.85

Tested by

no test coverage detected