Socket
Socket
Sign inDemoInstall

create-torrent

Package Overview
Dependencies
Maintainers
1
Versions
139
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-torrent

Create .torrent files


Version published
Weekly downloads
2.9K
decreased by-18.61%
Maintainers
1
Weekly downloads
 
Created
Source

create-torrent travis npm gittip

Create .torrent files

creation

This module is used by WebTorrent.

install

npm install create-torrent

usage

The simplest way to use create-torrent is like this:

var createTorrent = require('create-torrent')
var fs = require('fs')

createTorrent('/path/to/folder', function (err, torrent) {
  if (!err) {
    // `torrent` is a Buffer with the contents of the new .torrent file
    fs.writeFile('my.torrent', torrent)
  }
})

api

createTorrent(path, [opts], function callback (err, torrent) {})

Create a new .torrent file.

path is the path to the file or folder to use.

opts is optional and allows you to set special settings for the .torrent.

{
  comment: '',        // free-form textual comments of the author (string)
  createdBy: '',      // name and version of the program used to create the .torrent (string)
  private: false,     // is this a private .torrent? (boolean or integer)
  pieceLength: 32768  // force a custom piece length (number of bytes)
  announceList: [[]]  // custom trackers to use (array of arrays of strings) (see [bep12](http://www.bittorrent.org/beps/bep_0012.html))
}

callback is called with an error and a Buffer of the torrent data. It is up to you to save it to a file if that's what you want to do.

license

MIT. Copyright (c) Feross Aboukhadijeh.

Keywords

FAQs

Package last updated on 21 May 2014

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