import*as r from"fs";import{streamArray as t}from"stream-json/streamers/StreamArray";import{ignore as s}from"stream-json/filters/Ignore";import o from"stream-chain";import e from"stream-json/filters/Pick";const m=(m,a,i,n,f)=>new Promise(((p,c)=>{try{const c=[r.createReadStream(m)];i&&c.push(e.withParser({filter:i})),n&&c.push(s({filter:n})),c.push(t()),c.push(...f);const h=o.chain(c);h.on("data",a),h.on("end",(()=>p(!0)))}catch(r){c(r)}})),a=(r,t)=>r.sort(((r,s)=>r[t]<=s[t]?-1:1));export{m as readDataFromFile,a as sortBy};