Dynamic Optical Transfer - compact format
DOT Code JS Library is an optimised library that allows you to encode and decode files as compact images (sort of like QR codes). Max file size is 5MB (255,900% larger than QR codes!) Include the library: <script src=\"https://dotcode.pages.dev/dot.js\"></script> Functions: 1. encodeFile(file) : Promise- Input: File object. - Output: Promise that resolves to a base64 PNG string representing the DOT Code. 2. decodeImage(img) : Promise<{name, type, size, blob}> - Input: HTMLImageElement with DOT Code. - Output: Promise that resolves to an object containing the decoded file. Example Usage: const base64 = await DOTCode.encodeFile(file); const img = new Image(); img.src = base64; document.body.appendChild(img); const result = await DOTCode.decodeImage(img); console.log(result.name, result.type, result.size, result.blob);