<script type='module'> import { File } from 'https://unpkg.com/megajs/dist/main.browser-es.mjs' const file = File.fromURL('https://mega.nz/file/GddFHbZI#jINkQ6Z3zdEZojVenz6nsXyUBDJ3qHp88a5SHbd3UuU'); file.api.userAgent = null; await file.loadAttributes(); console.log(file.name); // file name console.log(file.size); // file size in bytes const stream = file.download(); stream.on('progress', info => { console.log('Loaded', info.bytesLoaded, 'bytes of', info.bytesTotal, Math.round((info.bytesLoaded/info.bytesTotal)*100)) }); const data = await file.downloadBuffer(); const blob = new Blob([data], { type: 'application/octet-stream' }); const url = URL.createObjectURL(blob); const atag = document.createElement('a'); atag.href = url; atag.download = file.name; document.querySelector('#postBody').appendChild(atag); atag.click(); </script>