MCPcopy Index your code
hub / github.com/lingodotdev/lingo.dev / tryReadFile

Function tryReadFile

packages/cli/src/cli/utils/fs.ts:4–14  ·  view source on GitHub ↗
(
  filePath: string,
  defaultValue: string | null = null,
)

Source from the content-addressed store, hash-verified

2import * as path from "path";
3
4export function tryReadFile(
5 filePath: string,
6 defaultValue: string | null = null,
7): string | null {
8 try {
9 const content = fs.readFileSync(filePath, "utf-8");
10 return content;
11 } catch (error) {
12 return defaultValue;
13 }
14}
15
16export function writeFile(filePath: string, content: string) {
17 // create dirs

Callers 1

loadLockFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected