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

Function fileCompressed

scripts/file-manager.js:956–2677  ·  view source on GitHub ↗
(path, _realPath = false, forceType = false, prefixes = false, _config = false)

Source from the content-addressed store, hash-verified

954
955// Compressed files
956var fileCompressed = function(path, _realPath = false, forceType = false, prefixes = false, _config = false) {
957
958 this.path = path;
959 this.realPath = _realPath || realPath(path, -1);
960 this.forceType = forceType;
961 this.prefixes = prefixes;
962 this.virtualPath = this.path;
963 this.sha = sha1(p.normalize(path));
964
965 if(prefixes)
966 {
967 const extension = app.extname(path);
968
969 if(extension)
970 {
971 for(let ext in prefixes)
972 {
973 if(compatible.compressed[ext].has(extension))
974 {
975 this.sha = prefixes[ext]+'-'+this.sha;
976
977 break;
978 }
979 }
980 }
981 }
982
983 this.cacheFile = 'compressed-files-'+this.sha+'.json';
984 this.tmp = p.join(tempFolder, this.sha);
985 this.tmpPartialExtraction = p.join(this.tmp, this.sha+'-opencomic-partial-extraction.txt');
986 this.tmpIsVector = p.join(this.tmp, this.sha+'-opencomic-is-vector.txt');
987
988 this.contentRightIndex = template.contentRightIndex();
989
990 this.fullExtracted = false;
991
992 this.files = false;
993 this.filesStatus = {};
994 this.metadata = false;
995
996 this.config = this._config = {
997 // only: false,
998 cache: true,
999 //width: window.devicePixelRatio * (handlebarsContext.page.viewModuleSize || 150), // Vector width
1000 width: window.devicePixelRatio * 300, // Vector width
1001 height: false, // Vector height
1002 force: false, // Forces the extraction even if the file exists
1003 log: true,
1004 };
1005
1006 if(_config) this.config = this._config = {...this.config, ..._config};
1007
1008 this._features = {
1009 '7z': { // 7z incldues multiple formats, like zip, rar, tar, etc.
1010 read: true,
1011 single: true,
1012 vector: false,
1013 canvas: false,

Callers

nothing calls this directly

Calls 15

realPathFunction · 0.85
sha1Function · 0.85
releaseFunction · 0.85
lastCompressedFileFunction · 0.85
getGlobalExtractingFunction · 0.85
setGlobalExtractingFunction · 0.85
removePathPartFunction · 0.85
pregQuoteFunction · 0.85
splitPathFunction · 0.85
globalWhenExtractFileFunction · 0.85
resolveFunction · 0.85

Tested by

no test coverage detected