filer/dist/filer.min.js

6 lines
131 KiB
JavaScript
Raw Permalink Normal View History

2014-06-09 14:40:50 +00:00
/*! filer 0.0.9 2014-06-09 */
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.Filer=t()}}(function(){var t;return function e(t,n,r){function i(a,s){if(!n[a]){if(!t[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(o)return o(a,!0);throw Error("Cannot find module '"+a+"'")}var c=n[a]={exports:{}};t[a][0].call(c.exports,function(e){var n=t[a][1][e];return i(n?n:e)},c,c.exports,e,t,n,r)}return n[a].exports}for(var o="function"==typeof require&&require,a=0;r.length>a;a++)i(r[a]);return i}({1:[function(e,n){(function(e){(function(){function r(t){var e=!1;return function(){if(e)throw Error("Callback was already called.");e=!0,t.apply(i,arguments)}}var i,o,a={};i=this,null!=i&&(o=i.async),a.noConflict=function(){return i.async=o,a};var s=function(t,e){if(t.forEach)return t.forEach(e);for(var n=0;t.length>n;n+=1)e(t[n],n,t)},u=function(t,e){if(t.map)return t.map(e);var n=[];return s(t,function(t,r,i){n.push(e(t,r,i))}),n},c=function(t,e,n){return t.reduce?t.reduce(e,n):(s(t,function(t,r,i){n=e(n,t,r,i)}),n)},f=function(t){if(Object.keys)return Object.keys(t);var e=[];for(var n in t)t.hasOwnProperty(n)&&e.push(n);return e};void 0!==e&&e.nextTick?(a.nextTick=e.nextTick,a.setImmediate="undefined"!=typeof setImmediate?function(t){setImmediate(t)}:a.nextTick):"function"==typeof setImmediate?(a.nextTick=function(t){setImmediate(t)},a.setImmediate=a.nextTick):(a.nextTick=function(t){setTimeout(t,0)},a.setImmediate=a.nextTick),a.each=function(t,e,n){if(n=n||function(){},!t.length)return n();var i=0;s(t,function(o){e(o,r(function(e){e?(n(e),n=function(){}):(i+=1,i>=t.length&&n(null))}))})},a.forEach=a.each,a.eachSeries=function(t,e,n){if(n=n||function(){},!t.length)return n();var r=0,i=function(){e(t[r],function(e){e?(n(e),n=function(){}):(r+=1,r>=t.length?n(null):i())})};i()},a.forEachSeries=a.eachSeries,a.eachLimit=function(t,e,n,r){var i=l(e);i.apply(null,[t,n,r])},a.forEachLimit=a.eachLimit;var l=function(t){return function(e,n,r){if(r=r||function(){},!e.length||0>=t)return r();var i=0,o=0,a=0;(function s(){if(i>=e.length)return r();for(;t>a&&e.length>o;)o+=1,a+=1,n(e[o-1],function(t){t?(r(t),r=function(){}):(i+=1,a-=1,i>=e.length?r():s())})})()}},d=function(t){return function(){var e=Array.prototype.slice.call(arguments);return t.apply(null,[a.each].concat(e))}},h=function(t,e){return function(){var n=Array.prototype.slice.call(arguments);return e.apply(null,[l(t)].concat(n))}},p=function(t){return function(){var e=Array.prototype.slice.call(arguments);return t.apply(null,[a.eachSeries].concat(e))}},m=function(t,e,n,r){var i=[];e=u(e,function(t,e){return{index:e,value:t}}),t(e,function(t,e){n(t.value,function(n,r){i[t.index]=r,e(n)})},function(t){r(t,i)})};a.map=d(m),a.mapSeries=p(m),a.mapLimit=function(t,e,n,r){return g(e)(t,n,r)};var g=function(t){return h(t,m)};a.reduce=function(t,e,n,r){a.eachSeries(t,function(t,r){n(e,t,function(t,n){e=n,r(t)})},function(t){r(t,e)})},a.inject=a.reduce,a.foldl=a.reduce,a.reduceRight=function(t,e,n,r){var i=u(t,function(t){return t}).reverse();a.reduce(i,e,n,r)},a.foldr=a.reduceRight;var v=function(t,e,n,r){var i=[];e=u(e,function(t,e){return{index:e,value:t}}),t(e,function(t,e){n(t.value,function(n){n&&i.push(t),e()})},function(){r(u(i.sort(function(t,e){return t.index-e.index}),function(t){return t.value}))})};a.filter=d(v),a.filterSeries=p(v),a.select=a.filter,a.selectSeries=a.filterSeries;var _=function(t,e,n,r){var i=[];e=u(e,function(t,e){return{index:e,value:t}}),t(e,function(t,e){n(t.value,function(n){n||i.push(t),e()})},function(){r(u(i.sort(function(t,e){return t.index-e.index}),function(t){return t.value}))})};a.reject=d(_),a.rejectSeries=p(_);var y=function(t,e,n,r){t(e,function(t,e){n(t,function(n){n?(r(t),r=function(){}):e()})},function(){r()})};a.detect=d(y),a.detectSeries=p(y),a.some=function(t,e,n){a.each(t,function(t,r){e(t,function(t){t&&(n(!0),n=function(){}),r()})},f
});var e=this.root+t,n=b.call(this,e),r=this.clone();return r.root=n.name,r},remove:function(t){t=this.root+t;var e=this.files[t];if(e||("/"!=t.slice(-1)&&(t+="/"),e=this.files[t]),e&&!e.options.dir)delete this.files[t];else for(var n=this.filter(function(e,n){return n.name.slice(0,t.length)===t}),r=0;n.length>r;r++)delete this.files[n[r].name];return this},generate:function(t){t=v(t||{},{base64:!0,compression:"STORE",type:"base64"}),o.checkSupport(t.type);var e,n,r=[],i=0,s=0;for(var f in this.files)if(this.files.hasOwnProperty(f)){var l=this.files[f],d=l.options.compression||t.compression.toUpperCase(),h=c[d];if(!h)throw Error(d+" is not a valid compression method !");var p=w.call(this,l,h),m=E.call(this,f,l,p,i);i+=m.fileRecord.length+p.compressedSize,s+=m.dirRecord.length,r.push(m)}var _="";_=a.CENTRAL_DIRECTORY_END+"\0\0"+"\0\0"+g(r.length,2)+g(r.length,2)+g(s,4)+g(i,4)+"\0\0";var y=t.type.toLowerCase();for(e="uint8array"===y||"arraybuffer"===y||"blob"===y||"nodebuffer"===y?new k(i+s+_.length):new x(i+s+_.length),n=0;r.length>n;n++)e.append(r[n].fileRecord),e.append(r[n].compressedObject.compressedContent);for(n=0;r.length>n;n++)e.append(r[n].dirRecord);e.append(_);var b=e.finalize();switch(t.type.toLowerCase()){case"uint8array":case"arraybuffer":case"nodebuffer":return o.transformTo(t.type.toLowerCase(),b);case"blob":return o.arrayBuffer2Blob(o.transformTo("arraybuffer",b));case"base64":return t.base64?u.encode(b):b;default:return b}},crc32:function(t,e){if(t===void 0||!t.length)return 0;var n="string"!==o.getTypeOf(t),r=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,373
}if(t.match_length=0,t.lookahead>=se&&t.strstart>0&&(i=t.strstart-1,r=a[i],r===a[++i]&&r===a[++i]&&r===a[++i])){o=t.strstart+ue;do;while(r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&r===a[++i]&&o>i);t.match_length=ue-(o-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=se?(n=T._tr_tally(t,1,t.match_length-se),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(n=T._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),n&&(s(t,!1),0===t.strm.avail_out))return _e}return t.insert=0,e===j?(s(t,!0),0===t.strm.avail_out?be:we):t.last_lit&&(s(t,!1),0===t.strm.avail_out)?_e:ye}function v(t,e){for(var n;;){if(0===t.lookahead&&(d(t),0===t.lookahead)){if(e===D)return _e;break}if(t.match_length=0,n=T._tr_tally(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,n&&(s(t,!1),0===t.strm.avail_out))return _e}return t.insert=0,e===j?(s(t,!0),0===t.strm.avail_out?be:we):t.last_lit&&(s(t,!1),0===t.strm.avail_out)?_e:ye}function _(t){t.window_size=2*t.w_size,o(t.head),t.max_lazy_match=O[t.level].max_lazy,t.good_match=O[t.level].good_length,t.nice_match=O[t.level].nice_length,t.max_chain_length=O[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=se-1,t.match_available=0,t.ins_h=0}function y(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=J,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new I.Buf16(2*oe),this.dyn_dtree=new I.Buf16(2*(2*re+1)),this.bl_tree=new I.Buf16(2*(2*ie+1)),o(this.dyn_ltree),o(this.dyn_dtree),o(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new I.Buf16(ae+1),this.heap=new I.Buf16(2*ne+1),o(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new I.Buf16(2*ne+1),o(this.depth),this.l_buf=0,this.lit_bufsize=0,this.last_lit=0,this.d_buf=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}function b(t){var e;return t&&t.state?(t.total_in=t.total_out=0,t.data_type=K,e=t.state,e.pending=0,e.pending_out=0,0>e.wrap&&(e.wrap=-e.wrap),e.status=e.wrap?le:ge,t.adler=2===e.wrap?0:1,e.last_flush=D,T._tr_init(e),F):r(t,P)}function w(t){var e=b(t);return e===F&&_(t.state),e}function E(t,e){return t&&t.state?2!==t.state.wrap?P:(t.state.gzhead=e,F):P}function x(t,e,n,i,o,a){if(!t)return P;var s=1;if(e===Z&&(e=6),0>i?(s=0,i=-i):i>15&&(s=2,i-=16),1>o||o>G||n!==J||8>i||i>15||0>e||e>9||0>a||a>W)return r(t,P);8===i&&(i=9);var u=new y;return t.state=u,u.strm=t,u.wrap=s,u.gzhead=null,u.w_bits=i,u.w_size=1<<u.w_bits,u.w_mask=u.w_size-1,u.hash_bits=o+7,u.hash_size=1<<u.hash_bits,u.hash_mask=u.hash_size-1,u.hash_shift=~~((u.hash_bits+se-1)/se),u.window=new I.Buf8(2*u.w_size),u.head=new I.Buf16(u.hash_size),u.prev=new I.Buf16(u.w_size),u.lit_bufsize=1<<o+6,u.pending_buf_size=4*u.lit_bufsize,u.pending_buf=new I.Buf8(u.pending_buf_size),u.d_buf=u.lit_bufsize>>1,u.l_buf=3*u.lit_bufsize,u.level=e,u.strategy=a,u.method=n,w(t)}function k(t,e){return x(t,e,J,Q,$,q)}function S(t,e){var n,s,f,l;if(!t||!t.state||e>B||0>e)return t?r(t,P):P;if(s=t.state,!t.output||!t.input&&0!==t.avail_in||s.status===ve&&e!==j)return r(t,0===t.avail_out?V:P);if(s.strm=t,n=s.last_flush,s.last_flush=e,s.status===le)if(2===s.wrap)t.adler=0,u(s,31),u(s,139),u(s,8),s.gzhead?(u(s,(s.gzhead.text?1:0)+(s.gzhead.hcrc?2:0)+(s.gzhead.extra?4:0)+(s.gzhead.name?8:0)+(s.gzhead.comment?16:0)),u(s,255&s.gzhead.time),u(s,255&s.gzhead.time>>8),u(s,255&s.gzhead.time>>16),u(s,255&s.gzhead.time>>24),u(s,9===s.level?2:s.strategy
}t=t.split(":");var r=t[0],i=t[1],o=t[2],a=e.prototype=Error();a.errno=r,a.code=i,a.constructor=e,n[i]=n[r]=e}),e.exports=n},{}],45:[function(t,e){(function(n){function r(t){return function(e,n){e?t(e):t(null,n)}}function i(t,e,n,r,i){function o(n){t.changes.push({event:"change",path:e}),i(n)}var a=t.flags;he(a).contains(Be)&&delete r.ctime,he(a).contains(je)&&delete r.mtime;var s=!1;r.ctime&&(n.ctime=r.ctime,n.atime=r.ctime,s=!0),r.atime&&(n.atime=r.atime,s=!0),r.mtime&&(n.mtime=r.mtime,s=!0),s?t.put(n.id,n,o):o()}function o(t,e,n,r){function o(n,i){n?r(n):i.mode!==Ee?r(new Me.ENOTDIR("a component of the path prefix is not a directory")):(l=i,a(t,e,s))}function s(e,n){!e&&n?r(new Me.EEXIST("path name already exists")):!e||e instanceof Me.ENOENT?t.get(l.data,u):r(e)}function u(e,i){e?r(e):(d=i,h=new Ze(void 0,n),h.nlinks+=1,t.put(h.id,h,f))}function c(e){if(e)r(e);else{var n=Date.now();i(t,m,h,{mtime:n,ctime:n},r)}}function f(e){e?r(e):(d[p]=new Pe(h.id,n),t.put(l.data,d,c))}if(n!==Ee&&n!==we)return r(new Me.EINVAL("mode must be a directory or file"));e=me(e);var l,d,h,p=ve(e),m=ge(e);a(t,m,o)}function a(t,e,n){function r(e,r){e?n(e):r&&r.mode===ke&&r.rnode?t.get(r.rnode,i):n(new Me.EFILESYSTEMERROR)}function i(t,e){t?n(t):e?n(null,e):n(new Me.ENOENT)}function o(e,r){e?n(e):r.mode===Ee&&r.data?t.get(r.data,s):n(new Me.ENOTDIR("a component of the path prefix is not a directory"))}function s(e,r){if(e)n(e);else if(he(r).has(f)){var i=r[f].id;t.get(i,u)}else n(new Me.ENOENT)}function u(t,e){t?n(t):e.mode==xe?(d++,d>Oe?n(new Me.ELOOP):c(e.data)):n(null,e)}function c(e){e=me(e),l=ge(e),f=ve(e),Se==f?t.get(Ae,r):a(t,l,o)}if(e=me(e),!e)return n(new Me.ENOENT("path is an empty string"));var f=ve(e),l=ge(e),d=0;Se==f?t.get(Ae,r):a(t,l,o)}function s(t,e,n,r,o,s){function u(e,a){function u(e){e?s(e):i(t,c,a,{ctime:Date.now()},s)}a?a.xattrs[n]:null,e?s(e):o===ze&&a.xattrs.hasOwnProperty(n)?s(new Me.EEXIST("attribute already exists")):o!==Le||a.xattrs.hasOwnProperty(n)?(a.xattrs[n]=r,t.put(a.id,a,u)):s(new Me.ENOATTR)}var c;"string"==typeof e?(c=e,a(t,e,u)):"object"==typeof e&&"string"==typeof e.id?(c=e.path,t.get(e.id,u)):s(new Me.EINVAL("path or file descriptor of wrong type"))}function u(t,e){function n(n,i){!n&&i?e(new Me.EEXIST):!n||n instanceof Me.ENOENT?(o=new Ve,t.put(o.id,o,r)):e(n)}function r(n){n?e(n):(a=new Ze(o.rnode,Ee),a.nlinks+=1,t.put(a.id,a,i))}function i(n){n?e(n):(s={},t.put(a.data,s,e))}var o,a,s;t.get(Ae,n)}function c(t,e,n){function r(e,r){!e&&r?n(new Me.EEXIST):!e||e instanceof Me.ENOENT?a(t,g,o):n(e)}function o(e,r){e?n(e):(h=r,t.get(h.data,s))}function s(e,r){e?n(e):(p=r,l=new Ze(void 0,Ee),l.nlinks+=1,t.put(l.id,l,u))}function u(e){e?n(e):(d={},t.put(l.data,d,f))}function c(e){if(e)n(e);else{var r=Date.now();i(t,g,h,{mtime:r,ctime:r},n)}}function f(e){e?n(e):(p[m]=new Pe(l.id,Ee),t.put(h.data,p,c))}e=me(e);var l,d,h,p,m=ve(e),g=ge(e);a(t,e,r)}function f(t,e,n){function r(e,r){e?n(e):(m=r,t.get(m.data,o))}function o(e,r){e?n(e):Se==v?n(new Me.EBUSY):he(r).has(v)?(g=r,h=g[v].id,t.get(h,s)):n(new Me.ENOENT)}function s(e,r){e?n(e):r.mode!=Ee?n(new Me.ENOTDIR):(h=r,t.get(h.data,u))}function u(t,e){t?n(t):(p=e,he(p).size()>0?n(new Me.ENOTEMPTY):f())}function c(e){if(e)n(e);else{var r=Date.now();i(t,_,m,{mtime:r,ctime:r},l)}}function f(){delete g[v],t.put(m.data,g,c)}function l(e){e?n(e):t.delete(h.id,d)}function d(e){e?n(e):t.delete(h.data,n)}e=me(e);var h,p,m,g,v=ve(e),_=ge(e);a(t,_,r)}function l(t,e,r,o){function s(e,n){e?o(e):(v=n,t.get(v.data,u))}function u(e,n){e?o(e):(_=n,he(_).has(E)?he(r).contains(Ce)?o(new Me.ENOENT("O_CREATE and O_EXCLUSIVE are set, and the named file exists")):(y=_[E],y.type==Ee&&he(r).contains(Te)?o(new Me.EISDIR("the named file is a directory and O_WRITE is set")):t.get(y.id,c)):he(r).contains(Re)?d():o(new Me.ENOENT("O_CREATE is not set and the named file does not exist")))}function c(t,e){if(t)o(t);else{var n=e;n.mode==xe?(k++,k>Oe?o(new Me.ELOOP):f(n.data)):l(void 0,n)}}function f(n){n=me(n),x=ge(n),E=ve(n),Se==E&&(he(r).contains(Te)?o(new Me.EISDIR("the named file is a directory
}),a.each(c,o,function(e){return e?(n(e),void 0):(s.rmdir(t,n),void 0)}),void 0):(n(new i.ENOTEMPTY),void 0)}),void 0)})}var s=this.fs;return"function"==typeof e&&(n=e,e={}),e=e||{},n=n||function(){},t?(o(t,n),void 0):(n(new i.EINVAL("Missing path argument")),void 0)},n.prototype.tempDir=function(t){var e=this.fs,n=this.env.get("TMP");t=t||function(){},e.mkdir(n,function(){t(null,n)})},n.prototype.mkdirp=function(t,e){function n(t,e){o.stat(t,function(a,s){if(s){if(s.isDirectory())return e(),void 0;if(s.isFile())return e(new i.ENOTDIR),void 0}else{if(a&&"ENOENT"!==a.code)return e(a),void 0;var u=r.dirname(t);"/"===u?o.mkdir(t,function(t){return t&&"EEXIST"!=t.code?(e(t),void 0):(e(),void 0)}):n(u,function(n){return n?e(n):(o.mkdir(t,function(t){return t&&"EEXIST"!=t.code?(e(t),void 0):(e(),void 0)}),void 0)})}})}var o=this.fs;return e=e||function(){},t?"/"===t?(e(),void 0):(n(t,e),void 0):(e(new i.EINVAL("Missing path argument")),void 0)},n.prototype.wget=function(t,e,n){function o(){n(Error("unable to get resource"))}var a=this.fs;if("function"==typeof e&&(n=e,e={}),e=e||{},n=n||function(){},!t)return n(new i.EINVAL("missing url argument")),void 0;var u=e.filename||t.split("/").pop();u=r.resolve(a.cwd,u),s.download(t,function(t,e){return t||!e?o():(a.writeFile(u,e,function(t){t?n(t):n(null,u)}),void 0)})},n.prototype.unzip=function(t,e,n){var o=this.fs,s=this;if("function"==typeof e&&(n=e,e={}),e=e||{},n=n||function(){},!t)return n(new i.EINVAL("missing zipfile argument")),void 0;var c=r.resolve(this.cwd,t),f=r.resolve(e.destination||this.cwd);o.readFile(c,function(t,e){function i(t,e){t.isDirectory?s.mkdirp(t.absPath,e):o.writeFile(t.absPath,t.data,e)}if(t)return n(t);var c=new u(e),l=[];c.filter(function(t,e){var n=e.options.dir,i=n?null:e.asNodeBuffer();l.push({absPath:r.join(f,e.name),isDirectory:n,data:i})}),a.eachSeries(l,i,n)})},n.prototype.zip=function(t,e,n,o){function s(t){return t.replace(/^\//,"")}function c(t,e){d.readFile(t,function(n,r){return n?e(n):(p.file(s(t),r,{binary:!0}),e(),void 0)})}function f(t,e){d.readdir(t,function(i,o){p.folder(s(t)),n.recursive||e(),a.eachSeries(o,function(e,n){l(r.join(t,e),n)},e)})}function l(t,e){t=r.resolve(h.cwd,t),d.stat(t,function(n,r){return n?e(n):(r.isDirectory()?f(t,e):c(t,e),void 0)})}var d=this.fs,h=this;if("function"==typeof n&&(o=n,n={}),n=n||{},o=o||function(){},!t)return o(new i.EINVAL("missing zipfile argument")),void 0;if(!e)return o(new i.EINVAL("missing paths argument")),void 0;"string"==typeof e&&(e=[e]),t=r.resolve(this.cwd,t);var p=new u;d.stat(t,function(n,r){return r?o(new i.EEXIST("zipfile already exists")):(a.eachSeries(e,l,function(e){if(e)return o(e);var n;n=p.generate({type:"nodebuffer"}),d.writeFile(t,n,o)}),void 0)})},e.exports=n},{"../../lib/async.js":1,"../encoding.js":43,"../errors.js":44,"../path.js":51,"./environment.js":57,"./network.js":58,jszip:13}],60:[function(t,e){function n(t,e){this.node=t.id,this.dev=e,this.size=t.size,this.nlinks=t.nlinks,this.atime=t.atime,this.mtime=t.mtime,this.ctime=t.ctime,this.type=t.mode}var r=t("./constants.js");n.prototype.isFile=function(){return this.type===r.MODE_FILE},n.prototype.isDirectory=function(){return this.type===r.MODE_DIRECTORY},n.prototype.isSymbolicLink=function(){return this.type===r.MODE_SYMBOLIC_LINK},n.prototype.isSocket=n.prototype.isFIFO=n.prototype.isCharacterDevice=n.prototype.isBlockDevice=function(){return!1},e.exports=n},{"./constants.js":41}],61:[function(t,e){var n=t("./constants.js"),r=t("./shared.js").guid;e.exports=function(t,e,i){var o=Date.now();this.id=n.SUPER_NODE_ID,this.mode=n.MODE_META,this.atime=t||o,this.ctime=e||o,this.mtime=i||o,this.rnode=r()}},{"./constants.js":41,"./shared.js":56}]},{},[48])(48)});