Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

torrent-to-magnet

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

torrent-to-magnet - npm Package Compare versions

Comparing version 1.0.0 to 1.0.1

.travis.yml

3

cli.js
#!/usr/bin/env node
var readTorrent = require('./index.js');
if (!process.argv[2]) {
console.error('usage: torrent-to-magnet url');
console.error('Usage: torrent-to-magnet url');
process.exit(1);

@@ -6,0 +7,0 @@ }

@@ -20,2 +20,15 @@ var request = require('request');

var onData = function(err, data) {
if (err) {
return asyncCallback(err);
}
try {
var result = parseTorrent(data);
var uri = parseTorrent.toMagnetURI(result);
} catch (err) {
return asyncCallback(err);
}
asyncCallback(err, uri);
};
var onResponse = function(err, response) {

@@ -34,19 +47,9 @@ if (err) {

var onData = function(err, data) {
if (err) {
return asyncCallback(err);
}
try {
var result = parseTorrent(data);
var uri = parseTorrent.toMagnetURI(result);
} catch (err) {
return asyncCallback(err);
}
asyncCallback(err, uri);
};
if (/^http?:/.test(url)) {
return request(extend({ url: url, encoding: null }, options), onResponse);
}
var httpRegex = new RegExp(/^https?:/);
if (httpRegex.test(url)) {
return request(extend({ url: url, encoding: null }, options), onResponse);
}
};
{
"name": "torrent-to-magnet",
"version": "1.0.0",
"version": "1.0.1",
"description": "Generate magnet-uri from torrent file",
"repository": "git://github.com/apsdehal/torrent-to-magnet.git",
"dependencies": {
"parse-torrent": "~1.0.0",
"extend": "^3.0.0",
"parse-torrent": "^5.3.0",
"request": "~2.16.2"

@@ -12,3 +13,10 @@ },

"torrent-to-magnet": "./cli.js"
},
"devDependencies": {
"chai": "^2.2.0",
"mocha": "~2.2.1"
},
"scripts": {
"test": "./node_modules/mocha/bin/mocha -u bdd test.js"
}
}
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