MCPcopy Index your code
hub / github.com/OptimalBits/bull / loadCommand

Method loadCommand

lib/commands/script-loader.js:328–345  ·  view source on GitHub ↗
(filename, cache)

Source from the content-addressed store, hash-verified

326 }
327
328 async loadCommand(filename, cache) {
329 filename = path.resolve(filename);
330
331 const { name: scriptName } = splitFilename(filename);
332 let script = cache ? cache.get(scriptName) : undefined;
333 if (!script) {
334 const content = (await readFile(filename)).toString();
335 script = await this.parseScript(filename, content, cache);
336 }
337
338 const lua = removeEmptyLines(this.interpolate(script));
339 const { name, numberOfKeys } = script;
340
341 return {
342 name,
343 options: { numberOfKeys: numberOfKeys, lua }
344 };
345 }
346
347 /**
348 * Load redis lua scripts.

Callers 1

loadScriptsMethod · 0.95

Calls 4

parseScriptMethod · 0.95
interpolateMethod · 0.95
splitFilenameFunction · 0.85
removeEmptyLinesFunction · 0.85

Tested by

no test coverage detected