lesca-node-bunnycdn 0.0.21 → 0.0.22

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/lib/index.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function P(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var O={exports:{}},r=O.exports={},c,u;function b(){throw new Error("setTimeout has not been defined")}function E(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?c=setTimeout:c=b}catch{c=b}try{typeof clearTimeout=="function"?u=clearTimeout:u=E}catch{u=E}})();function S(e){if(c===setTimeout)return setTimeout(e,0);if((c===b||!c)&&setTimeout)return c=setTimeout,setTimeout(e,0);try{return c(e,0)}catch{try{return c.call(null,e,0)}catch{return c.call(this,e,0)}}}function R(e){if(u===clearTimeout)return clearTimeout(e);if((u===E||!u)&&clearTimeout)return u=clearTimeout,clearTimeout(e);try{return u(e)}catch{try{return u.call(null,e)}catch{return u.call(this,e)}}}var l=[],N=!1,g,y=-1;function D(){!N||!g||(N=!1,g.length?l=g.concat(l):y=-1,l.length&&U())}function U(){if(!N){var e=S(D);N=!0;for(var t=l.length;t;){for(g=l,l=[];++y<t;)g&&g[y].run();y=-1,t=l.length}g=null,N=!1,R(e)}}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var s=1;s<arguments.length;s++)t[s-1]=arguments[s];l.push(new A(e,t)),l.length===1&&!N&&S(U)};function A(e,t){this.fun=e,this.array=t}A.prototype.run=function(){this.fun.apply(null,this.array)};r.title="browser";r.browser=!0;r.env={};r.argv=[];r.version="";r.versions={};function f(){}r.on=f;r.addListener=f;r.once=f;r.off=f;r.removeListener=f;r.removeAllListeners=f;r.emit=f;r.prependListener=f;r.prependOnceListener=f;r.listeners=function(e){return[]};r.binding=function(e){throw new Error("process.binding is not supported")};r.cwd=function(){return"/"};r.chdir=function(e){throw new Error("process.chdir is not supported")};r.umask=function(){return 0};var Y=O.exports;const h=P(Y),_=(e={})=>({region:e.region||h.env.BUNNY_REGION||"SG",baseHostName:"storage.bunnycdn.com",folderName:e.folderName||h.env.BUNNY_FOLDER_NAME||"",storageZone:e.storageZone||h.env.BUNNY_STORAGE_ZONE||"unset",password:e.password||h.env.BUNNY_PASSWORD||"unset"}),F=({storageZone:e,password:t,region:s,folderName:i})=>{e&&(h.env.BUNNY_STORAGE_ZONE=e),t&&(h.env.BUNNY_PASSWORD=t),s&&(h.env.BUNNY_REGION=s),i&&(h.env.BUNNY_FOLDER_NAME=i)},L=async({file:e,buffer:t,folder:s,...i})=>new Promise(async(n,a)=>{try{!t&&!e&&a({res:!1,message:"No file uploaded"});const o=_(i),p=t?t.length:e.buffer.length,m=o.folderName?`${o.folderName}/`:"",w=s?`${s}/`:"",d=`${new Date().getTime()}.webp`,$={method:"PUT",hostname:o.region?`${o.region}.${o.baseHostName}`:o.baseHostName,port:443,path:`/${o.storageZone}/${m}${w}${d}`,headers:{AccessKey:o.password,"Content-Type":"application/octet-stream","Content-Length":p.toString()}},T=await fetch(`https://${$.hostname}${$.path}`,{method:"PUT",headers:$.headers,body:t||e.buffer});if(T.status===201){const v=`https://${o.storageZone}.b-cdn.net/${m}${w}${d}`;n({res:!0,message:"upload success",url:v})}else a({res:!1,message:"Upload failed",error:await T.text()})}catch{a({res:!1,message:"Server error"})}}),B=async({folder:e="",configOverrides:t={}}={})=>new Promise((s,i)=>{try{const n=_(t),a=n.region?`${n.region}.${n.baseHostName}`:n.baseHostName,o=n.folderName?`${n.folderName}/`:"",p=e?`${e}/`:"",m=`https://${a}/${n.storageZone}/${o}${p}`,w={AccessKey:n.password};fetch(m,{headers:w}).then(d=>d.json()).then(d=>{const $=d.map(T=>{const v=`https://${n.storageZone}.b-cdn.net/${o}${p}${T.ObjectName}`;return{...T,Url:v}});s({res:!0,message:"List retrieved successfully",files:$})}).catch(d=>{i({res:!1,message:"Network error",error:d})})}catch{i({res:!1,message:"Server error"})}}),C=({ObjectName:e,href:t,...s})=>new Promise((i,n)=>{if(!e&&!t){n({res:!1,message:"No file specified for deletion"});return}try{const a=_(s),o=a.region?`${a.region}.${a.baseHostName}`:a.baseHostName,p=t?decodeURIComponent(t.split("/")[t.split("/").length-1]):e;fetch(`https://${o}/${a.storageZone}/${a.folderName}/${p}`,{method:"DELETE",headers:{AccessKey:a.password}}).then(m=>{m.status===200?i({res:!0,message:"File deleted successfully"}):i({res:!1,message:"Failed to delete file"})}).catch(m=>{n({res:!1,message:"Network error",error:m})})}catch{n({res:!1,message:"Server error"})}}),Z={install:F,upload:L,list:B,deleteFile:C};exports.default=Z;exports.deleteFile=C;exports.install=F;exports.list=B;exports.upload=L;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});function C(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var O={exports:{}},r=O.exports={},u,f;function b(){throw new Error("setTimeout has not been defined")}function E(){throw new Error("clearTimeout has not been defined")}(function(){try{typeof setTimeout=="function"?u=setTimeout:u=b}catch{u=b}try{typeof clearTimeout=="function"?f=clearTimeout:f=E}catch{f=E}})();function S(e){if(u===setTimeout)return setTimeout(e,0);if((u===b||!u)&&setTimeout)return u=setTimeout,setTimeout(e,0);try{return u(e,0)}catch{try{return u.call(null,e,0)}catch{return u.call(this,e,0)}}}function H(e){if(f===clearTimeout)return clearTimeout(e);if((f===E||!f)&&clearTimeout)return f=clearTimeout,clearTimeout(e);try{return f(e)}catch{try{return f.call(null,e)}catch{return f.call(this,e)}}}var m=[],T=!1,g,w=-1;function R(){!T||!g||(T=!1,g.length?m=g.concat(m):w=-1,m.length&&U())}function U(){if(!T){var e=S(R);T=!0;for(var t=m.length;t;){for(g=m,m=[];++w<t;)g&&g[w].run();w=-1,t=m.length}g=null,T=!1,H(e)}}r.nextTick=function(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];m.push(new A(e,t)),m.length===1&&!T&&S(U)};function A(e,t){this.fun=e,this.array=t}A.prototype.run=function(){this.fun.apply(null,this.array)};r.title="browser";r.browser=!0;r.env={};r.argv=[];r.version="";r.versions={};function h(){}r.on=h;r.addListener=h;r.once=h;r.off=h;r.removeListener=h;r.removeAllListeners=h;r.emit=h;r.prependListener=h;r.prependOnceListener=h;r.listeners=function(e){return[]};r.binding=function(e){throw new Error("process.binding is not supported")};r.cwd=function(){return"/"};r.chdir=function(e){throw new Error("process.chdir is not supported")};r.umask=function(){return 0};var D=O.exports;const p=C(D),_=(e={})=>({region:e.region||p.env.BUNNY_REGION||"SG",baseHostName:"storage.bunnycdn.com",folderName:e.folderName||p.env.BUNNY_FOLDER_NAME||"",storageZone:e.storageZone||p.env.BUNNY_STORAGE_ZONE||"unset",password:e.password||p.env.BUNNY_PASSWORD||"unset"}),F=({storageZone:e,password:t,region:n,folderName:l})=>{e&&(p.env.BUNNY_STORAGE_ZONE=e),t&&(p.env.BUNNY_PASSWORD=t),n&&(p.env.BUNNY_REGION=n),l&&(p.env.BUNNY_FOLDER_NAME=l)},P=async({file:e,buffer:t,folder:n,...l})=>new Promise(async(o,d)=>{try{!t&&!e&&d({res:!1,message:"No file uploaded"});const s=_(l),c=t?t.length:e.buffer.length,N=s.folderName?`${s.folderName}/`:"",$=n?`${n}/`:"",a=`${new Date().getTime()}.webp`,y={method:"PUT",hostname:s.region?`${s.region}.${s.baseHostName}`:s.baseHostName,port:443,path:`/${s.storageZone}/${N}${$}${a}`,headers:{AccessKey:s.password,"Content-Type":"application/octet-stream","Content-Length":c.toString()}},i=await fetch(`https://${y.hostname}${y.path}`,{method:"PUT",headers:y.headers,body:t||e.buffer});if(i.status===201){const v=`https://${s.storageZone}.b-cdn.net/${N}${$}${a}`;o({res:!0,message:"upload success",url:v})}else d({res:!1,message:"Upload failed",error:await i.text()})}catch{d({res:!1,message:"Server error"})}}),L=async({folder:e="",configOverrides:t={}}={})=>new Promise((n,l)=>{try{const o=_(t),d=o.region?`${o.region}.${o.baseHostName}`:o.baseHostName,s=o.folderName?`${o.folderName}/`:"",c=e?`${e}/`:"",N=`https://${d}/${o.storageZone}/${s}${c}`,$={AccessKey:o.password};fetch(N,{headers:$}).then(a=>a.json()).then(a=>{const y=a.map(i=>{const v=`https://${o.storageZone}.b-cdn.net/${s}${c}${i.ObjectName}`;return{...i,Url:v}});n({res:!0,message:"List retrieved successfully",files:y})}).catch(a=>{l({res:!1,message:"Network error",error:a})})}catch{l({res:!1,message:"Server error"})}}),B=({ObjectName:e,href:t,...n})=>new Promise((l,o)=>{if(!e&&!t){o({res:!1,message:"No file specified for deletion"});return}try{let d="",s="";if(t){const a=t.split("/").filter(i=>i!==""&&!i.includes("http"));if([...a].pop()?.includes(".")||!1){const i=[...a];d=decodeURIComponent(i.pop()||""),s=i.splice(1,1).join("/")}else s=[...a].splice(1,1).join("/")}const c=_(n),N=c.region?`${c.region}.${c.baseHostName}`:c.baseHostName,$=s?`/${s}`:"";fetch(`https://${N}/${c.storageZone}${$}/${d}`,{method:"DELETE",headers:{AccessKey:c.password}}).then(a=>{a.status===200?l({res:!0,message:"File deleted successfully"}):l({res:!1,message:"Failed to delete file"})}).catch(a=>{o({res:!1,message:"Network error",error:a})})}catch{o({res:!1,message:"Server error"})}}),Y={install:F,upload:P,list:L,deleteFile:B};exports.default=Y;exports.deleteFile=B;exports.install=F;exports.list=L;exports.upload=P;
package/lib/index.js CHANGED
@@ -1,7 +1,7 @@
1
- function L(e) {
1
+ function S(e) {
2
2
  return e && e.__esModule && Object.prototype.hasOwnProperty.call(e, "default") ? e.default : e;
3
3
  }
4
- var O = { exports: {} }, r = O.exports = {}, i, u;
4
+ var A = { exports: {} }, r = A.exports = {}, u, f;
5
5
  function b() {
6
6
  throw new Error("setTimeout has not been defined");
7
7
  }
@@ -10,60 +10,60 @@ function E() {
10
10
  }
11
11
  (function() {
12
12
  try {
13
- typeof setTimeout == "function" ? i = setTimeout : i = b;
13
+ typeof setTimeout == "function" ? u = setTimeout : u = b;
14
14
  } catch {
15
- i = b;
15
+ u = b;
16
16
  }
17
17
  try {
18
- typeof clearTimeout == "function" ? u = clearTimeout : u = E;
18
+ typeof clearTimeout == "function" ? f = clearTimeout : f = E;
19
19
  } catch {
20
- u = E;
20
+ f = E;
21
21
  }
22
22
  })();
23
- function _(e) {
24
- if (i === setTimeout)
23
+ function O(e) {
24
+ if (u === setTimeout)
25
25
  return setTimeout(e, 0);
26
- if ((i === b || !i) && setTimeout)
27
- return i = setTimeout, setTimeout(e, 0);
26
+ if ((u === b || !u) && setTimeout)
27
+ return u = setTimeout, setTimeout(e, 0);
28
28
  try {
29
- return i(e, 0);
29
+ return u(e, 0);
30
30
  } catch {
31
31
  try {
32
- return i.call(null, e, 0);
32
+ return u.call(null, e, 0);
33
33
  } catch {
34
- return i.call(this, e, 0);
34
+ return u.call(this, e, 0);
35
35
  }
36
36
  }
37
37
  }
38
- function F(e) {
39
- if (u === clearTimeout)
38
+ function L(e) {
39
+ if (f === clearTimeout)
40
40
  return clearTimeout(e);
41
- if ((u === E || !u) && clearTimeout)
42
- return u = clearTimeout, clearTimeout(e);
41
+ if ((f === E || !f) && clearTimeout)
42
+ return f = clearTimeout, clearTimeout(e);
43
43
  try {
44
- return u(e);
44
+ return f(e);
45
45
  } catch {
46
46
  try {
47
- return u.call(null, e);
47
+ return f.call(null, e);
48
48
  } catch {
49
- return u.call(this, e);
49
+ return f.call(this, e);
50
50
  }
51
51
  }
52
52
  }
53
- var l = [], N = !1, p, y = -1;
54
- function B() {
55
- !N || !p || (N = !1, p.length ? l = p.concat(l) : y = -1, l.length && S());
53
+ var d = [], w = !1, g, T = -1;
54
+ function P() {
55
+ !w || !g || (w = !1, g.length ? d = g.concat(d) : T = -1, d.length && _());
56
56
  }
57
- function S() {
58
- if (!N) {
59
- var e = _(B);
60
- N = !0;
61
- for (var t = l.length; t; ) {
62
- for (p = l, l = []; ++y < t; )
63
- p && p[y].run();
64
- y = -1, t = l.length;
57
+ function _() {
58
+ if (!w) {
59
+ var e = O(P);
60
+ w = !0;
61
+ for (var t = d.length; t; ) {
62
+ for (g = d, d = []; ++T < t; )
63
+ g && g[T].run();
64
+ T = -1, t = d.length;
65
65
  }
66
- p = null, N = !1, F(e);
66
+ g = null, w = !1, L(e);
67
67
  }
68
68
  }
69
69
  r.nextTick = function(e) {
@@ -71,12 +71,12 @@ r.nextTick = function(e) {
71
71
  if (arguments.length > 1)
72
72
  for (var n = 1; n < arguments.length; n++)
73
73
  t[n - 1] = arguments[n];
74
- l.push(new A(e, t)), l.length === 1 && !N && _(S);
74
+ d.push(new F(e, t)), d.length === 1 && !w && O(_);
75
75
  };
76
- function A(e, t) {
76
+ function F(e, t) {
77
77
  this.fun = e, this.array = t;
78
78
  }
79
- A.prototype.run = function() {
79
+ F.prototype.run = function() {
80
80
  this.fun.apply(null, this.array);
81
81
  };
82
82
  r.title = "browser";
@@ -85,17 +85,17 @@ r.env = {};
85
85
  r.argv = [];
86
86
  r.version = "";
87
87
  r.versions = {};
88
- function f() {
88
+ function h() {
89
89
  }
90
- r.on = f;
91
- r.addListener = f;
92
- r.once = f;
93
- r.off = f;
94
- r.removeListener = f;
95
- r.removeAllListeners = f;
96
- r.emit = f;
97
- r.prependListener = f;
98
- r.prependOnceListener = f;
90
+ r.on = h;
91
+ r.addListener = h;
92
+ r.once = h;
93
+ r.off = h;
94
+ r.removeListener = h;
95
+ r.removeAllListeners = h;
96
+ r.emit = h;
97
+ r.prependListener = h;
98
+ r.prependOnceListener = h;
99
99
  r.listeners = function(e) {
100
100
  return [];
101
101
  };
@@ -111,90 +111,99 @@ r.chdir = function(e) {
111
111
  r.umask = function() {
112
112
  return 0;
113
113
  };
114
- var C = O.exports;
115
- const h = /* @__PURE__ */ L(C), U = (e = {}) => ({
116
- region: e.region || h.env.BUNNY_REGION || "SG",
114
+ var B = A.exports;
115
+ const p = /* @__PURE__ */ S(B), U = (e = {}) => ({
116
+ region: e.region || p.env.BUNNY_REGION || "SG",
117
117
  baseHostName: "storage.bunnycdn.com",
118
- folderName: e.folderName || h.env.BUNNY_FOLDER_NAME || "",
119
- storageZone: e.storageZone || h.env.BUNNY_STORAGE_ZONE || "unset",
120
- password: e.password || h.env.BUNNY_PASSWORD || "unset"
121
- }), R = ({ storageZone: e, password: t, region: n, folderName: c }) => {
122
- e && (h.env.BUNNY_STORAGE_ZONE = e), t && (h.env.BUNNY_PASSWORD = t), n && (h.env.BUNNY_REGION = n), c && (h.env.BUNNY_FOLDER_NAME = c);
123
- }, D = async ({
118
+ folderName: e.folderName || p.env.BUNNY_FOLDER_NAME || "",
119
+ storageZone: e.storageZone || p.env.BUNNY_STORAGE_ZONE || "unset",
120
+ password: e.password || p.env.BUNNY_PASSWORD || "unset"
121
+ }), C = ({ storageZone: e, password: t, region: n, folderName: l }) => {
122
+ e && (p.env.BUNNY_STORAGE_ZONE = e), t && (p.env.BUNNY_PASSWORD = t), n && (p.env.BUNNY_REGION = n), l && (p.env.BUNNY_FOLDER_NAME = l);
123
+ }, H = async ({
124
124
  file: e,
125
125
  buffer: t,
126
126
  folder: n,
127
- ...c
127
+ ...l
128
128
  }) => new Promise(
129
- async (s, a) => {
129
+ async (o, m) => {
130
130
  try {
131
- !t && !e && a({ res: !1, message: "No file uploaded" });
132
- const o = U(c), g = t ? t.length : e.buffer.length, m = o.folderName ? `${o.folderName}/` : "", T = n ? `${n}/` : "", d = `${(/* @__PURE__ */ new Date()).getTime()}.webp`, $ = {
131
+ !t && !e && m({ res: !1, message: "No file uploaded" });
132
+ const s = U(l), c = t ? t.length : e.buffer.length, N = s.folderName ? `${s.folderName}/` : "", $ = n ? `${n}/` : "", a = `${(/* @__PURE__ */ new Date()).getTime()}.webp`, y = {
133
133
  method: "PUT",
134
- hostname: o.region ? `${o.region}.${o.baseHostName}` : o.baseHostName,
134
+ hostname: s.region ? `${s.region}.${s.baseHostName}` : s.baseHostName,
135
135
  port: 443,
136
- path: `/${o.storageZone}/${m}${T}${d}`,
136
+ path: `/${s.storageZone}/${N}${$}${a}`,
137
137
  headers: {
138
- AccessKey: o.password,
138
+ AccessKey: s.password,
139
139
  "Content-Type": "application/octet-stream",
140
- "Content-Length": g.toString()
140
+ "Content-Length": c.toString()
141
141
  }
142
- }, w = await fetch(`https://${$.hostname}${$.path}`, {
142
+ }, i = await fetch(`https://${y.hostname}${y.path}`, {
143
143
  method: "PUT",
144
- headers: $.headers,
144
+ headers: y.headers,
145
145
  body: t || e.buffer
146
146
  });
147
- if (w.status === 201) {
148
- const v = `https://${o.storageZone}.b-cdn.net/${m}${T}${d}`;
149
- s({ res: !0, message: "upload success", url: v });
147
+ if (i.status === 201) {
148
+ const v = `https://${s.storageZone}.b-cdn.net/${N}${$}${a}`;
149
+ o({ res: !0, message: "upload success", url: v });
150
150
  } else
151
- a({ res: !1, message: "Upload failed", error: await w.text() });
151
+ m({ res: !1, message: "Upload failed", error: await i.text() });
152
152
  } catch {
153
- a({ res: !1, message: "Server error" });
153
+ m({ res: !1, message: "Server error" });
154
154
  }
155
155
  }
156
- ), P = async ({ folder: e = "", configOverrides: t = {} } = {}) => new Promise((n, c) => {
156
+ ), R = async ({ folder: e = "", configOverrides: t = {} } = {}) => new Promise((n, l) => {
157
157
  try {
158
- const s = U(t), a = s.region ? `${s.region}.${s.baseHostName}` : s.baseHostName, o = s.folderName ? `${s.folderName}/` : "", g = e ? `${e}/` : "", m = `https://${a}/${s.storageZone}/${o}${g}`, T = { AccessKey: s.password };
159
- fetch(m, { headers: T }).then((d) => d.json()).then((d) => {
160
- const $ = d.map((w) => {
161
- const v = `https://${s.storageZone}.b-cdn.net/${o}${g}${w.ObjectName}`;
162
- return { ...w, Url: v };
158
+ const o = U(t), m = o.region ? `${o.region}.${o.baseHostName}` : o.baseHostName, s = o.folderName ? `${o.folderName}/` : "", c = e ? `${e}/` : "", N = `https://${m}/${o.storageZone}/${s}${c}`, $ = { AccessKey: o.password };
159
+ fetch(N, { headers: $ }).then((a) => a.json()).then((a) => {
160
+ const y = a.map((i) => {
161
+ const v = `https://${o.storageZone}.b-cdn.net/${s}${c}${i.ObjectName}`;
162
+ return { ...i, Url: v };
163
163
  });
164
- n({ res: !0, message: "List retrieved successfully", files: $ });
165
- }).catch((d) => {
166
- c({ res: !1, message: "Network error", error: d });
164
+ n({ res: !0, message: "List retrieved successfully", files: y });
165
+ }).catch((a) => {
166
+ l({ res: !1, message: "Network error", error: a });
167
167
  });
168
168
  } catch {
169
- c({ res: !1, message: "Server error" });
169
+ l({ res: !1, message: "Server error" });
170
170
  }
171
- }), Y = ({
171
+ }), D = ({
172
172
  ObjectName: e,
173
173
  href: t,
174
174
  ...n
175
- }) => new Promise((c, s) => {
175
+ }) => new Promise((l, o) => {
176
176
  if (!e && !t) {
177
- s({ res: !1, message: "No file specified for deletion" });
177
+ o({ res: !1, message: "No file specified for deletion" });
178
178
  return;
179
179
  }
180
180
  try {
181
- const a = U(n), o = a.region ? `${a.region}.${a.baseHostName}` : a.baseHostName, g = t ? decodeURIComponent(t.split("/")[t.split("/").length - 1]) : e;
182
- fetch(`https://${o}/${a.storageZone}/${a.folderName}/${g}`, {
181
+ let m = "", s = "";
182
+ if (t) {
183
+ const a = t.split("/").filter((i) => i !== "" && !i.includes("http"));
184
+ if ([...a].pop()?.includes(".") || !1) {
185
+ const i = [...a];
186
+ m = decodeURIComponent(i.pop() || ""), s = i.splice(1, 1).join("/");
187
+ } else
188
+ s = [...a].splice(1, 1).join("/");
189
+ }
190
+ const c = U(n), N = c.region ? `${c.region}.${c.baseHostName}` : c.baseHostName, $ = s ? `/${s}` : "";
191
+ fetch(`https://${N}/${c.storageZone}${$}/${m}`, {
183
192
  method: "DELETE",
184
- headers: { AccessKey: a.password }
185
- }).then((m) => {
186
- m.status === 200 ? c({ res: !0, message: "File deleted successfully" }) : c({ res: !1, message: "Failed to delete file" });
187
- }).catch((m) => {
188
- s({ res: !1, message: "Network error", error: m });
193
+ headers: { AccessKey: c.password }
194
+ }).then((a) => {
195
+ a.status === 200 ? l({ res: !0, message: "File deleted successfully" }) : l({ res: !1, message: "Failed to delete file" });
196
+ }).catch((a) => {
197
+ o({ res: !1, message: "Network error", error: a });
189
198
  });
190
199
  } catch {
191
- s({ res: !1, message: "Server error" });
200
+ o({ res: !1, message: "Server error" });
192
201
  }
193
- }), Z = { install: R, upload: D, list: P, deleteFile: Y };
202
+ }), Y = { install: C, upload: H, list: R, deleteFile: D };
194
203
  export {
195
- Z as default,
196
- Y as deleteFile,
197
- R as install,
198
- P as list,
199
- D as upload
204
+ Y as default,
205
+ D as deleteFile,
206
+ C as install,
207
+ R as list,
208
+ H as upload
200
209
  };
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "lesca-node-bunnycdn",
3
3
  "private": false,
4
4
  "description": "use bunny CDN api by node",
5
- "version": "0.0.21",
5
+ "version": "0.0.22",
6
6
  "type": "module",
7
7
  "keywords": [
8
8
  "bunnycdn",