Skip to content
This repository has been archived by the owner on Apr 13, 2018. It is now read-only.

Commit

Permalink
use git-sha1 (for smaller browser bundle)
Browse files Browse the repository at this point in the history
  • Loading branch information
feross committed Sep 15, 2014
1 parent cd53b41 commit 915e7af
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
6 changes: 1 addition & 5 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ module.exports = parseTorrent
module.exports.toBuffer = toBuffer

var bencode = require('bencode')
var crypto = require('crypto')
var path = require('path')
var sha1 = require('git-sha1')

/**
* Parse a torrent. Throws an exception if the torrent is missing required fields.
Expand Down Expand Up @@ -136,10 +136,6 @@ function splitPieces (buf) {
return pieces
}

function sha1 (buf) {
return crypto.createHash('sha1').update(buf).digest('hex')
}

function ensure (bool, fieldName) {
if (!bool) throw new Error('Torrent is missing required field: ' + fieldName)
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"url": "https://github.com/feross/parse-torrent-file/issues"
},
"dependencies": {
"bencode": "^0.6.0"
"bencode": "^0.6.0",
"git-sha1": "^0.1.2"
},
"devDependencies": {
"brfs": "^1.0.0",
Expand Down

0 comments on commit 915e7af

Please sign in to comment.