Skip to content
This repository has been archived by the owner on Mar 9, 2021. It is now read-only.

Commit

Permalink
Merge pull request #1 from ngoldman/v1.0.1
Browse files Browse the repository at this point in the history
fix argument error in index
  • Loading branch information
Nate Goldman committed Jan 29, 2015
2 parents c7efe36 + f3170ae commit d0880b2
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 6 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
@@ -1,11 +1,13 @@
# magnet-link changelog

## [Unreleased][unreleased]
## [1.0.1] - 2015-01-28
* use [standard](https://github.com/feross/standard) for npm test
* use [fixpack](https://github.com/henrikjoreteg/fixpack) for true insanity
* add `.travis.yml`
* add tests
* fix a rather serious error in index

## 1.0.0 - 2015-01-23
* first!

[Unreleased]: https://github.com/ngoldman/magnet-link/compare/v1.0.0...HEAD
[1.0.1]: https://github.com/ngoldman/magnet-link/compare/v1.0.0...v1.0.1
2 changes: 2 additions & 0 deletions README.md
@@ -1,5 +1,7 @@
# magnet-link

![](https://travis-ci.org/ngoldman/magnet-link.svg)

Get a magnet from a torrent file.

```
Expand Down
2 changes: 1 addition & 1 deletion index.js
@@ -1,7 +1,7 @@
var readTorrent = require('read-torrent')

module.exports = function (torrent, callback) {
readTorrent(process.argv[2], function (err, torrent) {
readTorrent(torrent, function (err, torrent) {
if (err) return callback(err)
if (!torrent.infoHash) return callback(new Error('Missing info hash'))

Expand Down
7 changes: 4 additions & 3 deletions package.json
@@ -1,7 +1,7 @@
{
"name": "magnet-link",
"description": "Get a magnet link from a torrent file.",
"version": "1.0.0",
"version": "1.0.1",
"author": "Nate Goldman <nate@ngoldman.me>",
"bin": {
"magnet-link": "./cli.js"
Expand All @@ -13,7 +13,8 @@
"read-torrent": "^1.2.0"
},
"devDependencies": {
"standard": "^2.0.0"
"standard": "^2.0.0",
"tape": "^3.4.0"
},
"license": "ISC",
"main": "index.js",
Expand All @@ -22,6 +23,6 @@
"url": "https://github.com/ngoldman/magnet-link.git"
},
"scripts": {
"test": "node node_modules/standard/bin/cmd.js"
"test": "node node_modules/standard/bin/cmd.js && node scripts/test.js"
}
}
11 changes: 11 additions & 0 deletions scripts/test.js
@@ -0,0 +1,11 @@
var test = require('tape')
var magnetLink = require('../')
var url = 'http://torcache.net/torrent/EF330B39F4801D25B4245212E75A38634BFC856E.torrent'

test('convert url to magnet link', function (t) {
magnetLink(url, function (err, link) {
if (err) { throw err }
t.equal(link, 'magnet:?xt=urn:btih:ef330b39f4801d25b4245212e75a38634bfc856e')
t.end()
})
})

0 comments on commit d0880b2

Please sign in to comment.