From caf794b01d24aea3b16bafa9b478a3eaccb96f66 Mon Sep 17 00:00:00 2001 From: n1474335 Date: Wed, 27 Dec 2017 12:29:10 +0000 Subject: [PATCH] Threshold for treating output as a file is now configurable --- src/core/Chef.js | 5 +++-- src/web/html/index.html | 18 +++++++++++------- src/web/index.js | 19 ++++++++++--------- 3 files changed, 24 insertions(+), 18 deletions(-) diff --git a/src/core/Chef.js b/src/core/Chef.js index 06d08aa0..8df6d523 100755 --- a/src/core/Chef.js +++ b/src/core/Chef.js @@ -78,8 +78,9 @@ Chef.prototype.bake = async function(input, recipeConfig, options, progress, ste // Depending on the size of the output, we may send it back as a string or an ArrayBuffer. // This can prevent unnecessary casting as an ArrayBuffer can be easily downloaded as a file. - // 1048576 bytes = 1 MiB - const returnType = this.dish.size() > 1048576 ? Dish.ARRAY_BUFFER : Dish.STRING; + // The threshold is specified in KiB. + const threshold = (options.outputFileThreshold || 1024) * 1024; + const returnType = this.dish.size() > threshold ? Dish.ARRAY_BUFFER : Dish.STRING; return { result: this.dish.type === Dish.HTML ? diff --git a/src/web/html/index.html b/src/web/html/index.html index c8857ff9..7f2c98d0 100755 --- a/src/web/html/index.html +++ b/src/web/html/index.html @@ -342,31 +342,35 @@
- +
- +
- +
- +
- +
- +
- + +
+
+ +