Skip to content

Instantly share code, notes, and snippets.

@greggman
Last active April 8, 2026 03:09
Show Gist options
  • Select an option

  • Save greggman/c896e89d1a943aa8c590f88f97ad1f60 to your computer and use it in GitHub Desktop.

Select an option

Save greggman/c896e89d1a943aa8c590f88f97ad1f60 to your computer and use it in GitHub Desktop.
unrarit example
/*bug-in-github-api-content-can-not-be-empty*/
/*bug-in-github-api-content-can-not-be-empty*/
import { unrar } from 'https://greggman.github.io/unrarit/dist/unrarit.module.js';
const {entries} = await unrar('https://greggman.github.io/unrarit/test/data/large.rar');
for (const [name, info] of Object.entries(entries)) {
console.log(name);
for (const [k, v] of Object.entries(info)) {
console.log(' ', k, t(v));
}
}
console.log('---');
for (const [name, info] of Object.entries(entries)) {
console.log(name);
const blob = await info.blob();
const img = new Image();
img.src = URL.createObjectURL(blob);
document.body.appendChild(img);
}
function t(v) {
if (v && typeof v === 'object') {
return v.constructor.name;
} else {
return typeof v;
}
}
{"name":"unrarit example","settings":{},"filenames":["index.html","index.css","index.js"]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment