w-ftp 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +50 -33
- package/dist/w-ftp.umd.js +2 -2
- package/dist/w-ftp.umd.js.map +1 -1
- package/docs/WFtp.mjs.html +208 -89
- package/docs/global.html +345 -182
- package/docs/index.html +2 -2
- package/docs/jsftp.js.html +7 -3
- package/g-download.mjs +26 -10
- package/g-upload.mjs +26 -11
- package/package.json +3 -2
- package/src/WFtp.mjs +206 -87
- package/src/jsftp.js +5 -1
package/README.md
CHANGED
|
@@ -25,6 +25,7 @@ npm i w-ftp
|
|
|
25
25
|
import path from 'path'
|
|
26
26
|
import fs from 'fs'
|
|
27
27
|
import WFtp from './src/WFtp.mjs'
|
|
28
|
+
// import WFtp from './dist/w-ftp.umd.js'
|
|
28
29
|
|
|
29
30
|
|
|
30
31
|
//st
|
|
@@ -41,24 +42,32 @@ async function test_dw() {
|
|
|
41
42
|
// console.log('ftp', ftp)
|
|
42
43
|
|
|
43
44
|
await ftp.conn({
|
|
44
|
-
hostname:
|
|
45
|
-
port:
|
|
46
|
-
username:
|
|
47
|
-
password:
|
|
45
|
+
hostname: st.dw.hostname,
|
|
46
|
+
port: st.dw.port,
|
|
47
|
+
username: st.dw.username,
|
|
48
|
+
password: st.dw.password,
|
|
48
49
|
})
|
|
49
50
|
|
|
50
|
-
|
|
51
|
-
console.log('ftp.ls', fps[0], fps.length)
|
|
51
|
+
async function core() {
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
console.log('ftp.
|
|
55
|
-
})
|
|
56
|
-
console.log('ftp.download', r)
|
|
53
|
+
let fps = await ftp.ls('.')
|
|
54
|
+
console.log('ftp.ls', fps[0], fps.length)
|
|
57
55
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
56
|
+
r = await ftp.download('./DECL_20210805055044.csv', './_test_download_client/DECL_20210805055044.csv', (p) => {
|
|
57
|
+
console.log('ftp.download p', p.name, p.progress)
|
|
58
|
+
})
|
|
59
|
+
console.log('ftp.download', r)
|
|
60
|
+
|
|
61
|
+
r = await ftp.syncToLocal('.', './_test_download_client', (p) => {
|
|
62
|
+
console.log('ftp.syncToLocal p', p.name, p.progress)
|
|
63
|
+
})
|
|
64
|
+
console.log('ftp.syncToLocal', r)
|
|
65
|
+
|
|
66
|
+
}
|
|
67
|
+
await core()
|
|
68
|
+
.catch((err) => {
|
|
69
|
+
console.log(err)
|
|
70
|
+
})
|
|
62
71
|
|
|
63
72
|
r = await ftp.quit()
|
|
64
73
|
console.log('ftp.quit', r)
|
|
@@ -79,6 +88,8 @@ test_dw()
|
|
|
79
88
|
// groupPermissions: { read: true, write: true, exec: false },
|
|
80
89
|
// otherPermissions: { read: true, write: true, exec: false }
|
|
81
90
|
// } 74
|
|
91
|
+
// ftp.isFile false
|
|
92
|
+
// ftp.isFolder false
|
|
82
93
|
// ftp.download p DECL_20210805055044.csv 4.7320871554333515
|
|
83
94
|
// ftp.download p DECL_20210805055044.csv 9.464174310866703
|
|
84
95
|
// ftp.download p DECL_20210805055044.csv 14.196261466300053
|
|
@@ -105,8 +116,6 @@ test_dw()
|
|
|
105
116
|
// ftp.syncToLocal { num: 0, files: [] }
|
|
106
117
|
// ftp.quit { code: 221, text: '221 Goodbye.', isMark: false, isError: false }
|
|
107
118
|
|
|
108
|
-
//node --experimental-modules --es-module-specifier-resolution=node g-download.mjs
|
|
109
|
-
|
|
110
119
|
```
|
|
111
120
|
|
|
112
121
|
#### Example for upload:
|
|
@@ -115,6 +124,7 @@ test_dw()
|
|
|
115
124
|
import path from 'path'
|
|
116
125
|
import fs from 'fs'
|
|
117
126
|
import WFtp from './src/WFtp.mjs'
|
|
127
|
+
// import WFtp from './dist/w-ftp.umd.js'
|
|
118
128
|
|
|
119
129
|
|
|
120
130
|
//st
|
|
@@ -131,24 +141,32 @@ async function test_up() {
|
|
|
131
141
|
// console.log('ftp', ftp)
|
|
132
142
|
|
|
133
143
|
await ftp.conn({
|
|
134
|
-
hostname:
|
|
135
|
-
port:
|
|
136
|
-
username:
|
|
137
|
-
password:
|
|
144
|
+
hostname: st.up.hostname,
|
|
145
|
+
port: st.up.port,
|
|
146
|
+
username: st.up.username,
|
|
147
|
+
password: st.up.password,
|
|
138
148
|
})
|
|
139
149
|
|
|
140
|
-
|
|
141
|
-
console.log('ftp.ls', fps[0], fps.length)
|
|
150
|
+
async function core() {
|
|
142
151
|
|
|
143
|
-
|
|
144
|
-
console.log('ftp.
|
|
145
|
-
})
|
|
146
|
-
console.log('ftp.upload', r)
|
|
152
|
+
let fps = await ftp.ls('.')
|
|
153
|
+
console.log('ftp.ls', fps[0], fps.length)
|
|
147
154
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
155
|
+
r = await ftp.upload('./_test_upload_client/DECL_20210805055044.csv', './DECL_20210805055044.csv', (p) => {
|
|
156
|
+
console.log('ftp.upload p', p.name, p.progress)
|
|
157
|
+
})
|
|
158
|
+
console.log('ftp.upload', r)
|
|
159
|
+
|
|
160
|
+
r = await ftp.syncToRemote('./_test_upload_client', '.', (p) => {
|
|
161
|
+
console.log('ftp.syncToRemote p', p.name, p.progress)
|
|
162
|
+
})
|
|
163
|
+
console.log('ftp.syncToRemote', r)
|
|
164
|
+
|
|
165
|
+
}
|
|
166
|
+
await core()
|
|
167
|
+
.catch((err) => {
|
|
168
|
+
console.log(err)
|
|
169
|
+
})
|
|
152
170
|
|
|
153
171
|
r = await ftp.quit()
|
|
154
172
|
console.log('ftp.quit', r)
|
|
@@ -169,13 +187,12 @@ test_up()
|
|
|
169
187
|
// groupPermissions: { read: true, write: true, exec: false },
|
|
170
188
|
// otherPermissions: { read: true, write: true, exec: false }
|
|
171
189
|
// } 73
|
|
190
|
+
// ftp.isFile false
|
|
191
|
+
// ftp.isFolder false
|
|
172
192
|
// ftp.upload p DECL_20210805055044.csv 75.71339448693362
|
|
173
|
-
// drain
|
|
174
193
|
// ftp.upload p DECL_20210805055044.csv 100
|
|
175
194
|
// ftp.upload ok
|
|
176
195
|
// ftp.syncToRemote { num: 0, files: [] }
|
|
177
196
|
// ftp.quit { code: 221, text: '221 Goodbye.', isMark: false, isError: false }
|
|
178
197
|
|
|
179
|
-
//node --experimental-modules --es-module-specifier-resolution=node g-upload.mjs
|
|
180
|
-
|
|
181
198
|
```
|
package/dist/w-ftp.umd.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* w-ftp v1.0.
|
|
2
|
+
* w-ftp v1.0.4
|
|
3
3
|
* (c) 2018-2021 yuda-lyu(semisphere)
|
|
4
4
|
* Released under the MIT License.
|
|
5
5
|
*/
|
|
6
|
-
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("path"),require("fs"),require("net"),require("events"),require("util"),require("stream"),require("stream-combiner"),require("ftp-response-parser"),require("parse-listing"),require("once"),require("unorm"),require("debug")):"function"==typeof define&&define.amd?define(["path","fs","net","events","util","stream","stream-combiner","ftp-response-parser","parse-listing","once","unorm","debug"],e):(t="undefined"!=typeof globalThis?globalThis:t||self)["w-ftp"]=e(t.path,t.fs,t.net,t.events,t.util,t.stream,t["stream-combiner"],t["ftp-response-parser"],t["parse-listing"],t.once,t.unorm,t.debug)}(this,(function(t,e,r,n,o,i,a,u,c,s,f,l){"use strict";function p(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var h=p(t),v=p(e),d=p(r),y=p(n),b=p(o),g=p(i),m=p(a),_=p(u),j=p(c),w=p(s),k=p(f),S=p(l),O=Array.isArray,x="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function P(t){var e={exports:{}};return t(e,e.exports),e.exports}var z="object"==typeof x&&x&&x.Object===Object&&x,A="object"==typeof self&&self&&self.Object===Object&&self,F=z||A||Function("return this")(),E=F.Symbol,T=Object.prototype,R=T.hasOwnProperty,C=T.toString,L=E?E.toStringTag:void 0;var I=function(t){var e=R.call(t,L),r=t[L];try{t[L]=void 0;var n=!0}catch(t){}var o=C.call(t);return n&&(e?t[L]=r:delete t[L]),o},M=Object.prototype.toString;var q=function(t){return M.call(t)},N=E?E.toStringTag:void 0;var $=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":N&&N in Object(t)?I(t):q(t)};var U=function(t){return null!=t&&"object"==typeof t};var B=function(t){return"symbol"==typeof t||U(t)&&"[object Symbol]"==$(t)},D=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,Q=/^\w*$/;var V=function(t,e){if(O(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!B(t))||(Q.test(t)||!D.test(t)||null!=e&&t in Object(e))};var W=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)};var G,H=function(t){if(!W(t))return!1;var e=$(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},J=F["__core-js_shared__"],K=(G=/[^.]+$/.exec(J&&J.keys&&J.keys.IE_PROTO||""))?"Symbol(src)_1."+G:"";var X=function(t){return!!K&&K in t},Y=Function.prototype.toString;var Z=function(t){if(null!=t){try{return Y.call(t)}catch(t){}try{return t+""}catch(t){}}return""},tt=/^\[object .+?Constructor\]$/,et=Function.prototype,rt=Object.prototype,nt=et.toString,ot=rt.hasOwnProperty,it=RegExp("^"+nt.call(ot).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var at=function(t){return!(!W(t)||X(t))&&(H(t)?it:tt).test(Z(t))};var ut=function(t,e){return null==t?void 0:t[e]};var ct=function(t,e){var r=ut(t,e);return at(r)?r:void 0},st=ct(Object,"create");var ft=function(){this.__data__=st?st(null):{},this.size=0};var lt=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},pt=Object.prototype.hasOwnProperty;var ht=function(t){var e=this.__data__;if(st){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return pt.call(e,t)?e[t]:void 0},vt=Object.prototype.hasOwnProperty;var dt=function(t){var e=this.__data__;return st?void 0!==e[t]:vt.call(e,t)};var yt=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=st&&void 0===e?"__lodash_hash_undefined__":e,this};function bt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}bt.prototype.clear=ft,bt.prototype.delete=lt,bt.prototype.get=ht,bt.prototype.has=dt,bt.prototype.set=yt;var gt=bt;var mt=function(){this.__data__=[],this.size=0};var _t=function(t,e){return t===e||t!=t&&e!=e};var jt=function(t,e){for(var r=t.length;r--;)if(_t(t[r][0],e))return r;return-1},wt=Array.prototype.splice;var kt=function(t){var e=this.__data__,r=jt(e,t);return!(r<0)&&(r==e.length-1?e.pop():wt.call(e,r,1),--this.size,!0)};var St=function(t){var e=this.__data__,r=jt(e,t);return r<0?void 0:e[r][1]};var Ot=function(t){return jt(this.__data__,t)>-1};var xt=function(t,e){var r=this.__data__,n=jt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function Pt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Pt.prototype.clear=mt,Pt.prototype.delete=kt,Pt.prototype.get=St,Pt.prototype.has=Ot,Pt.prototype.set=xt;var zt=Pt,At=ct(F,"Map");var Ft=function(){this.size=0,this.__data__={hash:new gt,map:new(At||zt),string:new gt}};var Et=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var Tt=function(t,e){var r=t.__data__;return Et(e)?r["string"==typeof e?"string":"hash"]:r.map};var Rt=function(t){var e=Tt(this,t).delete(t);return this.size-=e?1:0,e};var Ct=function(t){return Tt(this,t).get(t)};var Lt=function(t){return Tt(this,t).has(t)};var It=function(t,e){var r=Tt(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function Mt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Mt.prototype.clear=Ft,Mt.prototype.delete=Rt,Mt.prototype.get=Ct,Mt.prototype.has=Lt,Mt.prototype.set=It;var qt=Mt;function Nt(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,o=e?e.apply(this,n):n[0],i=r.cache;if(i.has(o))return i.get(o);var a=t.apply(this,n);return r.cache=i.set(o,a)||i,a};return r.cache=new(Nt.Cache||qt),r}Nt.Cache=qt;var $t=Nt;var Ut=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Bt=/\\(\\)?/g,Dt=function(t){var e=$t(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(Ut,(function(t,r,n,o){e.push(n?o.replace(Bt,"$1"):r||t)})),e}));var Qt=function(t,e){for(var r=-1,n=null==t?0:t.length,o=Array(n);++r<n;)o[r]=e(t[r],r,t);return o},Vt=E?E.prototype:void 0,Wt=Vt?Vt.toString:void 0;var Gt=function t(e){if("string"==typeof e)return e;if(O(e))return Qt(e,t)+"";if(B(e))return Wt?Wt.call(e):"";var r=e+"";return"0"==r&&1/e==-Infinity?"-0":r};var Ht=function(t){return null==t?"":Gt(t)};var Jt=function(t,e){return O(t)?t:V(t,e)?[t]:Dt(Ht(t))};var Kt=function(t){if("string"==typeof t||B(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e};var Xt=function(t,e){for(var r=0,n=(e=Jt(e,t)).length;null!=t&&r<n;)t=t[Kt(e[r++])];return r&&r==n?t:void 0};var Yt=function(t,e,r){var n=null==t?void 0:Xt(t,e);return void 0===n?r:n},Zt=Object.prototype;var te=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Zt)};var ee=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),re=Object.prototype.hasOwnProperty;var ne=function(t){if(!te(t))return ee(t);var e=[];for(var r in Object(t))re.call(t,r)&&"constructor"!=r&&e.push(r);return e},oe=ct(F,"DataView"),ie=ct(F,"Promise"),ae=ct(F,"Set"),ue=ct(F,"WeakMap"),ce="[object Map]",se="[object Promise]",fe="[object Set]",le="[object WeakMap]",pe="[object DataView]",he=Z(oe),ve=Z(At),de=Z(ie),ye=Z(ae),be=Z(ue),ge=$;(oe&&ge(new oe(new ArrayBuffer(1)))!=pe||At&&ge(new At)!=ce||ie&&ge(ie.resolve())!=se||ae&&ge(new ae)!=fe||ue&&ge(new ue)!=le)&&(ge=function(t){var e=$(t),r="[object Object]"==e?t.constructor:void 0,n=r?Z(r):"";if(n)switch(n){case he:return pe;case ve:return ce;case de:return se;case ye:return fe;case be:return le}return e});var me=ge;var _e=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991};var je=function(t){return null!=t&&_e(t.length)&&!H(t)};var we=function(t){return"string"==typeof t||!O(t)&&U(t)&&"[object String]"==$(t)};var ke=function(t){return function(e){return null==e?void 0:e[t]}},Se=ke("length"),Oe=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var xe=function(t){return Oe.test(t)},Pe="[\\ud800-\\udfff]",ze="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Ae="\\ud83c[\\udffb-\\udfff]",Fe="[^\\ud800-\\udfff]",Ee="(?:\\ud83c[\\udde6-\\uddff]){2}",Te="[\\ud800-\\udbff][\\udc00-\\udfff]",Re="(?:"+ze+"|"+Ae+")"+"?",Ce="[\\ufe0e\\ufe0f]?",Le=Ce+Re+("(?:\\u200d(?:"+[Fe,Ee,Te].join("|")+")"+Ce+Re+")*"),Ie="(?:"+[Fe+ze+"?",ze,Ee,Te,Pe].join("|")+")",Me=RegExp(Ae+"(?="+Ae+")|"+Ie+Le,"g");var qe=function(t){for(var e=Me.lastIndex=0;Me.test(t);)++e;return e};var Ne=function(t){return xe(t)?qe(t):Se(t)};var $e=function(t){if(null==t)return 0;if(je(t))return we(t)?Ne(t):t.length;var e=me(t);return"[object Map]"==e||"[object Set]"==e?t.size:ne(t).length};var Ue=function(t,e){for(var r=-1,n=null==t?0:t.length,o=0,i=[];++r<n;){var a=t[r];e(a,r,t)&&(i[o++]=a)}return i};var Be=function(t){return function(e,r,n){for(var o=-1,i=Object(e),a=n(e),u=a.length;u--;){var c=a[t?u:++o];if(!1===r(i[c],c,i))break}return e}}();var De=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n};var Qe=function(t){return U(t)&&"[object Arguments]"==$(t)},Ve=Object.prototype,We=Ve.hasOwnProperty,Ge=Ve.propertyIsEnumerable,He=Qe(function(){return arguments}())?Qe:function(t){return U(t)&&We.call(t,"callee")&&!Ge.call(t,"callee")},Je=He;var Ke=function(){return!1},Xe=P((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,o=n&&n.exports===r?F.Buffer:void 0,i=(o?o.isBuffer:void 0)||Ke;t.exports=i})),Ye=/^(?:0|[1-9]\d*)$/;var Ze=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&Ye.test(t))&&t>-1&&t%1==0&&t<e},tr={};tr["[object Float32Array]"]=tr["[object Float64Array]"]=tr["[object Int8Array]"]=tr["[object Int16Array]"]=tr["[object Int32Array]"]=tr["[object Uint8Array]"]=tr["[object Uint8ClampedArray]"]=tr["[object Uint16Array]"]=tr["[object Uint32Array]"]=!0,tr["[object Arguments]"]=tr["[object Array]"]=tr["[object ArrayBuffer]"]=tr["[object Boolean]"]=tr["[object DataView]"]=tr["[object Date]"]=tr["[object Error]"]=tr["[object Function]"]=tr["[object Map]"]=tr["[object Number]"]=tr["[object Object]"]=tr["[object RegExp]"]=tr["[object Set]"]=tr["[object String]"]=tr["[object WeakMap]"]=!1;var er=function(t){return U(t)&&_e(t.length)&&!!tr[$(t)]};var rr=function(t){return function(e){return t(e)}},nr=P((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,o=n&&n.exports===r&&z.process,i=function(){try{var t=n&&n.require&&n.require("util").types;return t||o&&o.binding&&o.binding("util")}catch(t){}}();t.exports=i})),or=nr&&nr.isTypedArray,ir=or?rr(or):er,ar=Object.prototype.hasOwnProperty;var ur=function(t,e){var r=O(t),n=!r&&Je(t),o=!r&&!n&&Xe(t),i=!r&&!n&&!o&&ir(t),a=r||n||o||i,u=a?De(t.length,String):[],c=u.length;for(var s in t)!e&&!ar.call(t,s)||a&&("length"==s||o&&("offset"==s||"parent"==s)||i&&("buffer"==s||"byteLength"==s||"byteOffset"==s)||Ze(s,c))||u.push(s);return u};var cr=function(t){return je(t)?ur(t):ne(t)};var sr=function(t,e){return function(r,n){if(null==r)return r;if(!je(r))return t(r,n);for(var o=r.length,i=e?o:-1,a=Object(r);(e?i--:++i<o)&&!1!==n(a[i],i,a););return r}}((function(t,e){return t&&Be(t,e,cr)}));var fr=function(t,e){var r=[];return sr(t,(function(t,n,o){e(t,n,o)&&r.push(t)})),r};var lr=function(){this.__data__=new zt,this.size=0};var pr=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r};var hr=function(t){return this.__data__.get(t)};var vr=function(t){return this.__data__.has(t)};var dr=function(t,e){var r=this.__data__;if(r instanceof zt){var n=r.__data__;if(!At||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new qt(n)}return r.set(t,e),this.size=r.size,this};function yr(t){var e=this.__data__=new zt(t);this.size=e.size}yr.prototype.clear=lr,yr.prototype.delete=pr,yr.prototype.get=hr,yr.prototype.has=vr,yr.prototype.set=dr;var br=yr;var gr=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this};var mr=function(t){return this.__data__.has(t)};function _r(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new qt;++e<r;)this.add(t[e])}_r.prototype.add=_r.prototype.push=gr,_r.prototype.has=mr;var jr=_r;var wr=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1};var kr=function(t,e){return t.has(e)};var Sr=function(t,e,r,n,o,i){var a=1&r,u=t.length,c=e.length;if(u!=c&&!(a&&c>u))return!1;var s=i.get(t),f=i.get(e);if(s&&f)return s==e&&f==t;var l=-1,p=!0,h=2&r?new jr:void 0;for(i.set(t,e),i.set(e,t);++l<u;){var v=t[l],d=e[l];if(n)var y=a?n(d,v,l,e,t,i):n(v,d,l,t,e,i);if(void 0!==y){if(y)continue;p=!1;break}if(h){if(!wr(e,(function(t,e){if(!kr(h,e)&&(v===t||o(v,t,r,n,i)))return h.push(e)}))){p=!1;break}}else if(v!==d&&!o(v,d,r,n,i)){p=!1;break}}return i.delete(t),i.delete(e),p},Or=F.Uint8Array;var xr=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r};var Pr=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r},zr=E?E.prototype:void 0,Ar=zr?zr.valueOf:void 0;var Fr=function(t,e,r,n,o,i,a){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!i(new Or(t),new Or(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return _t(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var u=xr;case"[object Set]":var c=1&n;if(u||(u=Pr),t.size!=e.size&&!c)return!1;var s=a.get(t);if(s)return s==e;n|=2,a.set(t,e);var f=Sr(u(t),u(e),n,o,i,a);return a.delete(t),f;case"[object Symbol]":if(Ar)return Ar.call(t)==Ar.call(e)}return!1};var Er=function(t,e){for(var r=-1,n=e.length,o=t.length;++r<n;)t[o+r]=e[r];return t};var Tr=function(t,e,r){var n=e(t);return O(t)?n:Er(n,r(t))};var Rr=function(){return[]},Cr=Object.prototype.propertyIsEnumerable,Lr=Object.getOwnPropertySymbols,Ir=Lr?function(t){return null==t?[]:(t=Object(t),Ue(Lr(t),(function(e){return Cr.call(t,e)})))}:Rr;var Mr=function(t){return Tr(t,cr,Ir)},qr=Object.prototype.hasOwnProperty;var Nr=function(t,e,r,n,o,i){var a=1&r,u=Mr(t),c=u.length;if(c!=Mr(e).length&&!a)return!1;for(var s=c;s--;){var f=u[s];if(!(a?f in e:qr.call(e,f)))return!1}var l=i.get(t),p=i.get(e);if(l&&p)return l==e&&p==t;var h=!0;i.set(t,e),i.set(e,t);for(var v=a;++s<c;){var d=t[f=u[s]],y=e[f];if(n)var b=a?n(y,d,f,e,t,i):n(d,y,f,t,e,i);if(!(void 0===b?d===y||o(d,y,r,n,i):b)){h=!1;break}v||(v="constructor"==f)}if(h&&!v){var g=t.constructor,m=e.constructor;g==m||!("constructor"in t)||!("constructor"in e)||"function"==typeof g&&g instanceof g&&"function"==typeof m&&m instanceof m||(h=!1)}return i.delete(t),i.delete(e),h},$r="[object Arguments]",Ur="[object Array]",Br="[object Object]",Dr=Object.prototype.hasOwnProperty;var Qr=function(t,e,r,n,o,i){var a=O(t),u=O(e),c=a?Ur:me(t),s=u?Ur:me(e),f=(c=c==$r?Br:c)==Br,l=(s=s==$r?Br:s)==Br,p=c==s;if(p&&Xe(t)){if(!Xe(e))return!1;a=!0,f=!1}if(p&&!f)return i||(i=new br),a||ir(t)?Sr(t,e,r,n,o,i):Fr(t,e,c,r,n,o,i);if(!(1&r)){var h=f&&Dr.call(t,"__wrapped__"),v=l&&Dr.call(e,"__wrapped__");if(h||v){var d=h?t.value():t,y=v?e.value():e;return i||(i=new br),o(d,y,r,n,i)}}return!!p&&(i||(i=new br),Nr(t,e,r,n,o,i))};var Vr=function t(e,r,n,o,i){return e===r||(null==e||null==r||!U(e)&&!U(r)?e!=e&&r!=r:Qr(e,r,n,o,t,i))};var Wr=function(t,e,r,n){var o=r.length,i=o,a=!n;if(null==t)return!i;for(t=Object(t);o--;){var u=r[o];if(a&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++o<i;){var c=(u=r[o])[0],s=t[c],f=u[1];if(a&&u[2]){if(void 0===s&&!(c in t))return!1}else{var l=new br;if(n)var p=n(s,f,c,t,e,l);if(!(void 0===p?Vr(f,s,3,n,l):p))return!1}}return!0};var Gr=function(t){return t==t&&!W(t)};var Hr=function(t){for(var e=cr(t),r=e.length;r--;){var n=e[r],o=t[n];e[r]=[n,o,Gr(o)]}return e};var Jr=function(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}};var Kr=function(t){var e=Hr(t);return 1==e.length&&e[0][2]?Jr(e[0][0],e[0][1]):function(r){return r===t||Wr(r,t,e)}};var Xr=function(t,e){return null!=t&&e in Object(t)};var Yr=function(t,e,r){for(var n=-1,o=(e=Jt(e,t)).length,i=!1;++n<o;){var a=Kt(e[n]);if(!(i=null!=t&&r(t,a)))break;t=t[a]}return i||++n!=o?i:!!(o=null==t?0:t.length)&&_e(o)&&Ze(a,o)&&(O(t)||Je(t))};var Zr=function(t,e){return null!=t&&Yr(t,e,Xr)};var tn=function(t,e){return V(t)&&Gr(e)?Jr(Kt(t),e):function(r){var n=Yt(r,t);return void 0===n&&n===e?Zr(r,t):Vr(e,n,3)}};var en=function(t){return t};var rn=function(t){return function(e){return Xt(e,t)}};var nn=function(t){return V(t)?ke(Kt(t)):rn(t)};var on=function(t){return"function"==typeof t?t:null==t?en:"object"==typeof t?O(t)?tn(t[0],t[1]):Kr(t):nn(t)};var an=function(t,e){return(O(t)?Ue:fr)(t,on(e))};var un=function(t){return function(e,r,n){var o=Object(e);if(!je(e)){var i=on(r);e=cr(e),r=function(t){return i(o[t],t,o)}}var a=t(e,r,n);return a>-1?o[i?e[a]:a]:void 0}};var cn=function(t,e,r,n){for(var o=t.length,i=r+(n?1:-1);n?i--:++i<o;)if(e(t[i],i,t))return i;return-1},sn=/\s/;var fn=function(t){for(var e=t.length;e--&&sn.test(t.charAt(e)););return e},ln=/^\s+/;var pn=function(t){return t?t.slice(0,fn(t)+1).replace(ln,""):t},hn=/^[-+]0x[0-9a-f]+$/i,vn=/^0b[01]+$/i,dn=/^0o[0-7]+$/i,yn=parseInt;var bn=function(t){if("number"==typeof t)return t;if(B(t))return NaN;if(W(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=W(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=pn(t);var r=vn.test(t);return r||dn.test(t)?yn(t.slice(2),r?2:8):hn.test(t)?NaN:+t},gn=1/0;var mn=function(t){return t?(t=bn(t))===gn||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0};var _n=function(t){var e=mn(t),r=e%1;return e==e?r?e-r:e:0},jn=Math.max;var wn=un((function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var o=null==r?0:_n(r);return o<0&&(o=jn(n+o,0)),cn(t,on(e),o)}));var kn=function(t,e){var r=-1,n=je(t)?Array(t.length):[];return sr(t,(function(t,o,i){n[++r]=e(t,o,i)})),n};var Sn=function(t,e){return(O(t)?Qt:kn)(t,on(e))};function On(){let t,e,r=new Promise((function(){t=arguments[0],e=arguments[1]}));return r.resolve=t,r.reject=e,r}var xn=F.isFinite,Pn=Math.min;var zn=function(t){var e=Math[t];return function(t,r){if(t=bn(t),(r=null==r?0:Pn(_n(r),292))&&xn(t)){var n=(Ht(t)+"e").split("e"),o=e(n[0]+"e"+(+n[1]+r));return+((n=(Ht(o)+"e").split("e"))[0]+"e"+(+n[1]-r))}return e(t)}}("round");function An(t){return!(!function(t){return"[object String]"===Object.prototype.toString.call(t)}(t)||""===t)}function Fn(t){let e=!1;return An(t)?e=!isNaN(Number(t)):function(t){return"[object Number]"===Object.prototype.toString.call(t)}(t)&&(e=!0),e}function En(t){if(!Fn(t))return 0;return mn(t)}function Tn(t){if(!Fn(t))return 0;t=En(t);let e=zn(t);return"0"===String(e)?0:e}function Rn(t){if(!An(t)&&!Fn(t)&&!B(t))return"";let e="";try{e=String(t)}catch(t){}try{e=t.toString()}catch(t){}return e}var Cn=function(t){return"number"==typeof t&&t==_n(t)};function Ln(t){return!!Fn(t)&&(t=En(t),Cn(t))}function In(t){if(!Ln(t))return!1;return Tn(t)>0}function Mn(t){return"[object Object]"===Object.prototype.toString.call(t)}function qn(t){if(Mn(t)){for(let e in t)return!0;return!1}return!1}function Nn(t){let e=Object.prototype.toString.call(t);return"[object Function]"===e||"[object AsyncFunction]"===e}function $n(t){if(!Ln(t))return!1;return Tn(t)>=0}function Un(t,e){return An(t)&&$n(e)?0===(e=Tn(e))?"":t.substring(0,e):""}var Bn=function(t,e,r){var n=-1,o=t.length;e<0&&(e=-e>o?0:o+e),(r=r>o?o:r)<0&&(r+=o),o=e>r?0:r-e>>>0,e>>>=0;for(var i=Array(o);++n<o;)i[n]=t[n+e];return i};var Dn=function(t,e,r){var n=null==t?0:t.length;return n?(e=r||void 0===e?1:_n(e),Bn(t,e<0?0:e,n)):[]};var Qn=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t};var Vn=function(t){return"function"==typeof t?t:en};var Wn=function(t,e){return(O(t)?Qn:sr)(t,Vn(e))};function Gn(t,e){let r=On();if(n=t,"[object Array]"!==Object.prototype.toString.call(n)&&!Mn(t))return r.reject("rs is not array or object"),r;var n;let o=!1;if(Mn(t)){o=!0;let e=[];Wn(t,((t,r)=>{e.push({k:r,v:t})})),t=e}Nn(e)||(e=function(t){return t});let i=-1,a=[];return t.reduce((function(t,r){return t.then((function(t){a.push(t),i+=1;let n=i,u=r;return o&&(n=r.k,u=r.v),Nn(e)?e(u,n):u}))}),Promise.resolve()).then((function(t){a.push(t),a=Dn(a),r.resolve(a)})).catch((function(t){r.reject(t)})),r}function Hn(t,e){if(!An(t))return"";if(!$n(e))return"";if(0===(e=Tn(e)))return"";let r=t.length-e;return r<0&&(r=0),t.substr(r,e)}function Jn(t,e){return An(t)&&$n(e)?0===(e=Tn(e))?t:Un(t,t.length-e):""}function Kn(t){if(!An(t))return"";let e=function(t){if(!An(t))return{path:"",isRoot:!1};for(;t.indexOf("\\\\")>=0;)t=t.replace("\\\\","\\");for(;t.indexOf("//")>=0;)t=t.replace("//","/");if(":"===Hn(t,1))return{path:"".concat(t,"\\"),isRoot:!0};if("\\"===Hn(t,1)){let e=Jn(t,1);return":"===Hn(e,1)?{path:t,isRoot:!0}:{path:e,isRoot:!1}}if("/"===Hn(t,1)){let e=Jn(t,1);return 0===$e(e)?{path:t,isRoot:!0}:{path:e,isRoot:!1}}return{path:t,isRoot:!1}}(t);if(e.isRoot)return e.path;let r=e.path;try{r=r.split("\\").pop().split("/").pop()}catch(t){}return r}function Xn(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=1;function n(t){let o=[],i=v.default.readdirSync(t);return Wn(i,(function(i){let a=h.default.resolve(t,i),u=null;try{u=v.default.statSync(a)}catch(t){}u&&u.isDirectory()?(o.push({isFolder:!0,level:r,path:a,name:h.default.basename(a)}),r+=1,(r<=e||null===e)&&(o=o.concat(n(a))),r-=1):o.push({isFolder:!1,level:r,path:a,name:h.default.basename(a)})})),o}return n(t)}function Yn(t){return!!v.default.existsSync(t)&&(!v.default.lstatSync(t).isFile()&&!v.default.lstatSync(t).isSymbolicLink())}function Zn(t){return!!v.default.existsSync(t)&&(!v.default.lstatSync(t).isDirectory()&&!v.default.lstatSync(t).isSymbolicLink())}function to(t){if(Yn(t))return{success:"input folder is already exists: "+t};if(v.default.existsSync(t))return{error:"input path already exists: "+t};try{v.default.mkdirSync(t,{recursive:!0})}catch(t){return{error:t}}return{success:"done: "+t}}const eo=d.default.createConnection,ro=y.default.EventEmitter,no=b.default.inherits,oo=k.default.nfc,io=S.default("jsftp:general"),ao=S.default("jsftp:command"),uo=S.default("jsftp:response"),co=6e5,so=function(){},fo={marks:[125,150],ignore:226},lo=/([-\d]+,[-\d]+,[-\d]+,[-\d]+),([-\d]+),([-\d]+)/,po=/\r\n|\n/;function ho(t){let e=so,r=t+" ";for(var n=arguments.length,o=new Array(n>1?n-1:0),i=1;i<n;i++)o[i-1]=arguments[i];"function"==typeof o[o.length-1]&&(e=o.pop()),r+=o.join(" "),this.execute(r.trim(),e)}function vo(t){this.host=t.host||"localhost",this.port=t.port||21,this.user=t.user||"anonymous",this.pass=t.pass||"@anonymous",this.createSocket=t.createSocket,this.useList=t.useList||!1,this.commandQueue=[],ro.call(this),this.on("data",uo),this.on("error",uo),this._createSocket(this.port,this.host)}no(vo,ro),vo.prototype.raw=function(){ho.apply(this,arguments)},vo.prototype.reemit=function(t){return e=>{this.emit(t,e),io("event:".concat(t),e||{})}},vo.prototype._createSocket=function(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:so;this.socket&&this.socket.destroy&&this.socket.destroy(),this.resParser&&this.resParser.end(),this.resParser=new _.default,this.authenticated=!1,this.socket=this.createSocket?this.createSocket({port:t,host:e},r):eo(t,e,r),this.socket.on("connect",this.reemit("connect")),this.socket.on("timeout",this.reemit("timeout")),this.pipeline=m.default(this.socket,this.resParser),this.pipeline.on("data",(t=>{this.emit("data",t),uo(t.text),this.parseResponse(t)})),this.pipeline.on("error",this.reemit("error"))},vo.prototype.parseResponse=function(t){if(0===this.commandQueue.length)return;if([220].indexOf(t.code)>-1)return;const e=this.commandQueue[0].callback;if(t.isMark){if(!e.expectsMark||-1===e.expectsMark.marks.indexOf(t.code))return;e.expectsMark.ignore&&(this.ignoreCmdCode=e.expectsMark.ignore)}this.ignoreCmdCode!==t.code?this.parse(t,this.commandQueue.shift()):this.ignoreCmdCode=null},vo.prototype.send=function(t){t&&(ao(t),this.pipeline.write(t+"\r\n"),ao(t))},vo.prototype.nextCmd=function(){const t=this.commandQueue[0];!this.inProgress&&t&&(this.send(t.action),this.inProgress=!0)},vo.prototype.execute=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:so;if(this.socket&&this.socket.writable)return this.runCommand({action:t,callback:e});this.authenticated=!1,this._createSocket(this.port,this.host,(()=>{this.runCommand({action:t,callback:e})}))},vo.prototype.runCommand=function(t){if(this.authenticated||/^(feat|syst|user|pass)/.test(t.action))return this.commandQueue.push(t),void this.nextCmd();this.getFeatures((()=>{this.auth(this.user,this.pass,(()=>{this.commandQueue.push(t),this.nextCmd()}))}))},vo.prototype.parse=function(t,e){let r=null;t.isError&&(r=new Error(t.text||"Unknown FTP error."),r.code=t.code),this.inProgress=!1,e.callback(r,t),this.nextCmd()},vo.prototype.getPasvPort=function(t){const e=lo.exec(t);if(!e)return null;let r=e[1].replace(/,/g,".");return"127.0.0.1"===r&&(r=this.host),{host:r,port:256*(255&parseInt(e[2],10))+(255&parseInt(e[3],10))}},vo.prototype.hasFeat=function(t){return!!t&&this.features.indexOf(t.toLowerCase())>-1},vo.prototype._parseFeats=function(t){return t.split(po).slice(1,-1).map((t=>t.trim().toLowerCase())).filter((t=>!!t))},vo.prototype.getFeatures=function(t){if(this.features)return t(null,this.features);this.raw("feat",((e,r)=>{this.features=e?[]:this._parseFeats(r.text),this.raw("syst",((e,r)=>{e||215!==r.code||(this.system=r.text.toLowerCase()),t(null,this.features)}))}))},vo.prototype.auth=function(t,e,r){if(!0===this.authenticating)return r(new Error("This client is already authenticating"));"string"!=typeof t&&(t=this.user),"string"!=typeof e&&(e=this.pass),this.authenticating=!0,this.raw("user",t,((n,o)=>{if(n||-1===[230,331,332].indexOf(o.code))return this.authenticating=!1,void r(n);this.raw("pass",e,((n,o)=>{this.authenticating=!1,n?r(n):[230,202].indexOf(o.code)>-1?(this.authenticated=!0,this.user=t,this.pass=e,this.raw("type","I",(()=>{r(void 0,o)}))):332===o.code&&this.raw("acct","")}))}))},vo.prototype.setType=function(t,e){if(t=t.toUpperCase(),this.type===t)return e();this.raw("type",t,((r,n)=>{r||(this.type=t),e(r,n)}))},vo.prototype.list=function(t,e){1===arguments.length&&(e=arguments[0],t="");let r="";e=w.default(e),this.getPasvSocket(((n,o)=>{if(n)return e(n);function i(t,r){if(t)return e(t);fo.marks.some((t=>t===r.code))||e(new Error("Expected marks ".concat(fo.toString()," instead of: ").concat(r.text)))}o.setEncoding("utf8"),o.on("data",(t=>{r+=t})),this.pasvTimeout(o,e),o.once("close",(n=>n?e(n):r?void e(null,r):e({code:451,text:"Could not retrieve a file listing for ".concat(t,"."),isMark:!1,isError:!0}))),o.once("error",e),i.expectsMark=fo,this.execute("list ".concat(t||""),i)}))},vo.prototype.emitProgress=function(t){this.emit("progress",{filename:t.filename,action:t.action,total:t.totalSize||0,transferred:t.socket["get"===t.action?"bytesRead":"bytesWritten"]})},vo.prototype.get=function(t,e){let r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:so;const o=typeof e;"function"===o?r=e:"string"===o&&(n=w.default(n),r=(r,o)=>{if(r)return n(r);const i=v.default.createWriteStream(e);i.on("error",n),o.on("readable",(()=>{this.emitProgress({filename:t,action:"get",socket:o})})),o.on("error",n),o.on("end",n),o.on("close",n),o.pipe(i)}),this.getGetSocket(t,w.default(r))},vo.prototype.getGetSocket=function(t,e){e=w.default(e),this.getPasvSocket(((r,n)=>{if(r)return o(r);function o(t,r){return t?(n&&n.destroy(),e(t)):n?125===r.code||150===r.code?e(null,n):(n.destroy(),e(new Error("Unexpected command "+r.text))):e(new Error("Error when retrieving PASV socket"))}n.on("error",(t=>{"ECONNREFUSED"===t.code&&(t.msg="Probably trying a PASV operation while one is in progress"),o(t)})),this.pasvTimeout(n,o),n.pause(),o.expectsMark=fo,this.execute("retr "+t,o)}))},vo.prototype.put=function(t,e,r){const n=(t,e,n)=>{t.on("readable",(()=>{this.emitProgress({filename:e,action:"put",socket:t,totalSize:n})})),this.getPutSocket(t,e,r)};t instanceof Buffer?this.getPutSocket(t,e,((e,n)=>{if(e)return r(new Error(e));let o,i=0,a=1048576,u=!1;o=t.slice(i,i+a),i+=a,r(null,o),n.write(t.slice(0,a)),o.length===t.length&&(n.end(),r(null,[])),n.on("drain",(()=>{console.log("drain"),t.length>i+a?(o=t.slice(i,i+a),i+=a):(o=t.slice(i),u=!0),r(null,o),n.write(o),u&&(n.end(),r(null,[]))}))})):"string"==typeof t?v.default.stat(t,((o,i)=>{if(o&&"ENOENT"===o.code)return r(new Error("Local file doesn't exist."));if(i.isDirectory())return r(new Error("Local path cannot be a directory"));const a=o?0:i.size;n(v.default.createReadStream(t),e,a)})):t instanceof g.default.Readable?n(t,e,0):r(new Error("Expected `from` parameter to be a Buffer, Stream, or a String"))},vo.prototype.getPutSocket=function(t,e,r){r=w.default(r||so),this.getPasvSocket(((n,o)=>{if(n)return o&&o.destroy(),r(n);o.on("close",r),o.on("error",r);const i=w.default(((e,n)=>e?(o&&o.destroy(),r(e)):125!==n.code&&150!==n.code?(o&&o.destroy(),r(new Error("Unexpected command "+n.text))):(this.pasvTimeout(o,r),void(t instanceof Buffer?r(null,o):t instanceof g.default.Readable&&(r(null,o),t.pipe(o))))));i.expectsMark=fo,this.execute("stor ".concat(e),i)}))},vo.prototype.pasvTimeout=function(t,e){t.once("timeout",(()=>{io("PASV socket timeout"),this.emit("timeout"),t.end(),e(new Error("Passive socket timeout"))}))},vo.prototype.getPasvSocket=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:so;t=w.default(t),this.execute("pasv",((e,r)=>{if(e)return t(e);const n=this.getPasvPort(r.text);if(!n)return t(new Error("Bad passive host/port combination"));const o=this._pasvSocket=this.createSocket?this.createSocket(n):eo(n);o.setTimeout(this.timeout||co),o.once("close",(()=>{this._pasvSocket=void 0})),t(null,o)}))},vo.prototype.ls=function(t,e){function r(t,r){if(t)return e(t);j.default.parseFtpEntries(r.text||r,((t,r)=>{if(t)return e(t);r.forEach((t=>{t.name=oo(t.name)})),e(null,r)}))}this.useList?this.list(t,r):this.raw("stat",t,((e,n)=>{const o=e&&(502===e.code||500===e.code),i=this.system&&this.system.indexOf("hummingbird")>-1;o||i?(this.useList=!0,this.list(t,r)):r(e,n)}))},vo.prototype.rename=function(t,e,r){this.raw("rnfr",t,(t=>{if(t)return r(t);this.raw("rnto",e,r)}))},vo.prototype.keepAlive=function(t){this._keepAliveInterval&&clearInterval(this._keepAliveInterval),this._keepAliveInterval=setInterval(this.raw.bind(this,"noop"),t||3e4)},vo.prototype.destroy=function(){this._keepAliveInterval&&clearInterval(this._keepAliveInterval),this.socket&&this.socket.writable&&this.socket.end(),this._pasvSocket&&this._pasvSocket.writable&&this._pasvSocket.end(),this.resParser.end(),this.socket=void 0,this._pasvSocket=void 0,this.features=null,this.authenticated=!1};var yo=vo;async function bo(){return null}async function go(){return null}async function mo(){return null}async function _o(t){return null}async function jo(t){return null}async function wo(t,e){return null}async function ko(t,e,r){return null}async function So(t,e,r){return null}async function Oo(t,e,r){return null}return function(){let t={doc_ftpConn:bo,doc_ftpLs:go,doc_ftpQuit:mo,doc_ftpStateFile:_o,doc_ftpCheckFile:jo,doc_ftpDownload:wo,doc_ftpUpload:ko,doc_ftpSyncToLocal:So,doc_ftpSyncToRemote:Oo};return new function(){let e=null;async function r(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:".",r=On();return null===e?(r.reject("FTP has not been initialized. please use 'conn' to construct FTP"),r):(e.ls(t,((t,e)=>{t?r.reject(t):r.resolve(e)})),r)}async function n(t){let e=null;return await r(t).then((t=>{e=t})).catch((()=>{e=null})),e=Yt(e,0,null),e}async function o(t,r){let o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,i=On();if(null===e)return i.reject("FTP has not been initialized. please use 'conn' to construct FTP"),i;if(!An(t))return i.reject("fpRemote[".concat(t,"] is not a effective string")),i;if(!An(r))return i.reject("fpLocal[".concat(r,"] is not a effective string")),i;let a=h.default.basename(h.default.dirname(r));Yn(a)||to(a);let u=await n(t),c=Yt(u,"size");return Fn(c)?(c=Tn(c),e.get(t,((e,n)=>{e&&i.reject(e),Zn(r)&&v.default.unlinkSync(r);let a=v.default.createWriteStream(r),u=0;n.on("data",(e=>{if(Nn(o)){let n=$e(e);u+=n,o({progress:u/c*100,name:Kn(r),fpRemote:t,fpLocal:r})}a.write(e)})),n.on("close",(t=>{t?i.reject(t):i.resolve("ok")})),n.resume()})),i):(i.reject("can not get the size of file[".concat(t,"]")),i)}async function i(t,r,n){let o=On();if(null===e)return o.reject("FTP has not been initialized. please use 'conn' to construct FTP"),o;if(!An(r))return o.reject("fpRemote[".concat(r,"] is not a effective string")),o;if(!An(t))return o.reject("fpLocal[".concat(t,"] is not a effective string")),o;if(!Zn(t))return o.reject("fpLocal[".concat(t,"] is not a file")),o;let i=v.default.statSync(t),a=Yt(i,"size");if(!Fn(a))return o.reject("can not get the size of file[".concat(t,"]")),o;a=Tn(a);let u=v.default.readFileSync(t),c=0;return e.put(u,r,((e,i)=>{if(e)o.reject(e);else if(0!==$e(i)){if(Nn(n)){let e=$e(i);c+=e,n({progress:c/a*100,name:Kn(t),fpRemote:r,fpLocal:t})}}else o.resolve("ok")})),o}return{conn:async function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=On(),o=Yt(r,"hostname");if(!An(o))return n.reject("hostname[".concat(o,"] is not a effective string")),n;let i=Yt(r,"port");if(!In(i))return n.reject("port[".concat(i,"] is not a positive integer")),n;i=Tn(i);let a=Yt(r,"username");if(!An(a))return n.reject("username[".concat(a,"] is not a effective string")),n;let u=Yt(r,"password");if(!An(u))return n.reject("password[".concat(u,"] is not a effective string")),n;try{e=new yo({host:o,port:i,user:a,pass:u}),e.__doc__=t,n.resolve("ok")}catch(t){n.reject(t)}return n},ls:r,stateFile:n,checkFile:async function(t){return qn(await n(t))},download:o,syncToLocal:async function(t,n,i){if(null===e)return Promise.reject("FTP has not been initialized. please use 'conn' to construct FTP");let a=await r(t);Yn(n)||to(n);let u=Xn(n);u=an(u,(t=>!t.isFolder)),u=Sn(u,(t=>{let e=v.default.statSync(t.path);return t.size=Rn(Yt(e,"size","")),t}));let c=0,s=[];return await Gn(a,(async e=>{let r=wn(u,{name:e.name}),a=t;"/"!==!Un(a,1)&&(a+="/"),a+=Yt(e,"name","");let f=h.default.resolve(n,Yt(e,"name","")),l=t=>{Nn(i)&&i(t)};qn(r)?e.size!==r.size&&(await o(a,f,l),c++,s.push({name:e.name,reason:"size[".concat(r.size,"] of local file != size[").concat(e.size,"] of remote file")})):(await o(a,f,l),c++,s.push({name:e.name,reason:"no local file"}))})),{num:c,files:s}},syncToRemote:async function(t,n,o){if(null===e)return Promise.reject("FTP has not been initialized. please use 'conn' to construct FTP");let a=await r(n);if(!Yn(t))return Promise.reject("fdLocal[".concat(t,"] is not a folder"));let u=Xn(t);u=an(u,(t=>!t.isFolder)),u=Sn(u,(t=>{let e=v.default.statSync(t.path);return t.size=Rn(Yt(e,"size","")),t}));let c=0,s=[];return await Gn(u,(async e=>{let r=wn(a,{name:e.name}),u=n;"/"!==!Un(u,1)&&(u+="/"),u+=Yt(e,"name","");let f=h.default.resolve(t,Yt(e,"name","")),l=t=>{Nn(o)&&o(t)};qn(r)?e.size!==r.size&&(await i(f,u,l),c++,s.push({name:e.name,reason:"size[".concat(r.size,"] of remote file != size[").concat(e.size,"] of local file")})):(await i(f,u,l),c++,s.push({name:e.name,reason:"no Remote file"}))})),{num:c,files:s}},upload:i,quit:async function(){let t=On();return null===e?(t.reject("FTP has not been initialized. please use 'conn' to construct FTP"),t):(e.raw("quit",((e,r)=>{e?t.reject(e):t.resolve(r)})),t)}}}}}));
|
|
6
|
+
!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e(require("path"),require("fs"),require("net"),require("events"),require("util"),require("stream"),require("stream-combiner"),require("ftp-response-parser"),require("parse-listing"),require("once"),require("unorm"),require("debug")):"function"==typeof define&&define.amd?define(["path","fs","net","events","util","stream","stream-combiner","ftp-response-parser","parse-listing","once","unorm","debug"],e):(t="undefined"!=typeof globalThis?globalThis:t||self)["w-ftp"]=e(t.path,t.fs,t.net,t.events,t.util,t.stream,t["stream-combiner"],t["ftp-response-parser"],t["parse-listing"],t.once,t.unorm,t.debug)}(this,(function(t,e,r,n,i,o,a,u,s,c,f,l){"use strict";function h(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}var p=h(t),d=h(e),v=h(r),y=h(n),g=h(i),m=h(o),b=h(a),_=h(u),j=h(s),w=h(c),S=h(f),k=h(l),$=Array.isArray,O="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function x(t){var e={exports:{}};return t(e,e.exports),e.exports}var M="object"==typeof O&&O&&O.Object===Object&&O,P="object"==typeof self&&self&&self.Object===Object&&self,z=M||P||Function("return this")(),T=z.Symbol,A=Object.prototype,F=A.hasOwnProperty,D=A.toString,E=T?T.toStringTag:void 0;var C=function(t){var e=F.call(t,E),r=t[E];try{t[E]=void 0;var n=!0}catch(t){}var i=D.call(t);return n&&(e?t[E]=r:delete t[E]),i},L=Object.prototype.toString;var R=function(t){return L.call(t)},I=T?T.toStringTag:void 0;var N=function(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":I&&I in Object(t)?C(t):R(t)};var q=function(t){return null!=t&&"object"==typeof t};var Y=function(t){return"symbol"==typeof t||q(t)&&"[object Symbol]"==N(t)},U=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,W=/^\w*$/;var H=function(t,e){if($(t))return!1;var r=typeof t;return!("number"!=r&&"symbol"!=r&&"boolean"!=r&&null!=t&&!Y(t))||(W.test(t)||!U.test(t)||null!=e&&t in Object(e))};var B=function(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)};var V,Q=function(t){if(!B(t))return!1;var e=N(t);return"[object Function]"==e||"[object GeneratorFunction]"==e||"[object AsyncFunction]"==e||"[object Proxy]"==e},Z=z["__core-js_shared__"],J=(V=/[^.]+$/.exec(Z&&Z.keys&&Z.keys.IE_PROTO||""))?"Symbol(src)_1."+V:"";var G=function(t){return!!J&&J in t},K=Function.prototype.toString;var X=function(t){if(null!=t){try{return K.call(t)}catch(t){}try{return t+""}catch(t){}}return""},tt=/^\[object .+?Constructor\]$/,et=Function.prototype,rt=Object.prototype,nt=et.toString,it=rt.hasOwnProperty,ot=RegExp("^"+nt.call(it).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$");var at=function(t){return!(!B(t)||G(t))&&(Q(t)?ot:tt).test(X(t))};var ut=function(t,e){return null==t?void 0:t[e]};var st=function(t,e){var r=ut(t,e);return at(r)?r:void 0},ct=st(Object,"create");var ft=function(){this.__data__=ct?ct(null):{},this.size=0};var lt=function(t){var e=this.has(t)&&delete this.__data__[t];return this.size-=e?1:0,e},ht=Object.prototype.hasOwnProperty;var pt=function(t){var e=this.__data__;if(ct){var r=e[t];return"__lodash_hash_undefined__"===r?void 0:r}return ht.call(e,t)?e[t]:void 0},dt=Object.prototype.hasOwnProperty;var vt=function(t){var e=this.__data__;return ct?void 0!==e[t]:dt.call(e,t)};var yt=function(t,e){var r=this.__data__;return this.size+=this.has(t)?0:1,r[t]=ct&&void 0===e?"__lodash_hash_undefined__":e,this};function gt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}gt.prototype.clear=ft,gt.prototype.delete=lt,gt.prototype.get=pt,gt.prototype.has=vt,gt.prototype.set=yt;var mt=gt;var bt=function(){this.__data__=[],this.size=0};var _t=function(t,e){return t===e||t!=t&&e!=e};var jt=function(t,e){for(var r=t.length;r--;)if(_t(t[r][0],e))return r;return-1},wt=Array.prototype.splice;var St=function(t){var e=this.__data__,r=jt(e,t);return!(r<0)&&(r==e.length-1?e.pop():wt.call(e,r,1),--this.size,!0)};var kt=function(t){var e=this.__data__,r=jt(e,t);return r<0?void 0:e[r][1]};var $t=function(t){return jt(this.__data__,t)>-1};var Ot=function(t,e){var r=this.__data__,n=jt(r,t);return n<0?(++this.size,r.push([t,e])):r[n][1]=e,this};function xt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}xt.prototype.clear=bt,xt.prototype.delete=St,xt.prototype.get=kt,xt.prototype.has=$t,xt.prototype.set=Ot;var Mt=xt,Pt=st(z,"Map");var zt=function(){this.size=0,this.__data__={hash:new mt,map:new(Pt||Mt),string:new mt}};var Tt=function(t){var e=typeof t;return"string"==e||"number"==e||"symbol"==e||"boolean"==e?"__proto__"!==t:null===t};var At=function(t,e){var r=t.__data__;return Tt(e)?r["string"==typeof e?"string":"hash"]:r.map};var Ft=function(t){var e=At(this,t).delete(t);return this.size-=e?1:0,e};var Dt=function(t){return At(this,t).get(t)};var Et=function(t){return At(this,t).has(t)};var Ct=function(t,e){var r=At(this,t),n=r.size;return r.set(t,e),this.size+=r.size==n?0:1,this};function Lt(t){var e=-1,r=null==t?0:t.length;for(this.clear();++e<r;){var n=t[e];this.set(n[0],n[1])}}Lt.prototype.clear=zt,Lt.prototype.delete=Ft,Lt.prototype.get=Dt,Lt.prototype.has=Et,Lt.prototype.set=Ct;var Rt=Lt;function It(t,e){if("function"!=typeof t||null!=e&&"function"!=typeof e)throw new TypeError("Expected a function");var r=function(){var n=arguments,i=e?e.apply(this,n):n[0],o=r.cache;if(o.has(i))return o.get(i);var a=t.apply(this,n);return r.cache=o.set(i,a)||o,a};return r.cache=new(It.Cache||Rt),r}It.Cache=Rt;var Nt=It;var qt=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Yt=/\\(\\)?/g,Ut=function(t){var e=Nt(t,(function(t){return 500===r.size&&r.clear(),t})),r=e.cache;return e}((function(t){var e=[];return 46===t.charCodeAt(0)&&e.push(""),t.replace(qt,(function(t,r,n,i){e.push(n?i.replace(Yt,"$1"):r||t)})),e}));var Wt=function(t,e){for(var r=-1,n=null==t?0:t.length,i=Array(n);++r<n;)i[r]=e(t[r],r,t);return i},Ht=T?T.prototype:void 0,Bt=Ht?Ht.toString:void 0;var Vt=function t(e){if("string"==typeof e)return e;if($(e))return Wt(e,t)+"";if(Y(e))return Bt?Bt.call(e):"";var r=e+"";return"0"==r&&1/e==-Infinity?"-0":r};var Qt=function(t){return null==t?"":Vt(t)};var Zt=function(t,e){return $(t)?t:H(t,e)?[t]:Ut(Qt(t))};var Jt=function(t){if("string"==typeof t||Y(t))return t;var e=t+"";return"0"==e&&1/t==-Infinity?"-0":e};var Gt=function(t,e){for(var r=0,n=(e=Zt(e,t)).length;null!=t&&r<n;)t=t[Jt(e[r++])];return r&&r==n?t:void 0};var Kt=function(t,e,r){var n=null==t?void 0:Gt(t,e);return void 0===n?r:n},Xt=Object.prototype;var te=function(t){var e=t&&t.constructor;return t===("function"==typeof e&&e.prototype||Xt)};var ee=function(t,e){return function(r){return t(e(r))}}(Object.keys,Object),re=Object.prototype.hasOwnProperty;var ne=function(t){if(!te(t))return ee(t);var e=[];for(var r in Object(t))re.call(t,r)&&"constructor"!=r&&e.push(r);return e},ie=st(z,"DataView"),oe=st(z,"Promise"),ae=st(z,"Set"),ue=st(z,"WeakMap"),se="[object Map]",ce="[object Promise]",fe="[object Set]",le="[object WeakMap]",he="[object DataView]",pe=X(ie),de=X(Pt),ve=X(oe),ye=X(ae),ge=X(ue),me=N;(ie&&me(new ie(new ArrayBuffer(1)))!=he||Pt&&me(new Pt)!=se||oe&&me(oe.resolve())!=ce||ae&&me(new ae)!=fe||ue&&me(new ue)!=le)&&(me=function(t){var e=N(t),r="[object Object]"==e?t.constructor:void 0,n=r?X(r):"";if(n)switch(n){case pe:return he;case de:return se;case ve:return ce;case ye:return fe;case ge:return le}return e});var be=me;var _e=function(t){return"number"==typeof t&&t>-1&&t%1==0&&t<=9007199254740991};var je=function(t){return null!=t&&_e(t.length)&&!Q(t)};var we=function(t){return"string"==typeof t||!$(t)&&q(t)&&"[object String]"==N(t)};var Se=function(t){return function(e){return null==e?void 0:e[t]}},ke=Se("length"),$e=RegExp("[\\u200d\\ud800-\\udfff\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff\\ufe0e\\ufe0f]");var Oe=function(t){return $e.test(t)},xe="[\\ud800-\\udfff]",Me="[\\u0300-\\u036f\\ufe20-\\ufe2f\\u20d0-\\u20ff]",Pe="\\ud83c[\\udffb-\\udfff]",ze="[^\\ud800-\\udfff]",Te="(?:\\ud83c[\\udde6-\\uddff]){2}",Ae="[\\ud800-\\udbff][\\udc00-\\udfff]",Fe="(?:"+Me+"|"+Pe+")"+"?",De="[\\ufe0e\\ufe0f]?",Ee=De+Fe+("(?:\\u200d(?:"+[ze,Te,Ae].join("|")+")"+De+Fe+")*"),Ce="(?:"+[ze+Me+"?",Me,Te,Ae,xe].join("|")+")",Le=RegExp(Pe+"(?="+Pe+")|"+Ce+Ee,"g");var Re=function(t){for(var e=Le.lastIndex=0;Le.test(t);)++e;return e};var Ie=function(t){return Oe(t)?Re(t):ke(t)};var Ne=function(t){if(null==t)return 0;if(je(t))return we(t)?Ie(t):t.length;var e=be(t);return"[object Map]"==e||"[object Set]"==e?t.size:ne(t).length};var qe=function(t,e){for(var r=-1,n=null==t?0:t.length,i=0,o=[];++r<n;){var a=t[r];e(a,r,t)&&(o[i++]=a)}return o};var Ye=function(t){return function(e,r,n){for(var i=-1,o=Object(e),a=n(e),u=a.length;u--;){var s=a[t?u:++i];if(!1===r(o[s],s,o))break}return e}}();var Ue=function(t,e){for(var r=-1,n=Array(t);++r<t;)n[r]=e(r);return n};var We=function(t){return q(t)&&"[object Arguments]"==N(t)},He=Object.prototype,Be=He.hasOwnProperty,Ve=He.propertyIsEnumerable,Qe=We(function(){return arguments}())?We:function(t){return q(t)&&Be.call(t,"callee")&&!Ve.call(t,"callee")},Ze=Qe;var Je=function(){return!1},Ge=x((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,i=n&&n.exports===r?z.Buffer:void 0,o=(i?i.isBuffer:void 0)||Je;t.exports=o})),Ke=/^(?:0|[1-9]\d*)$/;var Xe=function(t,e){var r=typeof t;return!!(e=null==e?9007199254740991:e)&&("number"==r||"symbol"!=r&&Ke.test(t))&&t>-1&&t%1==0&&t<e},tr={};tr["[object Float32Array]"]=tr["[object Float64Array]"]=tr["[object Int8Array]"]=tr["[object Int16Array]"]=tr["[object Int32Array]"]=tr["[object Uint8Array]"]=tr["[object Uint8ClampedArray]"]=tr["[object Uint16Array]"]=tr["[object Uint32Array]"]=!0,tr["[object Arguments]"]=tr["[object Array]"]=tr["[object ArrayBuffer]"]=tr["[object Boolean]"]=tr["[object DataView]"]=tr["[object Date]"]=tr["[object Error]"]=tr["[object Function]"]=tr["[object Map]"]=tr["[object Number]"]=tr["[object Object]"]=tr["[object RegExp]"]=tr["[object Set]"]=tr["[object String]"]=tr["[object WeakMap]"]=!1;var er=function(t){return q(t)&&_e(t.length)&&!!tr[N(t)]};var rr=function(t){return function(e){return t(e)}},nr=x((function(t,e){var r=e&&!e.nodeType&&e,n=r&&t&&!t.nodeType&&t,i=n&&n.exports===r&&M.process,o=function(){try{var t=n&&n.require&&n.require("util").types;return t||i&&i.binding&&i.binding("util")}catch(t){}}();t.exports=o})),ir=nr&&nr.isTypedArray,or=ir?rr(ir):er,ar=Object.prototype.hasOwnProperty;var ur=function(t,e){var r=$(t),n=!r&&Ze(t),i=!r&&!n&&Ge(t),o=!r&&!n&&!i&&or(t),a=r||n||i||o,u=a?Ue(t.length,String):[],s=u.length;for(var c in t)!e&&!ar.call(t,c)||a&&("length"==c||i&&("offset"==c||"parent"==c)||o&&("buffer"==c||"byteLength"==c||"byteOffset"==c)||Xe(c,s))||u.push(c);return u};var sr=function(t){return je(t)?ur(t):ne(t)};var cr=function(t,e){return function(r,n){if(null==r)return r;if(!je(r))return t(r,n);for(var i=r.length,o=e?i:-1,a=Object(r);(e?o--:++o<i)&&!1!==n(a[o],o,a););return r}}((function(t,e){return t&&Ye(t,e,sr)}));var fr=function(t,e){var r=[];return cr(t,(function(t,n,i){e(t,n,i)&&r.push(t)})),r};var lr=function(){this.__data__=new Mt,this.size=0};var hr=function(t){var e=this.__data__,r=e.delete(t);return this.size=e.size,r};var pr=function(t){return this.__data__.get(t)};var dr=function(t){return this.__data__.has(t)};var vr=function(t,e){var r=this.__data__;if(r instanceof Mt){var n=r.__data__;if(!Pt||n.length<199)return n.push([t,e]),this.size=++r.size,this;r=this.__data__=new Rt(n)}return r.set(t,e),this.size=r.size,this};function yr(t){var e=this.__data__=new Mt(t);this.size=e.size}yr.prototype.clear=lr,yr.prototype.delete=hr,yr.prototype.get=pr,yr.prototype.has=dr,yr.prototype.set=vr;var gr=yr;var mr=function(t){return this.__data__.set(t,"__lodash_hash_undefined__"),this};var br=function(t){return this.__data__.has(t)};function _r(t){var e=-1,r=null==t?0:t.length;for(this.__data__=new Rt;++e<r;)this.add(t[e])}_r.prototype.add=_r.prototype.push=mr,_r.prototype.has=br;var jr=_r;var wr=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n;)if(e(t[r],r,t))return!0;return!1};var Sr=function(t,e){return t.has(e)};var kr=function(t,e,r,n,i,o){var a=1&r,u=t.length,s=e.length;if(u!=s&&!(a&&s>u))return!1;var c=o.get(t),f=o.get(e);if(c&&f)return c==e&&f==t;var l=-1,h=!0,p=2&r?new jr:void 0;for(o.set(t,e),o.set(e,t);++l<u;){var d=t[l],v=e[l];if(n)var y=a?n(v,d,l,e,t,o):n(d,v,l,t,e,o);if(void 0!==y){if(y)continue;h=!1;break}if(p){if(!wr(e,(function(t,e){if(!Sr(p,e)&&(d===t||i(d,t,r,n,o)))return p.push(e)}))){h=!1;break}}else if(d!==v&&!i(d,v,r,n,o)){h=!1;break}}return o.delete(t),o.delete(e),h},$r=z.Uint8Array;var Or=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t,n){r[++e]=[n,t]})),r};var xr=function(t){var e=-1,r=Array(t.size);return t.forEach((function(t){r[++e]=t})),r},Mr=T?T.prototype:void 0,Pr=Mr?Mr.valueOf:void 0;var zr=function(t,e,r,n,i,o,a){switch(r){case"[object DataView]":if(t.byteLength!=e.byteLength||t.byteOffset!=e.byteOffset)return!1;t=t.buffer,e=e.buffer;case"[object ArrayBuffer]":return!(t.byteLength!=e.byteLength||!o(new $r(t),new $r(e)));case"[object Boolean]":case"[object Date]":case"[object Number]":return _t(+t,+e);case"[object Error]":return t.name==e.name&&t.message==e.message;case"[object RegExp]":case"[object String]":return t==e+"";case"[object Map]":var u=Or;case"[object Set]":var s=1&n;if(u||(u=xr),t.size!=e.size&&!s)return!1;var c=a.get(t);if(c)return c==e;n|=2,a.set(t,e);var f=kr(u(t),u(e),n,i,o,a);return a.delete(t),f;case"[object Symbol]":if(Pr)return Pr.call(t)==Pr.call(e)}return!1};var Tr=function(t,e){for(var r=-1,n=e.length,i=t.length;++r<n;)t[i+r]=e[r];return t};var Ar=function(t,e,r){var n=e(t);return $(t)?n:Tr(n,r(t))};var Fr=function(){return[]},Dr=Object.prototype.propertyIsEnumerable,Er=Object.getOwnPropertySymbols,Cr=Er?function(t){return null==t?[]:(t=Object(t),qe(Er(t),(function(e){return Dr.call(t,e)})))}:Fr;var Lr=function(t){return Ar(t,sr,Cr)},Rr=Object.prototype.hasOwnProperty;var Ir=function(t,e,r,n,i,o){var a=1&r,u=Lr(t),s=u.length;if(s!=Lr(e).length&&!a)return!1;for(var c=s;c--;){var f=u[c];if(!(a?f in e:Rr.call(e,f)))return!1}var l=o.get(t),h=o.get(e);if(l&&h)return l==e&&h==t;var p=!0;o.set(t,e),o.set(e,t);for(var d=a;++c<s;){var v=t[f=u[c]],y=e[f];if(n)var g=a?n(y,v,f,e,t,o):n(v,y,f,t,e,o);if(!(void 0===g?v===y||i(v,y,r,n,o):g)){p=!1;break}d||(d="constructor"==f)}if(p&&!d){var m=t.constructor,b=e.constructor;m==b||!("constructor"in t)||!("constructor"in e)||"function"==typeof m&&m instanceof m&&"function"==typeof b&&b instanceof b||(p=!1)}return o.delete(t),o.delete(e),p},Nr="[object Arguments]",qr="[object Array]",Yr="[object Object]",Ur=Object.prototype.hasOwnProperty;var Wr=function(t,e,r,n,i,o){var a=$(t),u=$(e),s=a?qr:be(t),c=u?qr:be(e),f=(s=s==Nr?Yr:s)==Yr,l=(c=c==Nr?Yr:c)==Yr,h=s==c;if(h&&Ge(t)){if(!Ge(e))return!1;a=!0,f=!1}if(h&&!f)return o||(o=new gr),a||or(t)?kr(t,e,r,n,i,o):zr(t,e,s,r,n,i,o);if(!(1&r)){var p=f&&Ur.call(t,"__wrapped__"),d=l&&Ur.call(e,"__wrapped__");if(p||d){var v=p?t.value():t,y=d?e.value():e;return o||(o=new gr),i(v,y,r,n,o)}}return!!h&&(o||(o=new gr),Ir(t,e,r,n,i,o))};var Hr=function t(e,r,n,i,o){return e===r||(null==e||null==r||!q(e)&&!q(r)?e!=e&&r!=r:Wr(e,r,n,i,t,o))};var Br=function(t,e,r,n){var i=r.length,o=i,a=!n;if(null==t)return!o;for(t=Object(t);i--;){var u=r[i];if(a&&u[2]?u[1]!==t[u[0]]:!(u[0]in t))return!1}for(;++i<o;){var s=(u=r[i])[0],c=t[s],f=u[1];if(a&&u[2]){if(void 0===c&&!(s in t))return!1}else{var l=new gr;if(n)var h=n(c,f,s,t,e,l);if(!(void 0===h?Hr(f,c,3,n,l):h))return!1}}return!0};var Vr=function(t){return t==t&&!B(t)};var Qr=function(t){for(var e=sr(t),r=e.length;r--;){var n=e[r],i=t[n];e[r]=[n,i,Vr(i)]}return e};var Zr=function(t,e){return function(r){return null!=r&&(r[t]===e&&(void 0!==e||t in Object(r)))}};var Jr=function(t){var e=Qr(t);return 1==e.length&&e[0][2]?Zr(e[0][0],e[0][1]):function(r){return r===t||Br(r,t,e)}};var Gr=function(t,e){return null!=t&&e in Object(t)};var Kr=function(t,e,r){for(var n=-1,i=(e=Zt(e,t)).length,o=!1;++n<i;){var a=Jt(e[n]);if(!(o=null!=t&&r(t,a)))break;t=t[a]}return o||++n!=i?o:!!(i=null==t?0:t.length)&&_e(i)&&Xe(a,i)&&($(t)||Ze(t))};var Xr=function(t,e){return null!=t&&Kr(t,e,Gr)};var tn=function(t,e){return H(t)&&Vr(e)?Zr(Jt(t),e):function(r){var n=Kt(r,t);return void 0===n&&n===e?Xr(r,t):Hr(e,n,3)}};var en=function(t){return t};var rn=function(t){return function(e){return Gt(e,t)}};var nn=function(t){return H(t)?Se(Jt(t)):rn(t)};var on=function(t){return"function"==typeof t?t:null==t?en:"object"==typeof t?$(t)?tn(t[0],t[1]):Jr(t):nn(t)};var an=function(t,e){return($(t)?qe:fr)(t,on(e))};var un=function(t){return function(e,r,n){var i=Object(e);if(!je(e)){var o=on(r);e=sr(e),r=function(t){return o(i[t],t,i)}}var a=t(e,r,n);return a>-1?i[o?e[a]:a]:void 0}};var sn=function(t,e,r,n){for(var i=t.length,o=r+(n?1:-1);n?o--:++o<i;)if(e(t[o],o,t))return o;return-1},cn=/\s/;var fn=function(t){for(var e=t.length;e--&&cn.test(t.charAt(e)););return e},ln=/^\s+/;var hn=function(t){return t?t.slice(0,fn(t)+1).replace(ln,""):t},pn=/^[-+]0x[0-9a-f]+$/i,dn=/^0b[01]+$/i,vn=/^0o[0-7]+$/i,yn=parseInt;var gn=function(t){if("number"==typeof t)return t;if(Y(t))return NaN;if(B(t)){var e="function"==typeof t.valueOf?t.valueOf():t;t=B(e)?e+"":e}if("string"!=typeof t)return 0===t?t:+t;t=hn(t);var r=dn.test(t);return r||vn.test(t)?yn(t.slice(2),r?2:8):pn.test(t)?NaN:+t},mn=1/0;var bn=function(t){return t?(t=gn(t))===mn||t===-1/0?17976931348623157e292*(t<0?-1:1):t==t?t:0:0===t?t:0};var _n=function(t){var e=bn(t),r=e%1;return e==e?r?e-r:e:0},jn=Math.max;var wn=un((function(t,e,r){var n=null==t?0:t.length;if(!n)return-1;var i=null==r?0:_n(r);return i<0&&(i=jn(n+i,0)),sn(t,on(e),i)}));var Sn=function(t,e){var r=-1,n=je(t)?Array(t.length):[];return cr(t,(function(t,i,o){n[++r]=e(t,i,o)})),n};var kn=function(t,e){return($(t)?Wt:Sn)(t,on(e))};function $n(){let t,e,r=new Promise((function(){t=arguments[0],e=arguments[1]}));return r.resolve=t,r.reject=e,r}var On=z.isFinite,xn=Math.min;var Mn=function(t){var e=Math[t];return function(t,r){if(t=gn(t),(r=null==r?0:xn(_n(r),292))&&On(t)){var n=(Qt(t)+"e").split("e"),i=e(n[0]+"e"+(+n[1]+r));return+((n=(Qt(i)+"e").split("e"))[0]+"e"+(+n[1]-r))}return e(t)}}("round");function Pn(t){return!(!function(t){return"[object String]"===Object.prototype.toString.call(t)}(t)||""===t)}function zn(t){let e=!1;return Pn(t)?e=!isNaN(Number(t)):function(t){return"[object Number]"===Object.prototype.toString.call(t)}(t)&&(e=!0),e}function Tn(t){if(!zn(t))return 0;return bn(t)}function An(t){if(!zn(t))return 0;t=Tn(t);let e=Mn(t);return"0"===String(e)?0:e}function Fn(t){if(!Pn(t)&&!zn(t)&&!Y(t))return"";let e="";try{e=String(t)}catch(t){}try{e=t.toString()}catch(t){}return e}var Dn=function(t){return"number"==typeof t&&t==_n(t)};function En(t){return!!zn(t)&&(t=Tn(t),Dn(t))}function Cn(t){if(!En(t))return!1;return An(t)>0}function Ln(t){return"[object Object]"===Object.prototype.toString.call(t)}function Rn(t){if(Ln(t)){for(let e in t)return!0;return!1}return!1}function In(t){let e=Object.prototype.toString.call(t);return"[object Function]"===e||"[object AsyncFunction]"===e}function Nn(t){if(!En(t))return!1;return An(t)>=0}function qn(t,e){return Pn(t)&&Nn(e)?0===(e=An(e))?"":t.substring(0,e):""}var Yn=function(t,e,r){var n=-1,i=t.length;e<0&&(e=-e>i?0:i+e),(r=r>i?i:r)<0&&(r+=i),i=e>r?0:r-e>>>0,e>>>=0;for(var o=Array(i);++n<i;)o[n]=t[n+e];return o};var Un=function(t,e,r){var n=null==t?0:t.length;return n?(e=r||void 0===e?1:_n(e),Yn(t,e<0?0:e,n)):[]};var Wn=function(t,e){for(var r=-1,n=null==t?0:t.length;++r<n&&!1!==e(t[r],r,t););return t};var Hn=function(t){return"function"==typeof t?t:en};var Bn=function(t,e){return($(t)?Wn:cr)(t,Hn(e))};function Vn(t,e){let r=$n();if(n=t,"[object Array]"!==Object.prototype.toString.call(n)&&!Ln(t))return r.reject("rs is not array or object"),r;var n;let i=!1;if(Ln(t)){i=!0;let e=[];Bn(t,((t,r)=>{e.push({k:r,v:t})})),t=e}In(e)||(e=function(t){return t});let o=-1,a=[];return t.reduce((function(t,r){return t.then((function(t){a.push(t),o+=1;let n=o,u=r;return i&&(n=r.k,u=r.v),In(e)?e(u,n):u}))}),Promise.resolve()).then((function(t){a.push(t),a=Un(a),r.resolve(a)})).catch((function(t){r.reject(t)})),r}function Qn(t,e){if(!Pn(t))return"";if(!Nn(e))return"";if(0===(e=An(e)))return"";let r=t.length-e;return r<0&&(r=0),t.substr(r,e)}function Zn(t,e){return Pn(t)&&Nn(e)?0===(e=An(e))?t:qn(t,t.length-e):""}function Jn(t){if(!Pn(t))return"";let e=function(t){if(!Pn(t))return{path:"",isRoot:!1};for(;t.indexOf("\\\\")>=0;)t=t.replace("\\\\","\\");for(;t.indexOf("//")>=0;)t=t.replace("//","/");if(":"===Qn(t,1))return{path:"".concat(t,"\\"),isRoot:!0};if("\\"===Qn(t,1)){let e=Zn(t,1);return":"===Qn(e,1)?{path:t,isRoot:!0}:{path:e,isRoot:!1}}if("/"===Qn(t,1)){let e=Zn(t,1);return 0===Ne(e)?{path:t,isRoot:!0}:{path:e,isRoot:!1}}return{path:t,isRoot:!1}}(t);if(e.isRoot)return e.path;let r=e.path;try{r=r.split("\\").pop().split("/").pop()}catch(t){}return r}function Gn(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1,r=1;function n(t){let i=[],o=d.default.readdirSync(t);return Bn(o,(function(o){let a=p.default.resolve(t,o),u=null;try{u=d.default.statSync(a)}catch(t){}u&&u.isDirectory()?(i.push({isFolder:!0,level:r,path:a,name:p.default.basename(a)}),r+=1,(r<=e||null===e)&&(i=i.concat(n(a))),r-=1):i.push({isFolder:!1,level:r,path:a,name:p.default.basename(a)})})),i}return n(t)}function Kn(t){return!!d.default.existsSync(t)&&(!d.default.lstatSync(t).isFile()&&!d.default.lstatSync(t).isSymbolicLink())}function Xn(t){return!!d.default.existsSync(t)&&(!d.default.lstatSync(t).isDirectory()&&!d.default.lstatSync(t).isSymbolicLink())}function ti(t){if(Kn(t))return{success:"input folder is already exists: "+t};if(d.default.existsSync(t))return{error:"input path already exists: "+t};try{d.default.mkdirSync(t,{recursive:!0})}catch(t){return{error:t}}return{success:"done: "+t}}var ei=x((function(t,e){t.exports=function(){var t=1e3,e=6e4,r=36e5,n="millisecond",i="second",o="minute",a="hour",u="day",s="week",c="month",f="quarter",l="year",h="date",p="Invalid Date",d=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,v=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,y={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_")},g=function(t,e,r){var n=String(t);return!n||n.length>=e?t:""+Array(e+1-n.length).join(r)+t},m={s:g,z:function(t){var e=-t.utcOffset(),r=Math.abs(e),n=Math.floor(r/60),i=r%60;return(e<=0?"+":"-")+g(n,2,"0")+":"+g(i,2,"0")},m:function t(e,r){if(e.date()<r.date())return-t(r,e);var n=12*(r.year()-e.year())+(r.month()-e.month()),i=e.clone().add(n,c),o=r-i<0,a=e.clone().add(n+(o?-1:1),c);return+(-(n+(r-i)/(o?i-a:a-i))||0)},a:function(t){return t<0?Math.ceil(t)||0:Math.floor(t)},p:function(t){return{M:c,y:l,w:s,d:u,D:h,h:a,m:o,s:i,ms:n,Q:f}[t]||String(t||"").toLowerCase().replace(/s$/,"")},u:function(t){return void 0===t}},b="en",_={};_[b]=y;var j=function(t){return t instanceof $},w=function t(e,r,n){var i;if(!e)return b;if("string"==typeof e){var o=e.toLowerCase();_[o]&&(i=o),r&&(_[o]=r,i=o);var a=e.split("-");if(!i&&a.length>1)return t(a[0])}else{var u=e.name;_[u]=e,i=u}return!n&&i&&(b=i),i||!n&&b},S=function(t,e){if(j(t))return t.clone();var r="object"==typeof e?e:{};return r.date=t,r.args=arguments,new $(r)},k=m;k.l=w,k.i=j,k.w=function(t,e){return S(t,{locale:e.$L,utc:e.$u,x:e.$x,$offset:e.$offset})};var $=function(){function y(t){this.$L=w(t.locale,null,!0),this.parse(t)}var g=y.prototype;return g.parse=function(t){this.$d=function(t){var e=t.date,r=t.utc;if(null===e)return new Date(NaN);if(k.u(e))return new Date;if(e instanceof Date)return new Date(e);if("string"==typeof e&&!/Z$/i.test(e)){var n=e.match(d);if(n){var i=n[2]-1||0,o=(n[7]||"0").substring(0,3);return r?new Date(Date.UTC(n[1],i,n[3]||1,n[4]||0,n[5]||0,n[6]||0,o)):new Date(n[1],i,n[3]||1,n[4]||0,n[5]||0,n[6]||0,o)}}return new Date(e)}(t),this.$x=t.x||{},this.init()},g.init=function(){var t=this.$d;this.$y=t.getFullYear(),this.$M=t.getMonth(),this.$D=t.getDate(),this.$W=t.getDay(),this.$H=t.getHours(),this.$m=t.getMinutes(),this.$s=t.getSeconds(),this.$ms=t.getMilliseconds()},g.$utils=function(){return k},g.isValid=function(){return!(this.$d.toString()===p)},g.isSame=function(t,e){var r=S(t);return this.startOf(e)<=r&&r<=this.endOf(e)},g.isAfter=function(t,e){return S(t)<this.startOf(e)},g.isBefore=function(t,e){return this.endOf(e)<S(t)},g.$g=function(t,e,r){return k.u(t)?this[e]:this.set(r,t)},g.unix=function(){return Math.floor(this.valueOf()/1e3)},g.valueOf=function(){return this.$d.getTime()},g.startOf=function(t,e){var r=this,n=!!k.u(e)||e,f=k.p(t),p=function(t,e){var i=k.w(r.$u?Date.UTC(r.$y,e,t):new Date(r.$y,e,t),r);return n?i:i.endOf(u)},d=function(t,e){return k.w(r.toDate()[t].apply(r.toDate("s"),(n?[0,0,0,0]:[23,59,59,999]).slice(e)),r)},v=this.$W,y=this.$M,g=this.$D,m="set"+(this.$u?"UTC":"");switch(f){case l:return n?p(1,0):p(31,11);case c:return n?p(1,y):p(0,y+1);case s:var b=this.$locale().weekStart||0,_=(v<b?v+7:v)-b;return p(n?g-_:g+(6-_),y);case u:case h:return d(m+"Hours",0);case a:return d(m+"Minutes",1);case o:return d(m+"Seconds",2);case i:return d(m+"Milliseconds",3);default:return this.clone()}},g.endOf=function(t){return this.startOf(t,!1)},g.$set=function(t,e){var r,s=k.p(t),f="set"+(this.$u?"UTC":""),p=(r={},r[u]=f+"Date",r[h]=f+"Date",r[c]=f+"Month",r[l]=f+"FullYear",r[a]=f+"Hours",r[o]=f+"Minutes",r[i]=f+"Seconds",r[n]=f+"Milliseconds",r)[s],d=s===u?this.$D+(e-this.$W):e;if(s===c||s===l){var v=this.clone().set(h,1);v.$d[p](d),v.init(),this.$d=v.set(h,Math.min(this.$D,v.daysInMonth())).$d}else p&&this.$d[p](d);return this.init(),this},g.set=function(t,e){return this.clone().$set(t,e)},g.get=function(t){return this[k.p(t)]()},g.add=function(n,f){var h,p=this;n=Number(n);var d=k.p(f),v=function(t){var e=S(p);return k.w(e.date(e.date()+Math.round(t*n)),p)};if(d===c)return this.set(c,this.$M+n);if(d===l)return this.set(l,this.$y+n);if(d===u)return v(1);if(d===s)return v(7);var y=(h={},h[o]=e,h[a]=r,h[i]=t,h)[d]||1,g=this.$d.getTime()+n*y;return k.w(g,this)},g.subtract=function(t,e){return this.add(-1*t,e)},g.format=function(t){var e=this,r=this.$locale();if(!this.isValid())return r.invalidDate||p;var n=t||"YYYY-MM-DDTHH:mm:ssZ",i=k.z(this),o=this.$H,a=this.$m,u=this.$M,s=r.weekdays,c=r.months,f=function(t,r,i,o){return t&&(t[r]||t(e,n))||i[r].slice(0,o)},l=function(t){return k.s(o%12||12,t,"0")},h=r.meridiem||function(t,e,r){var n=t<12?"AM":"PM";return r?n.toLowerCase():n},d={YY:String(this.$y).slice(-2),YYYY:this.$y,M:u+1,MM:k.s(u+1,2,"0"),MMM:f(r.monthsShort,u,c,3),MMMM:f(c,u),D:this.$D,DD:k.s(this.$D,2,"0"),d:String(this.$W),dd:f(r.weekdaysMin,this.$W,s,2),ddd:f(r.weekdaysShort,this.$W,s,3),dddd:s[this.$W],H:String(o),HH:k.s(o,2,"0"),h:l(1),hh:l(2),a:h(o,a,!0),A:h(o,a,!1),m:String(a),mm:k.s(a,2,"0"),s:String(this.$s),ss:k.s(this.$s,2,"0"),SSS:k.s(this.$ms,3,"0"),Z:i};return n.replace(v,(function(t,e){return e||d[t]||i.replace(":","")}))},g.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},g.diff=function(n,h,p){var d,v=k.p(h),y=S(n),g=(y.utcOffset()-this.utcOffset())*e,m=this-y,b=k.m(this,y);return b=(d={},d[l]=b/12,d[c]=b,d[f]=b/3,d[s]=(m-g)/6048e5,d[u]=(m-g)/864e5,d[a]=m/r,d[o]=m/e,d[i]=m/t,d)[v]||m,p?b:k.a(b)},g.daysInMonth=function(){return this.endOf(c).$D},g.$locale=function(){return _[this.$L]},g.locale=function(t,e){if(!t)return this.$L;var r=this.clone(),n=w(t,e,!0);return n&&(r.$L=n),r},g.clone=function(){return k.w(this.$d,this)},g.toDate=function(){return new Date(this.valueOf())},g.toJSON=function(){return this.isValid()?this.toISOString():null},g.toISOString=function(){return this.$d.toISOString()},g.toString=function(){return this.$d.toUTCString()},y}(),O=$.prototype;return S.prototype=O,[["$ms",n],["$s",i],["$m",o],["$H",a],["$W",u],["$M",c],["$y",l],["$D",h]].forEach((function(t){O[t[1]]=function(e){return this.$g(e,t[0],t[1])}})),S.extend=function(t,e){return t.$i||(t(e,$,S),t.$i=!0),S},S.locale=w,S.isDayjs=j,S.unix=function(t){return S(1e3*t)},S.en=_[b],S.Ls=_,S.p={},S}()}));const ri=v.default.createConnection,ni=y.default.EventEmitter,ii=g.default.inherits,oi=S.default.nfc,ai=k.default("jsftp:general"),ui=k.default("jsftp:command"),si=k.default("jsftp:response"),ci=6e5,fi=function(){},li={marks:[125,150],ignore:226},hi=/([-\d]+,[-\d]+,[-\d]+,[-\d]+),([-\d]+),([-\d]+)/,pi=/\r\n|\n/;function di(t){let e=fi,r=t+" ";for(var n=arguments.length,i=new Array(n>1?n-1:0),o=1;o<n;o++)i[o-1]=arguments[o];"function"==typeof i[i.length-1]&&(e=i.pop()),r+=i.join(" "),this.execute(r.trim(),e)}function vi(t){this.host=t.host||"localhost",this.port=t.port||21,this.user=t.user||"anonymous",this.pass=t.pass||"@anonymous",this.createSocket=t.createSocket,this.useList=t.useList||!1,this.commandQueue=[],ni.call(this),this.on("data",si),this.on("error",si),this._createSocket(this.port,this.host)}ii(vi,ni),vi.prototype.raw=function(){di.apply(this,arguments)},vi.prototype.reemit=function(t){return e=>{this.emit(t,e),ai("event:".concat(t),e||{})}},vi.prototype._createSocket=function(t,e){let r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:fi;this.socket&&this.socket.destroy&&this.socket.destroy(),this.resParser&&this.resParser.end(),this.resParser=new _.default,this.authenticated=!1,this.socket=this.createSocket?this.createSocket({port:t,host:e},r):ri(t,e,r),this.socket.on("connect",this.reemit("connect")),this.socket.on("timeout",this.reemit("timeout")),this.pipeline=b.default(this.socket,this.resParser),this.pipeline.on("data",(t=>{this.emit("data",t),si(t.text),this.parseResponse(t)})),this.pipeline.on("error",this.reemit("error"))},vi.prototype.parseResponse=function(t){if(0===this.commandQueue.length)return;if([220].indexOf(t.code)>-1)return;const e=this.commandQueue[0].callback;if(t.isMark){if(!e.expectsMark||-1===e.expectsMark.marks.indexOf(t.code))return;e.expectsMark.ignore&&(this.ignoreCmdCode=e.expectsMark.ignore)}this.ignoreCmdCode!==t.code?this.parse(t,this.commandQueue.shift()):this.ignoreCmdCode=null},vi.prototype.send=function(t){t&&(ui(t),this.pipeline.write(t+"\r\n"),ui(t))},vi.prototype.nextCmd=function(){const t=this.commandQueue[0];!this.inProgress&&t&&(this.send(t.action),this.inProgress=!0)},vi.prototype.execute=function(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:fi;if(this.socket&&this.socket.writable)return this.runCommand({action:t,callback:e});this.authenticated=!1,this._createSocket(this.port,this.host,(()=>{this.runCommand({action:t,callback:e})}))},vi.prototype.runCommand=function(t){if(this.authenticated||/^(feat|syst|user|pass)/.test(t.action))return this.commandQueue.push(t),void this.nextCmd();this.getFeatures((()=>{this.auth(this.user,this.pass,(()=>{this.commandQueue.push(t),this.nextCmd()}))}))},vi.prototype.parse=function(t,e){let r=null;t.isError&&(r=new Error(t.text||"Unknown FTP error."),r.code=t.code),this.inProgress=!1,e.callback(r,t),this.nextCmd()},vi.prototype.getPasvPort=function(t){const e=hi.exec(t);if(!e)return null;let r=e[1].replace(/,/g,".");return"127.0.0.1"===r&&(r=this.host),{host:r,port:256*(255&parseInt(e[2],10))+(255&parseInt(e[3],10))}},vi.prototype.hasFeat=function(t){return!!t&&this.features.indexOf(t.toLowerCase())>-1},vi.prototype._parseFeats=function(t){return t.split(pi).slice(1,-1).map((t=>t.trim().toLowerCase())).filter((t=>!!t))},vi.prototype.getFeatures=function(t){if(this.features)return t(null,this.features);this.raw("feat",((e,r)=>{this.features=e?[]:this._parseFeats(r.text),this.raw("syst",((e,r)=>{e||215!==r.code||(this.system=r.text.toLowerCase()),t(null,this.features)}))}))},vi.prototype.auth=function(t,e,r){if(!0===this.authenticating)return r(new Error("This client is already authenticating"));"string"!=typeof t&&(t=this.user),"string"!=typeof e&&(e=this.pass),this.authenticating=!0,this.raw("user",t,((n,i)=>{if(n||-1===[230,331,332].indexOf(i.code))return this.authenticating=!1,void r(n);this.raw("pass",e,((n,i)=>{this.authenticating=!1,n?r(n):[230,202].indexOf(i.code)>-1?(this.authenticated=!0,this.user=t,this.pass=e,this.raw("type","I",(()=>{r(void 0,i)}))):332===i.code&&this.raw("acct","")}))}))},vi.prototype.setType=function(t,e){if(t=t.toUpperCase(),this.type===t)return e();this.raw("type",t,((r,n)=>{r||(this.type=t),e(r,n)}))},vi.prototype.list=function(t,e){1===arguments.length&&(e=arguments[0],t="");let r="";e=w.default(e),this.getPasvSocket(((n,i)=>{if(n)return e(n);function o(t,r){if(t)return e(t);li.marks.some((t=>t===r.code))||e(new Error("Expected marks ".concat(li.toString()," instead of: ").concat(r.text)))}i.setEncoding("utf8"),i.on("data",(t=>{r+=t})),this.pasvTimeout(i,e),i.once("close",(n=>n?e(n):r?void e(null,r):e({code:451,text:"Could not retrieve a file listing for ".concat(t,"."),isMark:!1,isError:!0}))),i.once("error",e),o.expectsMark=li,this.execute("list ".concat(t||""),o)}))},vi.prototype.emitProgress=function(t){this.emit("progress",{filename:t.filename,action:t.action,total:t.totalSize||0,transferred:t.socket["get"===t.action?"bytesRead":"bytesWritten"]})},vi.prototype.get=function(t,e){let r,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:fi;const i=typeof e;"function"===i?r=e:"string"===i&&(n=w.default(n),r=(r,i)=>{if(r)return n(r);const o=d.default.createWriteStream(e);o.on("error",n),i.on("readable",(()=>{this.emitProgress({filename:t,action:"get",socket:i})})),i.on("error",n),i.on("end",n),i.on("close",n),i.pipe(o)}),this.getGetSocket(t,w.default(r))},vi.prototype.getGetSocket=function(t,e){e=w.default(e),this.getPasvSocket(((r,n)=>{if(r)return i(r);function i(t,r){return t?(n&&n.destroy(),e(t)):n?125===r.code||150===r.code?e(null,n):(n.destroy(),e(new Error("Unexpected command "+r.text))):e(new Error("Error when retrieving PASV socket"))}n.on("error",(t=>{"ECONNREFUSED"===t.code&&(t.msg="Probably trying a PASV operation while one is in progress"),i(t)})),this.pasvTimeout(n,i),n.pause(),i.expectsMark=li,this.execute("retr "+t,i)}))},vi.prototype.put=function(t,e,r){const n=(t,e,n)=>{t.on("readable",(()=>{this.emitProgress({filename:e,action:"put",socket:t,totalSize:n})})),this.getPutSocket(t,e,r)};t instanceof Buffer?this.getPutSocket(t,e,((e,n)=>{if(e)return r(new Error(e));let i,o=0,a=1048576,u=!1;i=t.slice(o,o+a),o+=a,r(null,i),n.write(t.slice(0,a)),i.length===t.length&&(n.end(),r(null,[])),n.on("drain",(()=>{t.length>o+a?(i=t.slice(o,o+a),o+=a):(i=t.slice(o),u=!0),r(null,i),n.write(i),u&&(n.end(),r(null,[]))}))})):"string"==typeof t?d.default.stat(t,((i,o)=>{if(i&&"ENOENT"===i.code)return r(new Error("Local file doesn't exist."));if(o.isDirectory())return r(new Error("Local path cannot be a directory"));const a=i?0:o.size;n(d.default.createReadStream(t),e,a)})):t instanceof m.default.Readable?n(t,e,0):r(new Error("Expected `from` parameter to be a Buffer, Stream, or a String"))},vi.prototype.getPutSocket=function(t,e,r){r=w.default(r||fi),this.getPasvSocket(((n,i)=>{if(n)return i&&i.destroy(),r(n);i.on("close",r),i.on("error",r);const o=w.default(((e,n)=>e?(i&&i.destroy(),r(e)):125!==n.code&&150!==n.code?(i&&i.destroy(),r(new Error("Unexpected command "+n.text))):(this.pasvTimeout(i,r),void(t instanceof Buffer?r(null,i):t instanceof m.default.Readable&&(r(null,i),t.pipe(i))))));o.expectsMark=li,this.execute("stor ".concat(e),o)}))},vi.prototype.pasvTimeout=function(t,e){t.once("timeout",(()=>{ai("PASV socket timeout"),this.emit("timeout"),t.end(),e(new Error("Passive socket timeout"))}))},vi.prototype.getPasvSocket=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:fi;t=w.default(t),this.execute("pasv",((e,r)=>{if(e)return t(e);const n=this.getPasvPort(r.text);if(!n)return t(new Error("Bad passive host/port combination"));const i=this._pasvSocket=this.createSocket?this.createSocket(n):ri(n);i.setTimeout(this.timeout||ci),i.once("close",(()=>{this._pasvSocket=void 0})),t(null,i)}))},vi.prototype.ls=function(t,e){function r(t,r){if(t)return e(t);j.default.parseFtpEntries(r.text||r,((t,r)=>{if(t)return e(t);r.forEach((t=>{t.name=oi(t.name)})),e(null,r)}))}this.useList?this.list(t,r):this.raw("stat",t,((e,n)=>{const i=e&&(502===e.code||500===e.code),o=this.system&&this.system.indexOf("hummingbird")>-1;i||o?(this.useList=!0,this.list(t,r)):r(e,n)}))},vi.prototype.rename=function(t,e,r){this.raw("rnfr",t,(t=>{if(t)return r(t);this.raw("rnto",e,r)}))},vi.prototype.keepAlive=function(t){this._keepAliveInterval&&clearInterval(this._keepAliveInterval),this._keepAliveInterval=setInterval(this.raw.bind(this,"noop"),t||3e4)},vi.prototype.destroy=function(){this._keepAliveInterval&&clearInterval(this._keepAliveInterval),this.socket&&this.socket.writable&&this.socket.end(),this._pasvSocket&&this._pasvSocket.writable&&this._pasvSocket.end(),this.resParser.end(),this.socket=void 0,this._pasvSocket=void 0,this.features=null,this.authenticated=!1};var yi=vi;async function gi(){return null}async function mi(){return null}async function bi(){return null}async function _i(t){return null}async function ji(t){return null}async function wi(t){return null}async function Si(t,e){return null}async function ki(t,e,r){return null}async function $i(t,e,r){return null}async function Oi(t,e,r){return null}return function(){let t={doc_conn:gi,doc_ls:mi,doc_quit:bi,doc_stateFile:_i,doc_isFile:ji,doc_isFolder:wi,doc_download:Si,doc_upload:ki,doc_syncToLocal:$i,doc_syncToRemote:Oi};return new function(){let e=null;async function r(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:".",r=$n();return null===e?(r.reject("FTP has not been initialized. please use 'conn' to construct FTP"),r):(e.ls(t,((t,e)=>{t?r.reject(t):(e=kn(e,(t=>{let e=ei(t.time);return t.ctime=e.format("YYYY-MM-DDTHH:mm:ssZ"),t.isFolder=i(t),t})),r.resolve(e))})),r)}async function n(t){let e=null;return await r(t).then((t=>{e=t})).catch((()=>{e=null})),e=Kt(e,0,null),e}function i(t){if(!Rn(t))return!1;return 1===Kt(t,"type",-1)}function o(t){if(!Rn(t))return!1;return 0===Kt(t,"type",-1)}async function a(t,r){let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,a=$n();if(null===e)return a.reject("FTP has not been initialized. please use 'conn' to construct FTP"),a;if(!Pn(t))return a.reject("fpRemote[".concat(t,"] is not a effective string")),a;if(!Pn(r))return a.reject("fpLocal[".concat(r,"] is not a effective string")),a;let u=p.default.basename(p.default.dirname(r));Kn(u)||ti(u);let s=await n(t),c=await o(s);if(!c)return a.reject("fpRemote[".concat(t,"] is not a file")),a;if(!Rn(s))return a.reject("fpRemote[".concat(t,"] does not have information")),a;let f=Kt(s,"size");return zn(f)?(f=An(f),e.get(t,((e,n)=>{e&&a.reject(e),Xn(r)&&d.default.unlinkSync(r);let o=d.default.createWriteStream(r),u=0;n.on("data",(e=>{if(In(i)){let n=Ne(e);u+=n,i({progress:u/f*100,name:Jn(r),fpRemote:t,fpLocal:r})}o.write(e)})),n.on("close",(t=>{t?a.reject(t):a.resolve("ok")})),n.resume()})),a):(a.reject("can not get the size of file[".concat(t,"]")),a)}async function u(t,r,n){let i=$n();if(null===e)return i.reject("FTP has not been initialized. please use 'conn' to construct FTP"),i;if(!Pn(r))return i.reject("fpRemote[".concat(r,"] is not a effective string")),i;if(!Pn(t))return i.reject("fpLocal[".concat(t,"] is not a effective string")),i;if(!Xn(t))return i.reject("fpLocal[".concat(t,"] is not a file")),i;let o=d.default.statSync(t),a=Kt(o,"size");if(!zn(a))return i.reject("can not get the size of file[".concat(t,"]")),i;a=An(a);let u=d.default.readFileSync(t),s=0;return e.put(u,r,((e,o)=>{if(e)i.reject(e);else if(0!==Ne(o)){if(In(n)){let e=Ne(o);s+=e,n({progress:s/a*100,name:Jn(t),fpRemote:r,fpLocal:t})}}else i.resolve("ok")})),i}return{conn:async function(){let r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},n=$n(),i=Kt(r,"hostname");if(!Pn(i))return n.reject("hostname[".concat(i,"] is not a effective string")),n;let o=Kt(r,"port");if(!Cn(o))return n.reject("port[".concat(o,"] is not a positive integer")),n;o=An(o);let a=Kt(r,"username");if(!Pn(a))return n.reject("username[".concat(a,"] is not a effective string")),n;let u=Kt(r,"password");if(!Pn(u))return n.reject("password[".concat(u,"] is not a effective string")),n;try{e=new yi({host:i,port:o,user:a,pass:u}),e.__doc__=t,n.resolve("ok")}catch(t){n.reject(t)}return n},ls:r,stateFile:n,isFile:async function(t){return await o(t)},isFolder:async function(t){return i(await n(t))},download:a,syncToLocal:async function(t,n,i){if(null===e)return Promise.reject("FTP has not been initialized. please use 'conn' to construct FTP");let o=await r(t);o=an(o,(t=>!t.isFolder)),Kn(n)||ti(n);let u=Gn(n);u=an(u,(t=>!t.isFolder)),u=kn(u,(t=>{let e=d.default.statSync(t.path);return t.size=Fn(Kt(e,"size","")),t}));let s=0,c=[];return await Vn(o,(async e=>{let r=wn(u,{name:e.name}),o=t;"/"!==!qn(o,1)&&(o+="/"),o+=Kt(e,"name","");let f=p.default.resolve(n,Kt(e,"name","")),l=t=>{In(i)&&i(t)};Rn(r)?e.size!==r.size&&(await a(o,f,l),s++,c.push({name:e.name,reason:"size[".concat(r.size,"] of local file != size[").concat(e.size,"] of remote file")})):(await a(o,f,l),s++,c.push({name:e.name,reason:"no local file"}))})),{num:s,files:c}},syncToRemote:async function(t,n,i){if(null===e)return Promise.reject("FTP has not been initialized. please use 'conn' to construct FTP");let o=await r(n);if(!Kn(t))return Promise.reject("fdLocal[".concat(t,"] is not a folder"));let a=Gn(t);a=an(a,(t=>!t.isFolder)),a=kn(a,(t=>{let e=d.default.statSync(t.path);return t.size=Fn(Kt(e,"size","")),t}));let s=0,c=[];return await Vn(a,(async e=>{let r=wn(o,{name:e.name}),a=n;"/"!==!qn(a,1)&&(a+="/"),a+=Kt(e,"name","");let f=p.default.resolve(t,Kt(e,"name","")),l=t=>{In(i)&&i(t)};Rn(r)?e.size!==r.size&&(await u(f,a,l),s++,c.push({name:e.name,reason:"size[".concat(r.size,"] of remote file != size[").concat(e.size,"] of local file")})):(await u(f,a,l),s++,c.push({name:e.name,reason:"no Remote file"}))})),{num:s,files:c}},upload:u,quit:async function(){let t=$n();return null===e?(t.reject("FTP has not been initialized. please use 'conn' to construct FTP"),t):(e.raw("quit",((e,r)=>{e?t.reject(e):t.resolve(r)})),t)}}}}}));
|
|
7
7
|
//# sourceMappingURL=w-ftp.umd.js.map
|