MCPcopy Index your code
hub / github.com/Sandpack/nodebox-runtime / readFile

Method readFile

packages/nodebox/src/modules/fs.ts:104–112  ·  view source on GitHub ↗
(path: string, encoding?: FSEncoding)

Source from the content-addressed store, hash-verified

102 public async readFile(path: string, encoding: BufferEncoding): Promise<string>;
103
104 public async readFile(path: string, encoding?: FSEncoding): Promise<FileContent> {
105 const response = await this.channel.send('fs/readFile', { path, encoding }).catch((error) => {
106 throw new Error(format('Failed to read file at path "%s"', path), { cause: error });
107 });
108 if (!response) {
109 throw new Error('File not found');
110 }
111 return response.data;
112 }
113
114 /**
115 * Write a file at the given path.

Callers 4

setupFunction · 0.80
setupFunction · 0.80
runSandpackCDNProxyFunction · 0.80

Calls 1

sendMethod · 0.45

Tested by

no test coverage detected