ipfs-unixfs-importer
Advanced tools
Comparing version 15.1.6 to 15.1.7
@@ -35,4 +35,8 @@ import errcode from 'err-code'; | ||
} | ||
if (options.avgChunkSize == null && options.minChunkSize == null && options.maxChunkSize == null) { | ||
throw errcode(new Error('please specify an average chunk size'), 'ERR_INVALID_AVG_CHUNK_SIZE'); | ||
const isInvalidChunkSizes = [min, avg, max].some((size) => size == null || isNaN(size)); | ||
if (isInvalidChunkSizes) { | ||
if (options.avgChunkSize != null) { | ||
throw errcode(new Error('please specify a valid average chunk size number'), 'ERR_INVALID_AVG_CHUNK_SIZE'); | ||
} | ||
throw errcode(new Error('please specify valid numbers for (min|max|avg)ChunkSize'), 'ERR_INVALID_CHUNK_SIZE'); | ||
} | ||
@@ -39,0 +43,0 @@ // validate min/max/avg in the same way as go |
{ | ||
"name": "ipfs-unixfs-importer", | ||
"version": "15.1.6", | ||
"version": "15.1.7", | ||
"description": "JavaScript implementation of the UnixFs importer used by IPFS", | ||
@@ -5,0 +5,0 @@ "license": "Apache-2.0 OR MIT", |
@@ -53,4 +53,10 @@ import errcode from 'err-code' | ||
if (options.avgChunkSize == null && options.minChunkSize == null && options.maxChunkSize == null) { | ||
throw errcode(new Error('please specify an average chunk size'), 'ERR_INVALID_AVG_CHUNK_SIZE') | ||
const isInvalidChunkSizes = [min, avg, max].some((size) => size == null || isNaN(size)) | ||
if (isInvalidChunkSizes) { | ||
if (options.avgChunkSize != null) { | ||
throw errcode(new Error('please specify a valid average chunk size number'), 'ERR_INVALID_AVG_CHUNK_SIZE') | ||
} | ||
throw errcode(new Error('please specify valid numbers for (min|max|avg)ChunkSize'), 'ERR_INVALID_CHUNK_SIZE') | ||
} | ||
@@ -57,0 +63,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
292697
3790