From fecceb87b6bac4ceb62697c2e0003b481638913b Mon Sep 17 00:00:00 2001 From: Johnathan Amit-Kanarek Date: Wed, 5 Aug 2020 11:58:08 +0300 Subject: [PATCH] Support remote input files over http --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index d5306e7..c758686 100644 --- a/index.js +++ b/index.js @@ -19,7 +19,7 @@ const loadedFonts = []; // See #16 const checkTransition = (transition) => assert(transition == null || typeof transition === 'object', 'Transition must be an object'); -const assertFileExists = async (path) => assert(await fs.exists(path), `File does not exist ${path}`); +const assertFileExists = async (path, enableRemote) => assert((enableRemote && path.startsWith('http')) || await fs.exists(path), `File does not exist ${path}`); module.exports = async (config = {}) => { @@ -52,7 +52,7 @@ module.exports = async (config = {}) => { const audioFilePath = isGif ? undefined : audioFilePathIn; - if (audioFilePath) await assertFileExists(audioFilePath); + if (audioFilePath) await assertFileExists(audioFilePath, true); checkTransition(defaultsIn.transition); @@ -76,7 +76,7 @@ module.exports = async (config = {}) => { // https://github.com/mifi/editly/issues/39 if (type === 'image') { - await assertFileExists(restLayer.path); + await assertFileExists(restLayer.path, true); } else if (type === 'gl') { await assertFileExists(restLayer.fragmentPath); }