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

torrentz

Package Overview
Dependencies
Maintainers
1
Versions
158
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

torrentz - npm Package Compare versions

Comparing version 7.0.5 to 7.0.6

27

index.js

@@ -132,3 +132,4 @@ const WebTorrent = require('webtorrent')

const signatureBuff = Buffer.from(data.sig, 'hex')
const encodedSignatureData = this.encodeSigData({ seq: data.sequence, v: { ih: hashBuff, ...data.stuff } })
const stuffBuff = this.stuffToBuff(data.stuff)
const encodedSignatureData = this.encodeSigData({ seq: data.sequence, v: { ih: hashBuff, ...stuffBuff } })
const addressBuff = Buffer.from(data.address, 'hex')

@@ -141,3 +142,3 @@

const putData = await new Promise((resolve, reject) => {
this.webtorrent.dht.put({ k: addressBuff, v: {ih: hashBuff, ...data.stuff}, seq: data.sequence, sig: signatureBuff }, (putErr, hash, number) => {
this.webtorrent.dht.put({ k: addressBuff, v: {ih: hashBuff, ...stuffBuff}, seq: data.sequence, sig: signatureBuff }, (putErr, hash, number) => {
if (putErr) {

@@ -273,3 +274,3 @@ reject(putErr)

const checkTorrent = await Promise.race([
this.delayTimeOut(useTimeout, this.errName(new Error(id + ' took too long, it timed out'), 'ErrorTimeout'), false),
this.delayTimeOut(useTimeout, this.errName(new Error(id.infohash + ' took too long, it timed out'), 'ErrorTimeout'), false),
this.startTorrent(folderPath, { ...useOpts, destroyStoreOnDestroy: false })

@@ -292,12 +293,12 @@ ])

checkTorrent.files.forEach(file => {file.urlPath = file.path.slice(checkTorrent.name.length).replace(/\\/g, '/')})
this.checkId.set(id, checkTorrent)
this.checkId.set(checkTorrent.infohash, checkTorrent)
return pathToData === '/' ? checkTorrent : pathToData.includes('.') ? checkTorrent.files.find(file => { return pathToData === file.urlPath }) : checkTorrent.files.filter(file => {return file.urlPath.includes(pathToData)})
} else {
const folderPath = path.join(this._storage, id)
const folderPath = path.join(this._storage, id.infohash)
const checkTorrent = await Promise.race([
this.delayTimeOut(useTimeout, this.errName(new Error(id + ' took too long, it timed out'), 'ErrorTimeout'), false),
this.midTorrent(id, { path: folderPath, destroyStoreOnDestroy: false })
this.delayTimeOut(useTimeout, this.errName(new Error(id.infohash + ' took too long, it timed out'), 'ErrorTimeout'), false),
this.midTorrent(id.infohash, { path: folderPath, destroyStoreOnDestroy: false })
]).catch(err => {
try {
const haveIt = this.findTheTorrent(id)
const haveIt = this.findTheTorrent(id.infohash)
if(haveIt){

@@ -318,3 +319,3 @@ this.webtorrent.remove(haveIt.infoHash, { destroyStore: false })

checkTorrent.files.forEach(file => {file.urlPath = file.path.slice(checkTorrent.name.length).replace(/\\/g, '/')})
this.checkId.set(id, checkTorrent)
this.checkId.set(checkTorrent.infohash, checkTorrent)
return pathToData === '/' ? checkTorrent : pathToData.includes('.') ? checkTorrent.files.find(file => { return pathToData === file.urlPath }) : checkTorrent.files.filter(file => {return file.urlPath.includes(pathToData)})

@@ -369,3 +370,3 @@ }

checkTorrent.files.forEach(file => {file.urlPath = file.path.slice(checkTorrent.name.length).replace(/\\/g, '/')})
this.checkId.set(id.address, checkTorrent)
this.checkId.set(checkTorrent.address, checkTorrent)
return pathToData === '/' ? checkTorrent : pathToData.includes('.') ? checkTorrent.files.find(file => { return pathToData === file.urlPath }) : checkTorrent.files.filter(file => {return file.urlPath.includes(pathToData)})

@@ -409,3 +410,3 @@ } else {

checkTorrent.files.forEach(file => {file.urlPath = file.path.slice(checkTorrent.name.length).replace(/\\/g, '/')})
this.checkId.set(id.address, checkTorrent)
this.checkId.set(checkTorrent.address, checkTorrent)
return pathToData === '/' ? checkTorrent : pathToData.includes('.') ? checkTorrent.files.find(file => { return pathToData === file.urlPath }) : checkTorrent.files.filter(file => {return file.urlPath.includes(pathToData)})

@@ -523,3 +524,3 @@ }

await fs.writeFile(authorPath, JSON.stringify(checkProperty))
this.checkId.set(id.address, checkTorrent)
this.checkId.set(checkTorrent.address, checkTorrent)
return { id: checkTorrent.address, secret: id.secret, title: id.title, address: checkTorrent.address, infohash: checkTorrent.infohash, sequence: checkTorrent.sequence, name: checkTorrent.name, length: checkTorrent.length, files: checkTorrent.files, saved: mainData}

@@ -570,3 +571,3 @@ } else {

this.checkId.set(id.address, checkTorrent)
this.checkId.set(checkTorrent.address, checkTorrent)
return { id: checkTorrent.address, secret: id.secret, title: id.title, address: checkTorrent.address, infohash: checkTorrent.infohash, sequence: checkTorrent.sequence, name: checkTorrent.name, length: checkTorrent.length, files: checkTorrent.files, saved: mainData}

@@ -573,0 +574,0 @@ }

{
"name": "torrentz",
"version": "7.0.5",
"version": "7.0.6",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.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