From c64475325b497a4e029085f6ca55712274210707 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 2 Jul 2023 17:45:33 +0200 Subject: [PATCH] improved some phrasing and defaults, fixed chunk size environment variable --- nextcloud-upload/README.md | 2 +- nextcloud-upload/run.js | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/nextcloud-upload/README.md b/nextcloud-upload/README.md index 3518234..7e1db5a 100644 --- a/nextcloud-upload/README.md +++ b/nextcloud-upload/README.md @@ -14,6 +14,6 @@ steps: - "**/*.md" dest: Uploads/CoolMarkdownFiles # the destination directory basedir: "." # optional, local base directory for files, defaults to . - chunksize: # optional, chunk size in bytes, defaults to 52428800 + chunksize: # optional, chunk size in bytes, defaults to 10485760, or 10 MiB quiet: false # optional, whether to reduce output ``` diff --git a/nextcloud-upload/run.js b/nextcloud-upload/run.js index 07724c8..04ce639 100644 --- a/nextcloud-upload/run.js +++ b/nextcloud-upload/run.js @@ -20,7 +20,7 @@ if (!destEnv) throw "Missing required arg dest"; const baseDir = process.env.PLUGIN_BASEDIR || "."; -const chunkSizeEnv = process.env.PLUGIN_CHUNKSIZE || 50 * 1024 * 1024; +const chunkSizeEnv = process.env.PLUGIN_CHUNKSIZE || 10 * 1024 * 1024; const quiet = process.env.PLUGIN_QUIET || false; upload(); @@ -31,7 +31,7 @@ async function upload() { for (let pattern of filesEnv.split(",")) { let files = await glob.glob(pattern, { cwd: baseDir }); if (!files.length) - console.log("No files to upload"); + console.log(`No files found for pattern ${pattern}`); for (let file of files) { let dest = `${destEnv}/${file}`; if (!quiet) @@ -59,7 +59,7 @@ async function upload() { } // use lib to upload file - await upload.uploadFile(`${baseDir}/${file}`, dest, chunkSizeEnv).then(e => { + await upload.uploadFile(`${baseDir}/${file}`, dest, parseInt(chunkSizeEnv)).then(e => { if (!quiet) console.log(`Uploaded ${file} to ${dest} (${e})`); }).catch(e => {