streaming RAR extractor jsr.io/@mary/rar
jsr
2

Configure Feed

Select the types of activity you want to include in your feed.

TypeScript 91.7%
Other 8.3%
77 1 0

Clone this repository

https://tangled.org/mary.my.id/pkg-rar https://tangled.org/did:plc:qza35dw5f3bubv7ldi4bwruz
git@tangled.org:mary.my.id/pkg-rar git@tangled.org:did:plc:qza35dw5f3bubv7ldi4bwruz

For self-hosted knots, clone URLs may differ based on your setup.



README.md

rar#

JSR | source code

streaming RAR extractor

import { unrar } from '@mary/rar';
import { fromFsFile } from '@mary/rar/deno';

// extracting a specific file from an archive
{
	using file = await Deno.open('./archive.rar');
	const reader = await fromFsFile(file);

	for await (const entry of unrar(reader)) {
		console.log(entry.filename, entry.size);

		if (entry.filename === 'mod.ts') {
			console.log(await entry.text());
		}
	}
}

// password-protected, multi-volume archives — pass the volumes in order
{
	using v1 = await Deno.open('./archive.part1.rar');
	using v2 = await Deno.open('./archive.part2.rar');

	const readers = [await fromFsFile(v1), await fromFsFile(v2)];

	for await (const entry of unrar(readers, { password: 'hunter2' })) {
		console.log(entry.filename, await entry.bytes());
	}
}