MCPcopy Create free account
hub / github.com/porsager/postgres / file

Function file

cjs/src/index.js:129–144  ·  view source on GitHub ↗
(path, args = [], options = {})

Source from the content-addressed store, hash-verified

127 }
128
129 function file(path, args = [], options = {}) {
130 arguments.length === 2 && !Array.isArray(args) && (options = args, args = [])
131 const query = new Query([], args, (query) => {
132 fs.readFile(path, 'utf8', (err, string) => {
133 if (err)
134 return query.reject(err)
135
136 query.strings = [string]
137 handler(query)
138 })
139 }, cancel, {
140 ...options,
141 simple: 'simple' in options ? options.simple : args.length === 0
142 })
143 return query
144 }
145 }
146
147 async function listen(name, fn, onlisten) {

Callers

nothing calls this directly

Calls 1

handlerFunction · 0.70

Tested by

no test coverage detected