Comparing version 1.0.0 to 1.0.1
27
index.js
@@ -98,2 +98,7 @@ const WebTorrent = require('webtorrent') | ||
errName(err, text){ | ||
err.name = text | ||
return err | ||
} | ||
delayTimeOut (timeout, data, res = false) { | ||
@@ -212,3 +217,3 @@ return new Promise((resolve, reject) => { setTimeout(() => { if (res) { resolve(data) } else { reject(data) } }, timeout) }) | ||
const checkTorrent = await Promise.race([ | ||
this.delayTimeOut(useTimeout, new Error(id + ' took too long, it timed out'), false), | ||
this.delayTimeOut(useTimeout, this.errName(new Error(id + ' took too long, it timed out'), 'ErrorTimeout'), false), | ||
new Promise((resolve, reject) => { | ||
@@ -235,3 +240,3 @@ this.webtorrent.add(id, { path: folderPath, destroyStoreOnDestroy: true }, torrent => { | ||
const checkTorrent = await Promise.race([ | ||
this.delayTimeOut(useTimeout, new Error(id + ' took too long, it timed out'), false), | ||
this.delayTimeOut(useTimeout, this.errName(new Error(id + ' took too long, it timed out'), 'ErrorTimeout'), false), | ||
new Promise((resolve, reject) => { | ||
@@ -244,3 +249,3 @@ this.webtorrent.seed(folderPath, { destroyStoreOnDestroy: true }, torrent => { | ||
const checkProperty = await Promise.race([ | ||
this.delayTimeOut(this._timeout, new Error(id + ' property took too long, it timed out, please try again with only the keypair without the folder'), false), | ||
this.delayTimeOut(this._timeout, this.errName(new Error(id + ' property took too long, it timed out, please try again with only the keypair without the folder'), 'ErrorTimeout'), false), | ||
this.ownData(id, checkTorrent.infoHash) | ||
@@ -263,3 +268,3 @@ ]).catch(error => { | ||
const checkProperty = await Promise.race([ | ||
this.delayTimeOut(this._timeout, new Error(id + ' property took too long, it timed out'), false), | ||
this.delayTimeOut(this._timeout, this.errName(new Error(id + ' property took too long, it timed out'), 'ErrorTimeout'), false), | ||
this.resolveFunc(id) | ||
@@ -284,3 +289,3 @@ ]) | ||
const checkTorrent = await Promise.race([ | ||
this.delayTimeOut(useTimeout, new Error(checkProperty.address + ' took too long, it timed out'), false), | ||
this.delayTimeOut(useTimeout, this.errName(new Error(checkProperty.address + ' took too long, it timed out'), 'ErrorTimeout'), false), | ||
new Promise((resolve, reject) => { | ||
@@ -307,3 +312,3 @@ this.webtorrent.add(checkProperty.infohash, { path: dataPath, destroyStoreOnDestroy: true }, torrent => { | ||
const checkTorrent = await Promise.race([ | ||
this.delayTimeOut(useTimeout, new Error(id + ' took too long, it timed out'), false), | ||
this.delayTimeOut(useTimeout, this.errName(new Error(id + ' took too long, it timed out'), 'ErrorTimeout'), false), | ||
new Promise((resolve, reject) => { | ||
@@ -350,3 +355,3 @@ this.webtorrent.seed(folderPath, { destroyStoreOnDestroy: true }, torrent => { | ||
// await Promise.race([ | ||
// this.delayTimeOut(this._timeout, new Error('took too long to write to disk'), false), | ||
// this.delayTimeOut(this._timeout, this.errName(new Error('took too long to write to disk'), 'ErrorTimeout'), false), | ||
// this.handleFormData(folderPath, headers, data) | ||
@@ -364,3 +369,3 @@ // ]) | ||
const checkTorrent = await Promise.race([ | ||
this.delayTimeOut(useTimeout, new Error('torrent took too long, it timed out'), false), | ||
this.delayTimeOut(useTimeout, this.errName(new Error('torrent took too long, it timed out'), 'ErrorTimeout'), false), | ||
new Promise((resolve, reject) => { | ||
@@ -373,3 +378,3 @@ this.webtorrent.seed(folderPath, { destroyStoreOnDestroy: true }, torrent => { | ||
const checkProperty = await Promise.race([ | ||
this.delayTimeOut(this._timeout, new Error(id.address + ' property took too long, it timed out, please try again with only the keypair without the folder'), false), | ||
this.delayTimeOut(this._timeout, this.errName(new Error(id.address + ' property took too long, it timed out, please try again with only the keypair without the folder'), 'ErrorTimeout'), false), | ||
this.publishFunc(id.address, id.secret, { ih: checkTorrent.infoHash }, count) | ||
@@ -422,3 +427,3 @@ ]).catch(error => { | ||
// await Promise.race([ | ||
// this.delayTimeOut(this._timeout, new Error('took too long to write to disk'), false), | ||
// this.delayTimeOut(this._timeout, this.errName(new Error('took too long to write to disk'), 'ErrorTimeout'), false), | ||
// this.handleFormData(folderPath, headers, data) | ||
@@ -436,3 +441,3 @@ // ]) | ||
const checkTorrent = await Promise.race([ | ||
this.delayTimeOut(useTimeout, new Error('torrent took too long, it timed out'), false), | ||
this.delayTimeOut(useTimeout, this.errName(new Error('torrent took too long, it timed out'), 'ErrorTimeout'), false), | ||
new Promise((resolve, reject) => { | ||
@@ -439,0 +444,0 @@ this.webtorrent.seed(folderPath, { destroyStoreOnDestroy: true }, torrent => { |
{ | ||
"name": "torrentz", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
25319
596