diginext-utils 2.0.32 → 2.0.33
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 +162 -162
- package/dist/Checker.d.ts +8 -7
- package/dist/Checker.js +48 -28
- package/dist/Checker.mjs +29 -0
- package/dist/EventDispatcher.d.ts +12 -12
- package/dist/EventDispatcher.js +72 -47
- package/dist/EventDispatcher.mjs +54 -0
- package/dist/FileUpload.d.ts +11 -11
- package/dist/FileUpload.js +81 -61
- package/dist/FileUpload.mjs +62 -0
- package/dist/Slug.d.ts +9 -8
- package/dist/Slug.js +350 -330
- package/dist/Slug.mjs +331 -0
- package/dist/Timer-7b0c4e7c.d.ts +11 -0
- package/dist/Timer.d.ts +1 -4
- package/dist/Timer.js +31 -7
- package/dist/Timer.mjs +7 -0
- package/dist/Validation.d.ts +5 -4
- package/dist/Validation.js +54 -37
- package/dist/Validation.mjs +35 -0
- package/dist/array-dc599632.d.ts +158 -0
- package/dist/array.d.ts +1 -113
- package/dist/array.js +246 -266
- package/dist/array.mjs +49 -0
- package/dist/browser-8d042ffe.d.ts +22 -0
- package/dist/camera-1a859d72.d.ts +15 -0
- package/dist/chunk-5NTK5JAI.mjs +57 -0
- package/dist/chunk-5UEMANWE.mjs +91 -0
- package/dist/chunk-5ZOWNKSD.mjs +166 -0
- package/dist/chunk-6GNGTFNC.mjs +118 -0
- package/dist/chunk-7MK72U4O.mjs +19 -0
- package/dist/chunk-7XKT3AQX.mjs +17 -0
- package/dist/chunk-7ZCEZM7K.mjs +41 -0
- package/dist/chunk-AMBWJGSW.mjs +151 -0
- package/dist/chunk-C7S43KGB.mjs +15 -0
- package/dist/chunk-CJM7T7ON.mjs +24 -0
- package/dist/chunk-CKILLYAP.mjs +16 -0
- package/dist/chunk-DX7MUT3M.mjs +51 -0
- package/dist/chunk-EGUJQ5VF.mjs +32 -0
- package/dist/chunk-ETEIHDWU.mjs +25 -0
- package/dist/chunk-FJXSVGL7.mjs +22 -0
- package/dist/chunk-GJCAEOND.mjs +20 -0
- package/dist/chunk-GNJDIUYM.mjs +40 -0
- package/dist/chunk-IA7GINWD.mjs +39 -0
- package/dist/chunk-JEI7BOXY.mjs +21 -0
- package/dist/chunk-K4KENOE6.mjs +20 -0
- package/dist/chunk-KMERW6KS.mjs +34 -0
- package/dist/chunk-KPO3RH5G.mjs +27 -0
- package/dist/chunk-KWG5LYNK.mjs +100 -0
- package/dist/chunk-NUTQDHLQ.mjs +40 -0
- package/dist/chunk-O64XUDAH.mjs +35 -0
- package/dist/chunk-OYRPWQUA.mjs +257 -0
- package/dist/chunk-PNZ4KGXL.mjs +56 -0
- package/dist/chunk-QZYX26HT.mjs +24 -0
- package/dist/chunk-RDGP2CKM.mjs +195 -0
- package/dist/chunk-VFG5VU6S.mjs +12 -0
- package/dist/chunk-X3IMFCZG.mjs +23 -0
- package/dist/chunk-ZHNGZMRD.mjs +17 -0
- package/dist/color.d.ts +23 -22
- package/dist/color.js +96 -79
- package/dist/color.mjs +78 -0
- package/dist/console/enableConsole.d.ts +1 -2
- package/dist/console/enableConsole.js +38 -10
- package/dist/console/enableConsole.mjs +9 -0
- package/dist/console/index.d.ts +2 -11
- package/dist/console/index.js +58 -15
- package/dist/console/index.mjs +14 -0
- package/dist/console/log.d.ts +15 -14
- package/dist/console/log.js +74 -44
- package/dist/console/log.mjs +19 -0
- package/dist/createDir-220e0081.d.ts +13 -0
- package/dist/device/browser.d.ts +1 -5
- package/dist/device/browser.js +60 -32
- package/dist/device/browser.mjs +15 -0
- package/dist/device/camera.d.ts +1 -7
- package/dist/device/camera.js +184 -166
- package/dist/device/camera.mjs +8 -0
- package/dist/device/index.d.ts +1 -5
- package/dist/device/index.js +201 -216
- package/dist/device/index.mjs +15 -0
- package/dist/device/os.d.ts +11 -10
- package/dist/device/os.js +55 -28
- package/dist/device/os.mjs +33 -0
- package/dist/enableConsole-ddc24282.d.ts +11 -0
- package/dist/file/createDir.d.ts +1 -5
- package/dist/file/createDir.js +34 -13
- package/dist/file/createDir.mjs +7 -0
- package/dist/file/fileMove.d.ts +1 -4
- package/dist/file/fileMove.js +49 -29
- package/dist/file/fileMove.mjs +7 -0
- package/dist/file/findFilesByExt.d.ts +1 -13
- package/dist/file/findFilesByExt.js +64 -45
- package/dist/file/findFilesByExt.mjs +11 -0
- package/dist/file/index.d.ts +10 -8
- package/dist/file/index.js +104 -9
- package/dist/file/index.mjs +17 -0
- package/dist/fileMove-3a09e429.d.ts +13 -0
- package/dist/findFilesByExt-753e91d7.d.ts +24 -0
- package/dist/images/index.d.ts +2 -2
- package/dist/images/index.js +131 -8
- package/dist/images/index.mjs +15 -0
- package/dist/images/loadImage.d.ts +3 -0
- package/dist/images/loadImage.js +42 -0
- package/dist/images/loadImage.mjs +21 -0
- package/dist/images/resize.d.ts +3 -2
- package/dist/images/resize.js +60 -34
- package/dist/images/resize.mjs +9 -0
- package/dist/images/upload.d.ts +10 -9
- package/dist/images/upload.js +130 -25
- package/dist/images/upload.mjs +14 -0
- package/dist/index-1f738e52.d.ts +22 -0
- package/dist/index-22309f0c.d.ts +23 -0
- package/dist/index-6ae3c86b.d.ts +63 -0
- package/dist/index-c8fffc86.d.ts +90 -0
- package/dist/index-d652ed2c.d.ts +26 -0
- package/dist/index.d.ts +47 -36
- package/dist/index.js +1352 -62
- package/dist/index.mjs +87 -0
- package/dist/json.d.ts +8 -7
- package/dist/json.js +48 -28
- package/dist/json.mjs +29 -0
- package/dist/math/diffDate.d.ts +6 -5
- package/dist/math/diffDate.js +33 -11
- package/dist/math/diffDate.mjs +9 -0
- package/dist/math/index.d.ts +3 -30
- package/dist/math/index.js +159 -92
- package/dist/math/index.mjs +34 -0
- package/dist/math/positiveNumber.d.ts +3 -2
- package/dist/math/positiveNumber.js +53 -14
- package/dist/math/positiveNumber.mjs +10 -0
- package/dist/name/en.d.ts +5 -4
- package/dist/name/en.js +37 -19
- package/dist/name/en.mjs +9 -0
- package/dist/name/index.d.ts +3 -12
- package/dist/name/index.js +87 -12
- package/dist/name/index.mjs +20 -0
- package/dist/name/vi.d.ts +5 -4
- package/dist/name/vi.js +63 -25
- package/dist/name/vi.mjs +14 -0
- package/{esm/object.d.ts → dist/object-43aaaf92.d.ts} +79 -58
- package/dist/object.d.ts +1 -59
- package/dist/object.js +96 -71
- package/dist/object.mjs +21 -0
- package/dist/permission/index.d.ts +8 -7
- package/dist/permission/index.js +230 -6
- package/dist/permission/index.mjs +15 -0
- package/dist/permission/requestCamera.d.ts +1 -5
- package/dist/permission/requestCamera.js +49 -38
- package/dist/permission/requestCamera.mjs +9 -0
- package/dist/permission/requestDeviceOrientationControl.d.ts +1 -2
- package/dist/permission/requestDeviceOrientationControl.js +203 -36
- package/dist/permission/requestDeviceOrientationControl.mjs +10 -0
- package/dist/requestCamera-32b7dfc7.d.ts +14 -0
- package/dist/requestDeviceOrientationControl-b6458660.d.ts +11 -0
- package/dist/response/index.d.ts +49 -48
- package/dist/response/index.js +92 -47
- package/dist/response/index.mjs +16 -0
- package/dist/string/formatNumber.d.ts +7 -6
- package/dist/string/formatNumber.js +53 -12
- package/dist/string/formatNumber.mjs +10 -0
- package/dist/string/generatePassword.d.ts +10 -9
- package/dist/string/generatePassword.js +52 -21
- package/dist/string/generatePassword.mjs +10 -0
- package/dist/string/generateUUID.d.ts +3 -2
- package/dist/string/generateUUID.js +37 -34
- package/dist/string/generateUUID.mjs +9 -0
- package/dist/string/index.d.ts +6 -65
- package/dist/string/index.js +312 -157
- package/dist/string/index.mjs +31 -0
- package/dist/string/makeDaySlug.d.ts +31 -30
- package/dist/string/makeDaySlug.js +43 -19
- package/dist/string/makeDaySlug.mjs +9 -0
- package/dist/string/random.d.ts +14 -13
- package/dist/string/random.js +53 -22
- package/dist/string/random.mjs +19 -0
- package/dist/string/trimNull.d.ts +3 -2
- package/dist/string/trimNull.js +45 -17
- package/dist/string/trimNull.mjs +9 -0
- package/dist/string/url.d.ts +1 -36
- package/dist/string/url.js +115 -97
- package/dist/string/url.mjs +22 -0
- package/dist/url-60657387.d.ts +57 -0
- package/package.json +66 -66
- package/src/Checker.ts +29 -29
- package/src/EventDispatcher.ts +62 -62
- package/src/FileUpload.ts +66 -66
- package/src/Slug.ts +365 -365
- package/src/Timer.ts +7 -7
- package/src/Validation.ts +36 -36
- package/src/array.ts +285 -285
- package/src/color.ts +87 -87
- package/src/console/enableConsole.ts +8 -8
- package/src/console/index.ts +17 -17
- package/src/console/log.ts +39 -39
- package/src/device/browser.ts +29 -29
- package/src/device/camera.ts +207 -207
- package/src/device/index.ts +230 -230
- package/src/device/os.ts +29 -29
- package/src/file/createDir.ts +14 -14
- package/src/file/fileMove.ts +32 -32
- package/src/file/findFilesByExt.ts +46 -46
- package/src/file/index.ts +7 -7
- package/src/images/index.ts +3 -3
- package/src/images/loadImage.ts +16 -0
- package/src/images/resize.ts +35 -35
- package/src/images/upload.ts +24 -24
- package/src/index.ts +39 -39
- package/src/json.ts +29 -29
- package/src/math/diffDate.ts +10 -10
- package/src/math/index.ts +90 -90
- package/src/math/positiveNumber.ts +12 -12
- package/src/name/en.ts +27 -27
- package/src/name/index.ts +8 -8
- package/src/name/vi.ts +23 -23
- package/src/object.ts +72 -72
- package/src/permission/index.ts +6 -6
- package/src/permission/requestCamera.ts +43 -43
- package/src/permission/requestDeviceOrientationControl.ts +33 -33
- package/src/response/index.ts +45 -45
- package/src/string/formatNumber.ts +12 -12
- package/src/string/generatePassword.ts +18 -18
- package/src/string/generateUUID.ts +37 -37
- package/src/string/index.ts +180 -180
- package/src/string/makeDaySlug.ts +40 -40
- package/src/string/random.ts +24 -24
- package/src/string/trimNull.ts +16 -16
- package/src/string/url.ts +116 -116
- package/dist/Checker.js.map +0 -1
- package/dist/EventDispatcher.js.map +0 -1
- package/dist/FileUpload.js.map +0 -1
- package/dist/Slug.js.map +0 -1
- package/dist/Timer.js.map +0 -1
- package/dist/Validation.js.map +0 -1
- package/dist/array.js.map +0 -1
- package/dist/color.js.map +0 -1
- package/dist/console/enableConsole.js.map +0 -1
- package/dist/console/index.js.map +0 -1
- package/dist/console/log.js.map +0 -1
- package/dist/device/browser.js.map +0 -1
- package/dist/device/camera.js.map +0 -1
- package/dist/device/index.js.map +0 -1
- package/dist/device/os.js.map +0 -1
- package/dist/file/createDir.js.map +0 -1
- package/dist/file/fileMove.js.map +0 -1
- package/dist/file/findFilesByExt.js.map +0 -1
- package/dist/file/index.js.map +0 -1
- package/dist/images/index.js.map +0 -1
- package/dist/images/resize.js.map +0 -1
- package/dist/images/upload.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/json.js.map +0 -1
- package/dist/math/diffDate.js.map +0 -1
- package/dist/math/index.js.map +0 -1
- package/dist/math/positiveNumber.js.map +0 -1
- package/dist/name/en.js.map +0 -1
- package/dist/name/index.js.map +0 -1
- package/dist/name/vi.js.map +0 -1
- package/dist/object.js.map +0 -1
- package/dist/permission/index.js.map +0 -1
- package/dist/permission/requestCamera.js.map +0 -1
- package/dist/permission/requestDeviceOrientationControl.js.map +0 -1
- package/dist/response/index.js.map +0 -1
- package/dist/string/formatNumber.js.map +0 -1
- package/dist/string/generatePassword.js.map +0 -1
- package/dist/string/generateUUID.js.map +0 -1
- package/dist/string/index.js.map +0 -1
- package/dist/string/makeDaySlug.js.map +0 -1
- package/dist/string/random.js.map +0 -1
- package/dist/string/trimNull.js.map +0 -1
- package/dist/string/url.js.map +0 -1
- package/esm/Checker.d.ts +0 -8
- package/esm/Checker.js +0 -28
- package/esm/Checker.js.map +0 -1
- package/esm/EventDispatcher.d.ts +0 -13
- package/esm/EventDispatcher.js +0 -49
- package/esm/EventDispatcher.js.map +0 -1
- package/esm/FileUpload.d.ts +0 -12
- package/esm/FileUpload.js +0 -62
- package/esm/FileUpload.js.map +0 -1
- package/esm/Slug.d.ts +0 -9
- package/esm/Slug.js +0 -330
- package/esm/Slug.js.map +0 -1
- package/esm/Timer.d.ts +0 -4
- package/esm/Timer.js +0 -7
- package/esm/Timer.js.map +0 -1
- package/esm/Validation.d.ts +0 -5
- package/esm/Validation.js +0 -37
- package/esm/Validation.js.map +0 -1
- package/esm/array.d.ts +0 -113
- package/esm/array.js +0 -275
- package/esm/array.js.map +0 -1
- package/esm/color.d.ts +0 -23
- package/esm/color.js +0 -80
- package/esm/color.js.map +0 -1
- package/esm/console/enableConsole.d.ts +0 -2
- package/esm/console/enableConsole.js +0 -7
- package/esm/console/enableConsole.js.map +0 -1
- package/esm/console/index.d.ts +0 -11
- package/esm/console/index.js +0 -13
- package/esm/console/index.js.map +0 -1
- package/esm/console/log.d.ts +0 -15
- package/esm/console/log.js +0 -33
- package/esm/console/log.js.map +0 -1
- package/esm/device/browser.d.ts +0 -5
- package/esm/device/browser.js +0 -30
- package/esm/device/browser.js.map +0 -1
- package/esm/device/camera.d.ts +0 -7
- package/esm/device/camera.js +0 -168
- package/esm/device/camera.js.map +0 -1
- package/esm/device/index.d.ts +0 -5
- package/esm/device/index.js +0 -217
- package/esm/device/index.js.map +0 -1
- package/esm/device/os.d.ts +0 -11
- package/esm/device/os.js +0 -28
- package/esm/device/os.js.map +0 -1
- package/esm/file/createDir.d.ts +0 -5
- package/esm/file/createDir.js +0 -13
- package/esm/file/createDir.js.map +0 -1
- package/esm/file/fileMove.d.ts +0 -4
- package/esm/file/fileMove.js +0 -29
- package/esm/file/fileMove.js.map +0 -1
- package/esm/file/findFilesByExt.d.ts +0 -13
- package/esm/file/findFilesByExt.js +0 -46
- package/esm/file/findFilesByExt.js.map +0 -1
- package/esm/file/index.d.ts +0 -9
- package/esm/file/index.js +0 -6
- package/esm/file/index.js.map +0 -1
- package/esm/images/index.d.ts +0 -2
- package/esm/images/index.js +0 -4
- package/esm/images/index.js.map +0 -1
- package/esm/images/resize.d.ts +0 -2
- package/esm/images/resize.js +0 -31
- package/esm/images/resize.js.map +0 -1
- package/esm/images/upload.d.ts +0 -10
- package/esm/images/upload.js +0 -20
- package/esm/images/upload.js.map +0 -1
- package/esm/index.d.ts +0 -37
- package/esm/index.js +0 -38
- package/esm/index.js.map +0 -1
- package/esm/json.d.ts +0 -8
- package/esm/json.js +0 -28
- package/esm/json.js.map +0 -1
- package/esm/math/diffDate.d.ts +0 -5
- package/esm/math/diffDate.js +0 -10
- package/esm/math/diffDate.js.map +0 -1
- package/esm/math/index.d.ts +0 -30
- package/esm/math/index.js +0 -78
- package/esm/math/index.js.map +0 -1
- package/esm/math/positiveNumber.d.ts +0 -2
- package/esm/math/positiveNumber.js +0 -13
- package/esm/math/positiveNumber.js.map +0 -1
- package/esm/name/en.d.ts +0 -5
- package/esm/name/en.js +0 -22
- package/esm/name/en.js.map +0 -1
- package/esm/name/index.d.ts +0 -12
- package/esm/name/index.js +0 -6
- package/esm/name/index.js.map +0 -1
- package/esm/name/vi.d.ts +0 -5
- package/esm/name/vi.js +0 -24
- package/esm/name/vi.js.map +0 -1
- package/esm/object.js +0 -70
- package/esm/object.js.map +0 -1
- package/esm/permission/index.d.ts +0 -8
- package/esm/permission/index.js +0 -5
- package/esm/permission/index.js.map +0 -1
- package/esm/permission/requestCamera.d.ts +0 -5
- package/esm/permission/requestCamera.js +0 -39
- package/esm/permission/requestCamera.js.map +0 -1
- package/esm/permission/requestDeviceOrientationControl.d.ts +0 -2
- package/esm/permission/requestDeviceOrientationControl.js +0 -35
- package/esm/permission/requestDeviceOrientationControl.js.map +0 -1
- package/esm/response/index.d.ts +0 -49
- package/esm/response/index.js +0 -46
- package/esm/response/index.js.map +0 -1
- package/esm/string/formatNumber.d.ts +0 -6
- package/esm/string/formatNumber.js +0 -11
- package/esm/string/formatNumber.js.map +0 -1
- package/esm/string/generatePassword.d.ts +0 -9
- package/esm/string/generatePassword.js +0 -20
- package/esm/string/generatePassword.js.map +0 -1
- package/esm/string/generateUUID.d.ts +0 -2
- package/esm/string/generateUUID.js +0 -33
- package/esm/string/generateUUID.js.map +0 -1
- package/esm/string/index.d.ts +0 -65
- package/esm/string/index.js +0 -150
- package/esm/string/index.js.map +0 -1
- package/esm/string/makeDaySlug.d.ts +0 -31
- package/esm/string/makeDaySlug.js +0 -16
- package/esm/string/makeDaySlug.js.map +0 -1
- package/esm/string/random.d.ts +0 -14
- package/esm/string/random.js +0 -20
- package/esm/string/random.js.map +0 -1
- package/esm/string/trimNull.d.ts +0 -2
- package/esm/string/trimNull.js +0 -14
- package/esm/string/trimNull.js.map +0 -1
- package/esm/string/url.d.ts +0 -36
- package/esm/string/url.js +0 -98
- package/esm/string/url.js.map +0 -1
package/dist/file/createDir.js
CHANGED
|
@@ -1,16 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/file/createDir.ts
|
|
21
|
+
var createDir_exports = {};
|
|
22
|
+
__export(createDir_exports, {
|
|
23
|
+
createDir: () => createDir
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(createDir_exports);
|
|
26
|
+
var fs = require("fs");
|
|
8
27
|
function createDir(path) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
28
|
+
if (fs.existsSync(path)) {
|
|
29
|
+
console.log("directory already exited !");
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
fs.mkdirSync(path, { recursive: true });
|
|
14
33
|
}
|
|
15
|
-
|
|
16
|
-
|
|
34
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
35
|
+
0 && (module.exports = {
|
|
36
|
+
createDir
|
|
37
|
+
});
|
package/dist/file/fileMove.d.ts
CHANGED
package/dist/file/fileMove.js
CHANGED
|
@@ -1,33 +1,53 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/file/fileMove.ts
|
|
21
|
+
var fileMove_exports = {};
|
|
22
|
+
__export(fileMove_exports, {
|
|
23
|
+
fileMove: () => fileMove
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(fileMove_exports);
|
|
26
|
+
var fs = require("fs");
|
|
8
27
|
function fileMove(oldPath, newPath, callback) {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
callback();
|
|
20
|
-
});
|
|
21
|
-
function copy() {
|
|
22
|
-
var readStream = fs.createReadStream(oldPath);
|
|
23
|
-
var writeStream = fs.createWriteStream(newPath);
|
|
24
|
-
readStream.on("error", callback);
|
|
25
|
-
writeStream.on("error", callback);
|
|
26
|
-
readStream.on("close", function () {
|
|
27
|
-
fs.unlink(oldPath, callback);
|
|
28
|
-
});
|
|
29
|
-
readStream.pipe(writeStream);
|
|
28
|
+
fs.rename(oldPath, newPath, function(err) {
|
|
29
|
+
if (err) {
|
|
30
|
+
if (err.code === "EXDEV") {
|
|
31
|
+
copy();
|
|
32
|
+
} else {
|
|
33
|
+
callback(err);
|
|
34
|
+
}
|
|
35
|
+
return;
|
|
30
36
|
}
|
|
37
|
+
callback();
|
|
38
|
+
});
|
|
39
|
+
function copy() {
|
|
40
|
+
var readStream = fs.createReadStream(oldPath);
|
|
41
|
+
var writeStream = fs.createWriteStream(newPath);
|
|
42
|
+
readStream.on("error", callback);
|
|
43
|
+
writeStream.on("error", callback);
|
|
44
|
+
readStream.on("close", function() {
|
|
45
|
+
fs.unlink(oldPath, callback);
|
|
46
|
+
});
|
|
47
|
+
readStream.pipe(writeStream);
|
|
48
|
+
}
|
|
31
49
|
}
|
|
32
|
-
|
|
33
|
-
|
|
50
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
51
|
+
0 && (module.exports = {
|
|
52
|
+
fileMove
|
|
53
|
+
});
|
|
@@ -1,13 +1 @@
|
|
|
1
|
-
|
|
2
|
-
* This is an alias of "findFileByExt()"
|
|
3
|
-
*/
|
|
4
|
-
export declare const forEachFileByExt: (base: string, ext: string, cb: (path: string) => {}) => void;
|
|
5
|
-
/**
|
|
6
|
-
* This is an alias of "forEachFileByExt()"
|
|
7
|
-
*/
|
|
8
|
-
export declare const findFileByExt: (base: string, ext: string, cb: (path: string) => {}) => void;
|
|
9
|
-
declare const fileExt: {
|
|
10
|
-
findFileByExt: (base: string, ext: string, cb: (path: string) => {}) => void;
|
|
11
|
-
forEachFileByExt: (base: string, ext: string, cb: (path: string) => {}) => void;
|
|
12
|
-
};
|
|
13
|
-
export default fileExt;
|
|
1
|
+
export { a as default, c as findFileByExt, b as forEachFileByExt } from '../findFilesByExt-753e91d7.js';
|
|
@@ -1,50 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
Object.defineProperty
|
|
3
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/file/findFilesByExt.ts
|
|
21
|
+
var findFilesByExt_exports = {};
|
|
22
|
+
__export(findFilesByExt_exports, {
|
|
23
|
+
default: () => findFilesByExt_default,
|
|
24
|
+
findFileByExt: () => findFileByExt,
|
|
25
|
+
forEachFileByExt: () => forEachFileByExt
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(findFilesByExt_exports);
|
|
4
28
|
var path = require("path");
|
|
5
29
|
var fs = require("fs");
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (e) {
|
|
14
|
-
console.log("Error: ", e);
|
|
15
|
-
return;
|
|
16
|
-
}
|
|
17
|
-
files.forEach(function (file) {
|
|
18
|
-
var fullPath = path.join(directoryName, file);
|
|
19
|
-
fs.stat(fullPath, function (e, f) {
|
|
20
|
-
if (e) {
|
|
21
|
-
console.log("Error: ", e);
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
if (f.isDirectory()) {
|
|
25
|
-
walk(fullPath);
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
if (fullPath.toLowerCase().indexOf(ext.toLowerCase()) > -1) {
|
|
29
|
-
if (cb)
|
|
30
|
-
cb(fullPath);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
catch (error) {
|
|
38
|
-
console.log("error", error);
|
|
30
|
+
var forEachFileByExt = (base, ext, cb) => {
|
|
31
|
+
var walk = function(directoryName) {
|
|
32
|
+
try {
|
|
33
|
+
fs.readdir(directoryName, function(e, files) {
|
|
34
|
+
if (e) {
|
|
35
|
+
console.log("Error: ", e);
|
|
36
|
+
return;
|
|
39
37
|
}
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
files.forEach(function(file) {
|
|
39
|
+
var fullPath = path.join(directoryName, file);
|
|
40
|
+
fs.stat(fullPath, function(e2, f) {
|
|
41
|
+
if (e2) {
|
|
42
|
+
console.log("Error: ", e2);
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
if (f.isDirectory()) {
|
|
46
|
+
walk(fullPath);
|
|
47
|
+
} else {
|
|
48
|
+
if (fullPath.toLowerCase().indexOf(ext.toLowerCase()) > -1) {
|
|
49
|
+
if (cb)
|
|
50
|
+
cb(fullPath);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
} catch (error) {
|
|
57
|
+
console.log("error", error);
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
walk(base);
|
|
42
61
|
};
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
exports
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
62
|
+
var findFileByExt = forEachFileByExt;
|
|
63
|
+
var fileExt = { findFileByExt, forEachFileByExt };
|
|
64
|
+
var findFilesByExt_default = fileExt;
|
|
65
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
66
|
+
0 && (module.exports = {
|
|
67
|
+
findFileByExt,
|
|
68
|
+
forEachFileByExt
|
|
69
|
+
});
|
package/dist/file/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
import { createDir } from
|
|
2
|
-
import { fileMove } from
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { a as createDir } from '../createDir-220e0081.js';
|
|
2
|
+
import { a as fileMove } from '../fileMove-3a09e429.js';
|
|
3
|
+
|
|
4
|
+
declare const xfile: {
|
|
5
|
+
findFileByExt: (base: string, ext: string, cb: (path: string) => {}) => void;
|
|
6
|
+
forEachFileByExt: (base: string, ext: string, cb: (path: string) => {}) => void;
|
|
7
|
+
createDir: typeof createDir;
|
|
8
|
+
fileMove: typeof fileMove;
|
|
8
9
|
};
|
|
9
|
-
|
|
10
|
+
|
|
11
|
+
export { xfile as default };
|
package/dist/file/index.js
CHANGED
|
@@ -1,11 +1,106 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var
|
|
3
|
-
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
4
9
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/file/index.ts
|
|
21
|
+
var file_exports = {};
|
|
22
|
+
__export(file_exports, {
|
|
23
|
+
default: () => file_default
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(file_exports);
|
|
26
|
+
|
|
27
|
+
// src/file/createDir.ts
|
|
28
|
+
var fs = require("fs");
|
|
29
|
+
function createDir(path2) {
|
|
30
|
+
if (fs.existsSync(path2)) {
|
|
31
|
+
console.log("directory already exited !");
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
fs.mkdirSync(path2, { recursive: true });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// src/file/fileMove.ts
|
|
38
|
+
var fs2 = require("fs");
|
|
39
|
+
function fileMove(oldPath, newPath, callback) {
|
|
40
|
+
fs2.rename(oldPath, newPath, function(err) {
|
|
41
|
+
if (err) {
|
|
42
|
+
if (err.code === "EXDEV") {
|
|
43
|
+
copy();
|
|
44
|
+
} else {
|
|
45
|
+
callback(err);
|
|
46
|
+
}
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
callback();
|
|
50
|
+
});
|
|
51
|
+
function copy() {
|
|
52
|
+
var readStream = fs2.createReadStream(oldPath);
|
|
53
|
+
var writeStream = fs2.createWriteStream(newPath);
|
|
54
|
+
readStream.on("error", callback);
|
|
55
|
+
writeStream.on("error", callback);
|
|
56
|
+
readStream.on("close", function() {
|
|
57
|
+
fs2.unlink(oldPath, callback);
|
|
58
|
+
});
|
|
59
|
+
readStream.pipe(writeStream);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// src/file/findFilesByExt.ts
|
|
64
|
+
var path = require("path");
|
|
65
|
+
var fs3 = require("fs");
|
|
66
|
+
var forEachFileByExt = (base, ext, cb) => {
|
|
67
|
+
var walk = function(directoryName) {
|
|
68
|
+
try {
|
|
69
|
+
fs3.readdir(directoryName, function(e, files) {
|
|
70
|
+
if (e) {
|
|
71
|
+
console.log("Error: ", e);
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
files.forEach(function(file) {
|
|
75
|
+
var fullPath = path.join(directoryName, file);
|
|
76
|
+
fs3.stat(fullPath, function(e2, f) {
|
|
77
|
+
if (e2) {
|
|
78
|
+
console.log("Error: ", e2);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
if (f.isDirectory()) {
|
|
82
|
+
walk(fullPath);
|
|
83
|
+
} else {
|
|
84
|
+
if (fullPath.toLowerCase().indexOf(ext.toLowerCase()) > -1) {
|
|
85
|
+
if (cb)
|
|
86
|
+
cb(fullPath);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
} catch (error) {
|
|
93
|
+
console.log("error", error);
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
walk(base);
|
|
97
|
+
};
|
|
98
|
+
var findFileByExt = forEachFileByExt;
|
|
99
|
+
var fileExt = { findFileByExt, forEachFileByExt };
|
|
100
|
+
var findFilesByExt_default = fileExt;
|
|
101
|
+
|
|
102
|
+
// src/file/index.ts
|
|
103
|
+
var xfile = { createDir, fileMove, ...findFilesByExt_default };
|
|
104
|
+
var file_default = xfile;
|
|
105
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
106
|
+
0 && (module.exports = {});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createDir
|
|
3
|
+
} from "../chunk-X3IMFCZG.mjs";
|
|
4
|
+
import {
|
|
5
|
+
fileMove
|
|
6
|
+
} from "../chunk-IA7GINWD.mjs";
|
|
7
|
+
import {
|
|
8
|
+
findFilesByExt_default
|
|
9
|
+
} from "../chunk-PNZ4KGXL.mjs";
|
|
10
|
+
import "../chunk-ZHNGZMRD.mjs";
|
|
11
|
+
|
|
12
|
+
// src/file/index.ts
|
|
13
|
+
var xfile = { createDir, fileMove, ...findFilesByExt_default };
|
|
14
|
+
var file_default = xfile;
|
|
15
|
+
export {
|
|
16
|
+
file_default as default
|
|
17
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Move file to another location.
|
|
3
|
+
*/
|
|
4
|
+
declare function fileMove(oldPath: string, newPath: string, callback: any): void;
|
|
5
|
+
|
|
6
|
+
declare const fileMove$1_fileMove: typeof fileMove;
|
|
7
|
+
declare namespace fileMove$1 {
|
|
8
|
+
export {
|
|
9
|
+
fileMove$1_fileMove as fileMove,
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export { fileMove as a, fileMove$1 as f };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This is an alias of "findFileByExt()"
|
|
3
|
+
*/
|
|
4
|
+
declare const forEachFileByExt: (base: string, ext: string, cb: (path: string) => {}) => void;
|
|
5
|
+
/**
|
|
6
|
+
* This is an alias of "forEachFileByExt()"
|
|
7
|
+
*/
|
|
8
|
+
declare const findFileByExt: (base: string, ext: string, cb: (path: string) => {}) => void;
|
|
9
|
+
declare const fileExt: {
|
|
10
|
+
findFileByExt: (base: string, ext: string, cb: (path: string) => {}) => void;
|
|
11
|
+
forEachFileByExt: (base: string, ext: string, cb: (path: string) => {}) => void;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
declare const findFilesByExt_findFileByExt: typeof findFileByExt;
|
|
15
|
+
declare const findFilesByExt_forEachFileByExt: typeof forEachFileByExt;
|
|
16
|
+
declare namespace findFilesByExt {
|
|
17
|
+
export {
|
|
18
|
+
fileExt as default,
|
|
19
|
+
findFilesByExt_findFileByExt as findFileByExt,
|
|
20
|
+
findFilesByExt_forEachFileByExt as forEachFileByExt,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export { fileExt as a, forEachFileByExt as b, findFileByExt as c, findFilesByExt as f };
|
package/dist/images/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { upload } from
|
|
2
|
-
export { resize } from
|
|
1
|
+
export { default as upload } from './upload.js';
|
|
2
|
+
export { default as resize } from './resize.js';
|
package/dist/images/index.js
CHANGED
|
@@ -1,9 +1,132 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
var
|
|
8
|
-
|
|
9
|
-
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
22
|
+
mod
|
|
23
|
+
));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
|
|
26
|
+
// src/images/index.ts
|
|
27
|
+
var images_exports = {};
|
|
28
|
+
__export(images_exports, {
|
|
29
|
+
resize: () => resize,
|
|
30
|
+
upload: () => upload
|
|
31
|
+
});
|
|
32
|
+
module.exports = __toCommonJS(images_exports);
|
|
33
|
+
|
|
34
|
+
// src/response/index.ts
|
|
35
|
+
var getFailedResponse = (...messages) => {
|
|
36
|
+
if (!messages)
|
|
37
|
+
messages = ["What's do you want?"];
|
|
38
|
+
return { status: 0, error: true, messages: [...messages], data: {} };
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// src/images/resize.ts
|
|
42
|
+
var import_blueimp_load_image = __toESM(require("blueimp-load-image"));
|
|
43
|
+
var resize = async (file) => {
|
|
44
|
+
if (!file) {
|
|
45
|
+
console.error("NO FILE AVAIABLE!");
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const { type } = file;
|
|
49
|
+
const data = await (0, import_blueimp_load_image.default)(file, {
|
|
50
|
+
meta: false,
|
|
51
|
+
canvas: true,
|
|
52
|
+
maxWidth: 2048,
|
|
53
|
+
maxHeight: 2048
|
|
54
|
+
});
|
|
55
|
+
const blob = await new Promise(function(resolve) {
|
|
56
|
+
try {
|
|
57
|
+
const canvas = data.image;
|
|
58
|
+
canvas.toBlob(function(blob2) {
|
|
59
|
+
resolve(blob2);
|
|
60
|
+
}, type);
|
|
61
|
+
} catch (error) {
|
|
62
|
+
console.error(`diginext-utils/src/images/resize.ts canvas.toBlob error`, error);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
if (blob)
|
|
66
|
+
return blob;
|
|
67
|
+
return data;
|
|
68
|
+
};
|
|
69
|
+
var resize_default = resize;
|
|
70
|
+
|
|
71
|
+
// src/object.ts
|
|
72
|
+
var isNull = (object) => {
|
|
73
|
+
if (typeof object == "undefined")
|
|
74
|
+
return true;
|
|
75
|
+
if (object == "")
|
|
76
|
+
return true;
|
|
77
|
+
if (Array.isArray(object))
|
|
78
|
+
return object.length == 0;
|
|
79
|
+
if (JSON.stringify(object) == "{}")
|
|
80
|
+
return true;
|
|
81
|
+
return object == null;
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
// src/string/url.ts
|
|
85
|
+
var getFileNameWithExtension = (url) => {
|
|
86
|
+
var _a, _b;
|
|
87
|
+
const _url = decodeURIComponent(url);
|
|
88
|
+
const m = _url.toString().match(/.*\/(.*)$/) || [];
|
|
89
|
+
if (typeof m != "undefined" && (m == null ? void 0 : m.length) > 1) {
|
|
90
|
+
const a = ((_a = m == null ? void 0 : m[1].split("/")) == null ? void 0 : _a.pop()) || "";
|
|
91
|
+
const b = (_b = a.split("?")) == null ? void 0 : _b.shift();
|
|
92
|
+
return b || (m == null ? void 0 : m[1]) || "";
|
|
93
|
+
}
|
|
94
|
+
if (!isNull(_url))
|
|
95
|
+
return url;
|
|
96
|
+
return "";
|
|
97
|
+
};
|
|
98
|
+
var getFileExtension = (url) => {
|
|
99
|
+
return getFileNameWithExtension(url).split(".").pop();
|
|
100
|
+
};
|
|
101
|
+
var isImage = (url) => {
|
|
102
|
+
if (!url)
|
|
103
|
+
return false;
|
|
104
|
+
const arr = ["png", "jpg", "jpeg", "jpe", "jif", "jfif", "gif", "svg"];
|
|
105
|
+
const index = arr.findIndex((item) => {
|
|
106
|
+
var _a;
|
|
107
|
+
return ((_a = getFileExtension(url)) == null ? void 0 : _a.toLowerCase()) == item;
|
|
108
|
+
});
|
|
109
|
+
return index >= 0;
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
// src/images/upload.ts
|
|
113
|
+
var upload = async (file) => {
|
|
114
|
+
const { name } = file;
|
|
115
|
+
if (!isImage(name)) {
|
|
116
|
+
const err = "Please Choose Image!";
|
|
117
|
+
console.error(err);
|
|
118
|
+
return getFailedResponse(err);
|
|
119
|
+
}
|
|
120
|
+
const blob = await resize_default(file);
|
|
121
|
+
const url = URL.createObjectURL(blob);
|
|
122
|
+
blob.name = name;
|
|
123
|
+
return {
|
|
124
|
+
blob,
|
|
125
|
+
url
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
129
|
+
0 && (module.exports = {
|
|
130
|
+
resize,
|
|
131
|
+
upload
|
|
132
|
+
});
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
upload
|
|
3
|
+
} from "../chunk-EGUJQ5VF.mjs";
|
|
4
|
+
import "../chunk-5NTK5JAI.mjs";
|
|
5
|
+
import {
|
|
6
|
+
resize
|
|
7
|
+
} from "../chunk-KMERW6KS.mjs";
|
|
8
|
+
import "../chunk-GNJDIUYM.mjs";
|
|
9
|
+
import "../chunk-KWG5LYNK.mjs";
|
|
10
|
+
import "../chunk-5UEMANWE.mjs";
|
|
11
|
+
import "../chunk-ZHNGZMRD.mjs";
|
|
12
|
+
export {
|
|
13
|
+
resize,
|
|
14
|
+
upload
|
|
15
|
+
};
|