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

piece-length

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

piece-length - npm Package Compare versions

Comparing version 0.0.0 to 1.0.0

.npmignore

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": {

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