fast-folder-size
Advanced tools
Comparing version 1.7.1 to 2.0.0
@@ -0,4 +1,6 @@ | ||
const fs = require('fs') | ||
const os = require('os') | ||
const https = require('https') | ||
const path = require('path') | ||
const unzipper = require('unzipper') | ||
const decompress = require('decompress') | ||
@@ -10,2 +12,11 @@ // Only run for Windows | ||
// check if du is already installed | ||
if ( | ||
fs.existsSync( | ||
path.join(__dirname, 'bin', `du${process.arch === 'x64' ? '64' : ''}.exe`) | ||
) | ||
) { | ||
process.exit(0) | ||
} | ||
const duZipLocation = | ||
@@ -15,4 +26,33 @@ process.env.FAST_FOLDER_SIZE_DU_ZIP_LOCATION || | ||
// checks for proxy variables in user environment | ||
const proxyAddress = | ||
process.env.HTTPS_PROXY || | ||
process.env.https_proxy || | ||
process.env.HTTP_PROXY || | ||
process.env.http_proxy | ||
if (proxyAddress) { | ||
const proxyOptions = new URL(proxyAddress) | ||
const agent = new https.Agent({ | ||
proxy: { | ||
host: proxyOptions.hostname, | ||
port: proxyOptions.port || 8080, | ||
protocol: proxyOptions.protocol, | ||
auth: proxyOptions.auth, | ||
}, | ||
}) | ||
https.globalAgent = agent | ||
} | ||
https.get(duZipLocation, function (res) { | ||
res.pipe(unzipper.Extract({ path: path.join(__dirname, 'bin') })) | ||
const tempFilePath = path.join(os.tmpdir(), 'du.zip') | ||
const fileStream = fs.createWriteStream(tempFilePath) | ||
res.pipe(fileStream) | ||
fileStream.on('finish', function () { | ||
fileStream.close() | ||
decompress(tempFilePath, path.join(__dirname, 'bin')) | ||
}) | ||
}) |
@@ -8,3 +8,3 @@ const path = require('path') | ||
'bin', | ||
'du.exe' | ||
`du${process.arch === 'x64' ? '64' : ''}.exe` | ||
)}" -nobanner -accepteula -q -c .`, | ||
@@ -11,0 +11,0 @@ |
{ | ||
"name": "fast-folder-size", | ||
"version": "1.7.1", | ||
"version": "2.0.0", | ||
"description": "Node CLI or module to calculate folder size", | ||
@@ -26,13 +26,13 @@ "main": "index.js", | ||
"dependencies": { | ||
"unzipper": "^0.10.11" | ||
"decompress": "^4.2.1" | ||
}, | ||
"devDependencies": { | ||
"@types/node": "^15.6.1", | ||
"eslint": "^7.21.0", | ||
"eslint-config-prettier": "^8.3.0", | ||
"eslint-plugin-prettier": "^3.4.0", | ||
"prettier": "^2.2.1", | ||
"tap": "^15.0.1", | ||
"tsd": "^0.16.0" | ||
"@types/node": "^20.2.5", | ||
"eslint": "^8.41.0", | ||
"eslint-config-prettier": "^8.8.0", | ||
"eslint-plugin-prettier": "^4.2.1", | ||
"prettier": "^2.8.8", | ||
"tap": "^16.3.4", | ||
"tsd": "^0.28.1" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 4 instances in 1 package
Filesystem access
Supply chain riskAccesses the file system, and could potentially read sensitive data.
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
10324
19
176
7
+ Addeddecompress@^4.2.1
+ Addedbase64-js@1.5.1(transitive)
+ Addedbl@1.2.3(transitive)
+ Addedbuffer@5.7.1(transitive)
+ Addedbuffer-alloc@1.2.0(transitive)
+ Addedbuffer-alloc-unsafe@1.1.0(transitive)
+ Addedbuffer-crc32@0.2.13(transitive)
+ Addedbuffer-fill@1.0.0(transitive)
+ Addedcommander@2.20.3(transitive)
+ Addeddecompress@4.2.1(transitive)
+ Addeddecompress-tar@4.1.1(transitive)
+ Addeddecompress-tarbz2@4.1.1(transitive)
+ Addeddecompress-targz@4.1.1(transitive)
+ Addeddecompress-unzip@4.0.1(transitive)
+ Addedend-of-stream@1.4.4(transitive)
+ Addedfd-slicer@1.1.0(transitive)
+ Addedfile-type@3.9.05.2.06.2.0(transitive)
+ Addedfs-constants@1.0.0(transitive)
+ Addedget-stream@2.3.1(transitive)
+ Addedieee754@1.2.1(transitive)
+ Addedis-natural-number@4.0.1(transitive)
+ Addedis-stream@1.1.0(transitive)
+ Addedmake-dir@1.3.0(transitive)
+ Addedobject-assign@4.1.1(transitive)
+ Addedpend@1.2.0(transitive)
+ Addedpify@2.3.03.0.0(transitive)
+ Addedpinkie@2.0.4(transitive)
+ Addedpinkie-promise@2.0.1(transitive)
+ Addedsafe-buffer@5.2.1(transitive)
+ Addedseek-bzip@1.0.6(transitive)
+ Addedstrip-dirs@2.1.0(transitive)
+ Addedtar-stream@1.6.2(transitive)
+ Addedthrough@2.3.8(transitive)
+ Addedto-buffer@1.1.1(transitive)
+ Addedunbzip2-stream@1.4.3(transitive)
+ Addedxtend@4.0.2(transitive)
+ Addedyauzl@2.10.0(transitive)
- Removedunzipper@^0.10.11
- Removedbalanced-match@1.0.2(transitive)
- Removedbig-integer@1.6.52(transitive)
- Removedbinary@0.3.0(transitive)
- Removedbluebird@3.4.7(transitive)
- Removedbrace-expansion@1.1.11(transitive)
- Removedbuffer-indexof-polyfill@1.0.2(transitive)
- Removedbuffers@0.1.1(transitive)
- Removedchainsaw@0.1.0(transitive)
- Removedconcat-map@0.0.1(transitive)
- Removedduplexer2@0.1.4(transitive)
- Removedfs.realpath@1.0.0(transitive)
- Removedfstream@1.0.12(transitive)
- Removedglob@7.2.3(transitive)
- Removedinflight@1.0.6(transitive)
- Removedlistenercount@1.0.1(transitive)
- Removedminimatch@3.1.2(transitive)
- Removedminimist@1.2.8(transitive)
- Removedmkdirp@0.5.6(transitive)
- Removedpath-is-absolute@1.0.1(transitive)
- Removedrimraf@2.7.1(transitive)
- Removedsetimmediate@1.0.5(transitive)
- Removedtraverse@0.3.9(transitive)
- Removedunzipper@0.10.14(transitive)