MCPcopy
hub / github.com/vitest-dev/vitest / readFile

Function readFile

packages/browser/src/node/commands/fs.ts:28–36  ·  view source on GitHub ↗
({ project }, path, options = {})

Source from the content-addressed store, hash-verified

26export const readFile: BrowserCommand<
27 Parameters<BrowserCommands['readFile']>
28> = async ({ project }, path, options = {}) => {
29 const filepath = resolve(project.config.root, path)
30 assertFileAccess(slash(filepath), project)
31 // never return a Buffer
32 if (typeof options === 'object' && !options.encoding) {
33 options.encoding = 'utf-8'
34 }
35 return fsp.readFile(filepath, options)
36}
37
38export const writeFile: BrowserCommand<
39 Parameters<BrowserCommands['writeFile']>

Callers 15

constructorMethod · 0.85
constructorMethod · 0.85
screenshotMatcherFunction · 0.85
handlerFunction · 0.85
loadFunction · 0.85
readMetadataMethod · 0.85
invokeMethod · 0.85
readFileConcurrentlyMethod · 0.85
runWorkspaceTestsFunction · 0.85
readBlobsFunction · 0.85
commands.test.tsFile · 0.85

Calls 4

slashFunction · 0.90
assertFileAccessFunction · 0.85
readFileMethod · 0.80
resolveFunction · 0.50

Tested by 1

getFileContentFunction · 0.68