torrent-parser is a lightweight Deno library for parsing torrent files
basic usage
import { parseTorrent } from 'https://deno.land/x/dt_torrent_parser/mod.ts'
const fd = await Deno.open('./your-torrent-file.torrent', { read: true })
// parseTorrent source arg accept Uint8Array | Buffer | Reader
const torrent = await parseTorrent(fd)
fd.close()
specify writer
import { parseTorrent } from 'https://deno.land/x/dt_torrent_parser/mod.ts'
const fd = await Deno.open('./your-torrent-file.torrent', { read: true })
// parse torrent and write to stdout
const torrent = await parseTorrent(fd, Deno.stdout)
fd.close()
deno task test
# running 1 test from ./test/parser.test.ts
# test parse torrent file ... ok (11ms)
# ok | 1 passed | 0 failed (43ms)