New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dot-torrent

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dot-torrent

Parse and create torrent files.

  • 1.0.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
34
increased by78.95%
Maintainers
1
Weekly downloads
 
Created
Source

NPM

ci Coverage Status NPM Downloads NPM License

Dot-Torrent

Parse and create torrent files.

Fast and easy to use.
Written in TypeScript.
Fully tested with 100% code coverage.

Installation

npmyarn
npm install --save dot-torrentyarn add dot-torrent

Getting Started

Import library

typescriptjavascript
import dotTorrent from 'dot-torrent'const dotTorrent = require('dot-torrent')

Parse torrent file

  // parse from the Buffer or the string
  const torrent = dotTorrent.parse( fs.readFileSync('path/to/the/file.torrent') );
  // parse file
  const torrent = dotTorrent.parseFile('path/to/the/file.torrent');
  
  // torrent
  {
    announce: 'https://testtracker-1.net/testtopic.php?t=1111111',
    announceList: [
      'https://testtracker-1.net/testtopic.php?t=1111111',
      'https://testtracker-2.net/testtopic.php?t=2222222',
      'https://testtracker-3.net/testtopic.php?t=3333333'
    ],
    comment: 'Amazing torrent',
    createdBy: 'https://www.npmjs.com/package/dot-torrent',
    createdAt: 1586292962,
    encoding: 'UTF-8',
    files: [ {
      length: 100500,
      path: 'awesome_torrent.txt'
    } ],
    infoHash: '600ccd1b71569232d01d110bc63e906beab04d8c',
    name: 'awesome_torrent.txt',
    pieceLength: 32768,
    pieces: <Buffer 4d 92 fb 38 ... fe 74 59 b4 67 56 05>,
    private: false,
    publisher: 'isolomak',
    publisherUrl: 'https://www.npmjs.com/package/dot-torrent',
    totalLength: 100500
  }

Create torrent file

  const parameters = {
    announceList: [
      'https://testtracker-1.net/testtopic.php?t=1111111'
    ],
    source: './path/to/the/folder/or/a/file',
    comment: 'Amazing torrent', // optional
    name: 'awesome_torrent', // optional
    private: false, // optional (false by default)
    publisher: 'isolomak', // optional
    publisherUrl: 'https://www.npmjs.com/package/dot-torrent' // optional
  };

  const outputPath = './awesome.torrent';

  await dotTorrent.create(parameters, outputPath);

Tests

  npm test

License

This project is licensed under the MIT License - see the LICENSE file for details.

Keywords

FAQs

Package last updated on 09 Apr 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc