Skip to content

torrent-parser is a lightweight Deno library for parsing torrent files

License

Notifications You must be signed in to change notification settings

deno-torrent/torrent-parser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

torrent-parser is a lightweight Deno library for parsing torrent files

Usage

Decode

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()

Test

deno task test

# running 1 test from ./test/parser.test.ts
# test parse torrent file ... ok (11ms)

# ok | 1 passed | 0 failed (43ms)

About

torrent-parser is a lightweight Deno library for parsing torrent files

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published