MCPcopy
hub / github.com/ollm/OpenComic / _validate

Function _validate

scripts/cache.js:697–735  ·  view source on GitHub ↗
(files, type = '')

Source from the content-addressed store, hash-verified

695}
696
697function _validate(files, type = '')
698{
699 const correct = [];
700 const corruptedZstd = [];
701 const corruptedJson = [];
702 const readError = [];
703 const notInCache = [];
704
705 for(let i = 0, len = files.length; i < len; i++)
706 {
707 const file = files[i];
708 const path = (type == 'servers' ? serverClient.fixPath(file.path) : file.path);
709 const sha = sha1(path);
710 const name = (type == 'servers' ? 'server-files-'+sha+'.json' : 'compressed-files-'+sha+'.json');
711
712 const status = validateJson(name);
713
714 if(status == 'correct')
715 correct.push(path);
716 else if(status == 'corruptedZstd')
717 corruptedZstd.push(path);
718 else if(status == 'corruptedJson')
719 corruptedJson.push(path);
720 else if(status == 'readError')
721 readError.push(path);
722 else if(status == 'notInCache')
723 notInCache.push(path);
724 }
725
726 console.log('Correct: '+correct.length+'\nCorrupted Zstd: '+corruptedZstd.length+'\nCorrupted Json: '+corruptedJson.length+'\nRead Error: '+readError.length+'\nNot in Cache: '+notInCache.length);
727 console.log({
728 correct: correct,
729 corruptedZstd: corruptedZstd,
730 corruptedJson: corruptedJson,
731 readError: readError,
732 notInCache: notInCache,
733 });
734 console.log(' ');
735}
736
737function validateThumbnails(images, type = '')
738{

Callers 1

validateFunction · 0.85

Calls 2

sha1Function · 0.85
validateJsonFunction · 0.85

Tested by

no test coverage detected