MCPcopy Create free account
hub / github.com/TanStack/cli / readFileHelper

Function readFileHelper

packages/create/src/file-helpers.ts:12–18  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

10const BINARY_EXTENSIONS = ['.png', '.jpg', '.jpeg', '.gif', '.svg', '.ico']
11
12export function readFileHelper(path: string): string {
13 if (isBinaryFile(path)) {
14 return `base64::${readFileSync(path).toString('base64')}`
15 } else {
16 return readFileSync(path, 'utf-8').toString()
17 }
18}
19
20export function isBinaryFile(path: string): boolean {
21 return BINARY_EXTENSIONS.includes(extname(path))

Callers 5

findFilesRecursivelyFunction · 0.85
scanAddOnDirectoriesFunction · 0.85
compareFilesRecursivelyFunction · 0.85

Calls 2

toStringMethod · 0.80
isBinaryFileFunction · 0.70

Tested by

no test coverage detected