MCPcopy Index your code
hub / github.com/nodeSolidServer/node-solid-server / processFile

Function processFile

lib/common/fs-utils.mjs:12–27  ·  view source on GitHub ↗
(filePath, manipulateSourceFn)

Source from the content-addressed store, hash-verified

10}
11
12export async function processFile (filePath, manipulateSourceFn) {
13 return new Promise((resolve, reject) => {
14 fs.readFile(filePath, 'utf8', (error, rawSource) => {
15 if (error) {
16 return reject(error)
17 }
18 const output = manipulateSourceFn(rawSource)
19 fs.writeFile(filePath, output, (error) => {
20 if (error) {
21 return reject(error)
22 }
23 resolve()
24 })
25 })
26 })
27}
28
29export function readFile (filePath, options = 'utf-8') {
30 return fs.readFileSync(filePath, options)

Callers 1

processHandlebarFileFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected