All Projects → webtorrent → Create Torrent

webtorrent / Create Torrent

Licence: mit
Create .torrent files

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Create Torrent

Bittorrent Protocol
Simple, robust, BitTorrent peer wire protocol implementation
Stars: ✭ 279 (+5.68%)
Mutual labels:  torrent, bittorrent, webtorrent, browser
Webtorrent Hybrid
WebTorrent (with WebRTC support in Node.js)
Stars: ✭ 422 (+59.85%)
Mutual labels:  torrent, bittorrent, webtorrent, browser
Parse Torrent
Parse a torrent identifier (magnet uri, .torrent file, info hash)
Stars: ✭ 325 (+23.11%)
Mutual labels:  torrent, bittorrent, webtorrent, browser
Webtorrent
⚡️ Streaming torrent client for the web
Stars: ✭ 25,554 (+9579.55%)
Mutual labels:  torrent, bittorrent, webtorrent, browser
Bittorrent Tracker
🌊 Simple, robust, BitTorrent tracker (client & server) implementation
Stars: ✭ 1,184 (+348.48%)
Mutual labels:  torrent, bittorrent, webtorrent, browser
Magnet Uri
Parse a magnet URI and return an object of keys/values
Stars: ✭ 183 (-30.68%)
Mutual labels:  torrent, bittorrent, webtorrent, browser
Torrent Discovery
Discover BitTorrent and WebTorrent peers
Stars: ✭ 177 (-32.95%)
Mutual labels:  torrent, bittorrent, webtorrent, browser
Ut metadata
BitTorrent Extension for Peers to Send Metadata Files (BEP 9)
Stars: ✭ 98 (-62.88%)
Mutual labels:  bittorrent, webtorrent, browser
Diffy
🎞️💓🍿 Love streaming - It's always best to watch a movie together ! 🤗
Stars: ✭ 37 (-85.98%)
Mutual labels:  torrent, bittorrent, webtorrent
Bittorrent Dht
🕸 Simple, robust, BitTorrent DHT implementation
Stars: ✭ 1,004 (+280.3%)
Mutual labels:  torrent, bittorrent, webtorrent
CheckWebPeer
Check WebRTC peers of torrents.
Stars: ✭ 19 (-92.8%)
Mutual labels:  torrent, bittorrent, webtorrent
ut pex
Implementation of ut_pex bittorrent protocol (PEX) for webtorrent
Stars: ✭ 54 (-79.55%)
Mutual labels:  torrent, bittorrent, webtorrent
Wt Tracker
High-performance WebTorrent tracker
Stars: ✭ 144 (-45.45%)
Mutual labels:  torrent, bittorrent, webtorrent
Torrentpier
Main project repository
Stars: ✭ 166 (-37.12%)
Mutual labels:  torrent, bittorrent, webtorrent
Bittorrent Peerid
Map a BitTorrent peer ID to a human-readable client name and version
Stars: ✭ 47 (-82.2%)
Mutual labels:  torrent, bittorrent, webtorrent
parse-torrent-file
DEPRECATED: Parse a .torrent file and return an object of keys/values
Stars: ✭ 62 (-76.52%)
Mutual labels:  torrent, bittorrent, webtorrent
autobrr
Automation for downloads.
Stars: ✭ 288 (+9.09%)
Mutual labels:  torrent, bittorrent
Instant.io
🚀 Streaming file transfer over WebTorrent (torrents on the web)
Stars: ✭ 2,954 (+1018.94%)
Mutual labels:  bittorrent, webtorrent
rarbg-api
A simple node.js wrapper for rarbg.to api
Stars: ✭ 21 (-92.05%)
Mutual labels:  torrent, bittorrent
webtorrent-webui
Web user interface for Webtorrent, based on the Transmission web UI
Stars: ✭ 41 (-84.47%)
Mutual labels:  bittorrent, webtorrent

create-torrent travis npm downloads javascript style guide

Create .torrent files

creation

This module is used by WebTorrent! This module works in node.js and the browser (with browserify).

install

npm install create-torrent

usage

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

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

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

A reasonable piece length (approx. 1024 pieces) will automatically be selected for the .torrent file, or you can override it if you want a different size (See API docs below).

api

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

Create a new .torrent file.

input can be any of the following:

  • path to the file or folder on filesystem (string)
  • W3C File object (from an <input> or drag and drop)
  • W3C FileList object (basically an array of File objects)
  • Node Buffer object
  • Node stream.Readable object

Or, an array of string, File, Buffer, or stream.Readable objects.

opts is optional and allows you to set special settings on the produced .torrent file.

{
  name: String,             // name of the torrent (default = basename of `path`, or 1st file's name)
  comment: String,          // free-form textual comments of the author
  createdBy: String,        // name and version of program used to create torrent
  creationDate: Date        // creation time in UNIX epoch format (default = now)
  filterJunkFiles: Boolean, // remove hidden and other junk files? (default = true)
  private: Boolean,         // is this a private .torrent? (default = false)
  pieceLength: Number,      // force a custom piece length (number of bytes)
  announceList: [[String]], // custom trackers (array of arrays of strings) (see [bep12](http://www.bittorrent.org/beps/bep_0012.html))
  urlList: [String],        // web seed urls (see [bep19](http://www.bittorrent.org/beps/bep_0019.html))
  info: Object              // add non-standard info dict entries, e.g. info.source, a convention for cross-seeding 
}

If announceList is omitted, the following trackers will be included automatically:

  • udp://tracker.openbittorrent.com:80
  • udp://tracker.internetwarriors.net:1337
  • udp://tracker.leechers-paradise.org:6969
  • udp://tracker.coppersurfer.tk:6969
  • udp://exodus.desync.com:6969
  • wss://tracker.btorrent.xyz
  • wss://tracker.openwebtorrent.com
  • wss://tracker.fastcast.nz

Trackers that start with wss:// are for WebRTC peers. See WebTorrent to learn more.

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.

Note: Every torrent is required to have a name. If one is not explicitly provided through opts.name, one will be determined automatically using the following logic:

  • If all files share a common path prefix, that will be used. For example, if all file paths start with /imgs/ the torrent name will be imgs.
  • Otherwise, the first file that has a name will determine the torrent name. For example, if the first file is /foo/bar/baz.txt, the torrent name will be baz.txt.
  • If no files have names (say that all files are Buffer or Stream objects), then a name like "Unnamed Torrent " will be generated.

Note: Every file is required to have a name. For filesystem paths or W3C File objects, the name is included in the object. For Buffer or Readable stream types, a name property can be set on the object, like this:

const buf = Buffer.from('Some file content')
buf.name = 'Some file name'

command line

usage: create-torrent <directory OR file> {-o outfile.torrent}

Create a torrent file from a directory or file.

If an output file isn\'t specified with `-o`, the torrent file will be
written to stdout.

license

MIT. Copyright (c) Feross Aboukhadijeh and WebTorrent, LLC.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].