MCPcopy Create free account
hub / github.com/anilkumarum/mark-clipper / writeScreenshotFile

Function writeScreenshotFile

background/attachment.js:31–43  ·  view source on GitHub ↗
(shotBlob, noteName)

Source from the content-addressed store, hash-verified

29
30/**@param {Blob} shotBlob, @param {string} noteName*/
31export async function writeScreenshotFile(shotBlob, noteName) {
32 const vaultHandle = await getVaultHandle();
33 if (!vaultHandle) return chrome.tabs.create({ url: permissionUrl });
34
35 const imgName = new Date().toISOString().replaceAll(":", "-") + ".png";
36 writeFile(shotBlob, imgName, "screenshots")
37 .then(async () => {
38 const imgAlt = "image";
39 const imgShotLink = `\n![screenshot${imgAlt}](./screenshots/${imgName})`;
40 await appendImgLink(noteName, imgShotLink);
41 })
42 .catch((err) => console.error(err));
43}
44
45/**@param {string} srcUrl, @param {string} noteName*/
46export async function writeAttachmentFile(srcUrl, noteName, pageUrl) {

Callers 1

captureScreenshotFunction · 0.90

Calls 3

getVaultHandleFunction · 0.85
writeFileFunction · 0.85
appendImgLinkFunction · 0.85

Tested by

no test coverage detected