MCPcopy Create free account
hub / github.com/Acode-Foundation/Acode / downloadFont

Function downloadFont

src/lib/fonts.js:239–255  ·  view source on GitHub ↗
(name, link)

Source from the content-addressed store, hash-verified

237}
238
239async function downloadFont(name, link) {
240 const FONT_DIR = Url.join(DATA_STORAGE, "fonts");
241 const FONT_FILE = Url.join(FONT_DIR, name);
242
243 const fs = fsOperation(FONT_FILE);
244 if (await fs.exists()) return FONT_FILE;
245
246 if (!(await fsOperation(FONT_DIR).exists())) {
247 await fsOperation(DATA_STORAGE).createDirectory("fonts");
248 }
249
250 const font = await fsOperation(link).readFile();
251 console.log("fonts content : ", font);
252 await fsOperation(FONT_DIR).createFile(name, font);
253
254 return FONT_FILE;
255}
256
257function injectFontFace(name) {
258 const $style = ensureStyleElement(FONT_FACE_STYLE_ID);

Callers 1

loadFontFunction · 0.85

Calls 6

fsOperationFunction · 0.85
logMethod · 0.80
existsMethod · 0.65
createDirectoryMethod · 0.65
createFileMethod · 0.65
readFileMethod · 0.45

Tested by

no test coverage detected