diff --git a/src/settings.js b/src/settings.js new file mode 100644 index 0000000..288830c --- /dev/null +++ b/src/settings.js @@ -0,0 +1,7 @@ +// time in ms to wait between requesting image files +// increase this if you see timeouts or server errors +exports.image_file_request_delay = 500; + +// time in ms to wait between saving Markdown files +// increase this if your file system becomes overloaded +exports.markdown_file_write_delay = 25; diff --git a/src/writer.js b/src/writer.js index bf7723d..5bff9c0 100644 --- a/src/writer.js +++ b/src/writer.js @@ -5,6 +5,7 @@ const path = require('path'); const requestPromiseNative = require('request-promise-native'); const shared = require('./shared'); +const settings = require('./settings'); async function writeFilesPromise(posts, config) { await writeMarkdownFilesPromise(posts, config); @@ -46,7 +47,7 @@ async function writeMarkdownFilesPromise(posts, config ) { item: post, name: post.meta.slug, destinationPath: getPostPath(post, config), - delay: index * 25 + delay: index * settings.markdown_file_write_delay })); console.log('\nSaving posts...'); @@ -78,7 +79,7 @@ async function writeImageFilesPromise(posts, config) { destinationPath: path.join(imagesDir, filename), delay }; - delay += 100; + delay += settings.image_file_request_delay; return payload; }); });