laravel-aria2

Metadata

Resolve a display name and size without running a full download. Useful when you want to show a title before the transfer starts.

use Pullr\LaravelAria2\Facades\Aria2;
 
$metadata = Aria2::metadata('https://example.com/ubuntu.iso');
 
$metadata->name(); // "ubuntu.iso"
$metadata->bytes(); // null unless aria2 (or the magnet) provided a size

HTTP(S) URLs

For ordinary URLs the package uses the path basename, URL-decoded. It does not HEAD the remote file.

Aria2::metadata('https://example.com/releases/linux-arm64.tar.gz');
// name: linux-arm64.tar.gz

Magnet links

Magnet query keys dn (display name) and xl (exact length) are read locally. Repeated keys are preserved in order; the first value wins.

Aria2::metadata('magnet:?xt=urn:btih:...&dn=Big%20Buck%20Bunny&xl=2751463424');
// name: Big Buck Bunny
// bytes: 2751463424

When dn or xl is missing, the package starts a short-lived aria2 probe (pause-metadata for magnets), reads tellStatus, then force-removes the probe.

Torrent files

A URL whose path ends in .torrent always probes aria2. A query string that merely contains .torrent is not treated as a torrent source.

Value object

$metadata->displayName;
$metadata->totalBytes;
$metadata->name(); // alias of displayName
$metadata->bytes(); // alias of totalBytes
$metadata->isEmpty();
$metadata->toArray(); // omits empty fields