diff --git a/src/cdn/funcs/checkLocalCache.ts b/src/cdn/funcs/checkLocalCache.ts index e1590e5..b90ab67 100644 --- a/src/cdn/funcs/checkLocalCache.ts +++ b/src/cdn/funcs/checkLocalCache.ts @@ -11,13 +11,18 @@ export default function checkLocalCache(fileName: string, size: number): Promise if (fileStats.size === size) { resolve(true); } else { - //delete file so we can overwrite it - fs.unlink(fileName, function(error) { - if (error) { - reject(error); - } + //TODO: use checksum to verify that file is correct + if (true) { resolve(false); - }); + } else { + //file is incorrect; delete it so we can overwrite it + fs.unlink(fileName, function(error) { + if (error) { + reject(error); + } + resolve(false); + }); + } } } else { resolve(false);