UNPKG

@substrate-system/fflate

Version:

High performance (de)compression in an 8kB package

3 lines (2 loc) 1.09 kB
var _=Object.defineProperty;var i=(e,t)=>_(e,"name",{value:t,configurable:!0}),m=(e=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(e,{get:(t,s)=>(typeof require<"u"?require:t)[s]}):e)(function(e){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+e+'" is not supported')});var u,p=";var __w=require('worker_threads');__w.parentPort.on('message',function(m){onmessage({data:m})}),postMessage=function(m,t){__w.parentPort.postMessage(m,t)},close=process.exit;self=global";try{u=m("worker_threads").Worker}catch{}var w=u?(e,t,s,l,o)=>{let n=!1,a=new u(e+p,{eval:!0}).on("error",r=>o(r,null)).on("message",r=>o(null,r)).on("exit",r=>{r&&!n&&o(new Error("exited with code "+r),null)});return a.postMessage(s,l),a.terminate=()=>(n=!0,u.prototype.terminate.call(a)),a}:(e,t,s,l,o)=>{setImmediate(()=>o(new Error("async operations unsupported - update to Node 12+ (or Node 10-11 with the --experimental-worker CLI flag)"),null));let n=i(()=>{},"NOP");return{terminate:n,postMessage:n}};export{w as default}; //# sourceMappingURL=node-worker.min.js.map