Comparing version 10.0.7 to 10.0.8
30
index.js
@@ -94,2 +94,32 @@ const WebTorrent = require('webtorrent') | ||
async checkUserData(pathToData){ | ||
const checkPath = path.join(this._user, pathToData) | ||
if(await fs.pathExists(checkPath)){ | ||
const statPath = await fs.stat(checkPath) | ||
if(statPath.isDirectory()){ | ||
statPath.type = 'folder' | ||
const fold = await fs.readdir(checkPath) | ||
return {stat: statPath, folder: fold} | ||
} else if(statPath.isFile()){ | ||
statPath.type = 'file' | ||
const fil = await fs.readFile(checkPath) | ||
return {stat: statPath, file: fil} | ||
} else { | ||
throw new Error('must be a directory or file') | ||
} | ||
} else { | ||
throw new Error('path does not exist') | ||
} | ||
} | ||
async trashUserData(pathToData){ | ||
const checkPath = path.join(this._user, pathToData) | ||
if(await fs.pathExists(checkPath)){ | ||
await fs.remove(checkPath) | ||
return checkPath + ' was removed' | ||
} else { | ||
throw new Error('path does not exist') | ||
} | ||
} | ||
encodeSigData (msg) { | ||
@@ -96,0 +126,0 @@ const ref = { seq: msg.seq, v: msg.v } |
{ | ||
"name": "torrentz", | ||
"version": "10.0.7", | ||
"version": "10.0.8", | ||
"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
39999
813