MCPcopy Index your code
hub / github.com/remix-run/react-router / readFile

Function readFile

scripts/utils/fs.ts:7–21  ·  view source on GitHub ↗
(
  filename: string,
  encoding: BufferEncoding = "utf-8",
)

Source from the content-addressed store, hash-verified

5}
6
7export function readFile(
8 filename: string,
9 encoding: BufferEncoding = "utf-8",
10): string {
11 try {
12 return fs.readFileSync(filename, encoding);
13 } catch (error) {
14 if (isFsError(error) && error.code === "ENOENT") {
15 console.error(`Not found: "${filename}"`);
16 process.exit(1);
17 } else {
18 throw error;
19 }
20 }
21}
22
23function isFsError(error: unknown): error is { code: string } {
24 return (

Callers 15

parseChangelogFunction · 0.90
readWhatsChangedContentFunction · 0.90
updateChangelogFunction · 0.90
updateTableOfContentsFunction · 0.90
updatePackageJSONFunction · 0.85
createServerEntryFunction · 0.85
createClientEntryFunction · 0.85
compileRouteFileFunction · 0.85
loadViteManifestFunction · 0.85
generateSriManifestFunction · 0.85
loadFunction · 0.85
configurePreviewServerFunction · 0.85

Calls 3

isFsErrorFunction · 0.85
errorMethod · 0.80
exitMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…