MCPcopy Index your code
hub / github.com/EmulatorJS/EmulatorJS / readRARContentWorkerFS

Function readRARContentWorkerFS

data/compression/libunrar.js:291–307  ·  view source on GitHub ↗
(data, password,callbackFn)

Source from the content-addressed store, hash-verified

289 //data: Array of [{ name: 'arc_name.txt', content: File|Blob }] */
290let start=false;
291var readRARContentWorkerFS = function (data, password,callbackFn) {
292 if(data == null || data.length==0 || data.length<1) return null;
293 let files=[];
294 let blobs=[];
295 for (let d of data) if(d.content instanceof File) files.push(d.content); else blobs.push({ name: d.name, data: d.content });
296 if(!start) Module.FS.mkdir('/x')
297 Module.FS.mount(Module.WORKERFS, {
298 files: files,
299 blobs: blobs,
300 encoding: 'binary',
301 canOwn: true,
302 flags: 'w+'
303 }, '/x')
304 if(!start) Module.FS.chdir('/x');
305 start = true;
306 return _readRARContent(data, password,'W',callbackFn)
307}
308
309/**Everything is loaded to the memory so make sure you have enough free memory to hold BOTH the RAR file AND the decompressed content
310 data: Array of [{ name: 'arc_name.txt', content: UTF8string|ArrayBufferView }] */

Callers

nothing calls this directly

Calls 2

_readRARContentFunction · 0.85
mkdirMethod · 0.80

Tested by

no test coverage detected