piece-length
Advanced tools
Comparing version 0.0.0 to 1.0.0
13
index.js
var closest = require('closest-to') | ||
var kB = Math.pow(2, 10) | ||
// Create a range from 16kb–4mb | ||
var sizes = [] | ||
for (var i = 14; i <= 22; i++) { | ||
sizes.push(Math.pow(2, i)) | ||
} | ||
var p = 13, range = [] | ||
while (p++ < 22) range.push(Math.pow(2, p)) | ||
module.exports = function(size) { | ||
return closest( | ||
size / Math.pow(2, 10), sizes | ||
) | ||
module.exports = function (bytes) { | ||
return closest(bytes / kB, range) | ||
} |
{ | ||
"name": "piece-length", | ||
"version": "0.0.0", | ||
"version": "1.0.0", | ||
"description": "Finds the optimal piece length for a given number of bytes.", | ||
@@ -10,3 +10,3 @@ "main": "index.js", | ||
"dependencies": { | ||
"closest-to": "~0.0.1" | ||
"closest-to": "~2.0.0" | ||
}, | ||
@@ -13,0 +13,0 @@ "devDependencies": { |
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
4611
6
1
94
+ Addedclosest-to@2.0.0(transitive)
- Removedclosest-to@0.0.2(transitive)
Updatedclosest-to@~2.0.0