@ronomon/deduplication
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -100,3 +100,3 @@ 'use strict'; | ||
) { | ||
if (sourceSize <= minimum) return sourceSize; | ||
if (sourceSize <= minimum) return -1; | ||
if (sourceSize > maximum) sourceSize = maximum; | ||
@@ -120,3 +120,3 @@ var sourceStart = sourceOffset; | ||
} | ||
return sourceOffset - sourceStart; | ||
return -1; | ||
} | ||
@@ -178,6 +178,3 @@ | ||
while (sourceOffset < sourceLength) { | ||
// If more `source` buffers will follow and if current `source` buffer does | ||
// not have more than `minimum` remaining, then avoid artificial cutpoint: | ||
if (flags === 0 && (sourceLength - sourceOffset) <= minimum) break; | ||
var chunkSize = cut( | ||
var result = cut( | ||
average, | ||
@@ -192,5 +189,15 @@ minimum, | ||
); | ||
if (chunkSize <= 0) { | ||
throw new Error('chunkSize <= 0'); | ||
if (result < 0) { | ||
// No natural cut point was found. | ||
var chunkSize = sourceLength - sourceOffset; | ||
if (chunkSize > maximum) chunkSize = maximum; | ||
// If source is not the last buffer, we may yet find a larger chunk. | ||
// If chunkSize === maximum, we will not find a larger chunk and can emit. | ||
if (flags === 0 && chunkSize < maximum) break; | ||
} else { | ||
var chunkSize = result; | ||
} | ||
if (chunkSize === 0) { | ||
throw new Error('chunkSize === 0'); | ||
} | ||
if (chunkSize < minimum && flags === 0) { | ||
@@ -197,0 +204,0 @@ throw new Error('chunkSize < minimum && flags === 0'); |
{ | ||
"name": "@ronomon/deduplication", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"description": "Fast multi-threaded content-dependent chunking deduplication for Buffers in C++ with a reference implementation in Javascript. Ships with extensive tests, a fuzz test and a benchmark.", | ||
@@ -5,0 +5,0 @@ "main": "binding.node", |
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
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
90723
1151
11