@minto-ai/tools 1.0.34 → 1.0.36
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/dist/file/index.d.ts +4 -3
- package/dist/index.js +10 -2
- package/package.json +1 -1
package/dist/file/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DocumentFileSuffix, FileSuffix, ImageFileSuffix, PptFileSuffix, VideoFileSuffix } from './types';
|
|
1
|
+
import { DocumentFileSuffix, FileSuffix, ImageFileSuffix, MusicFileSuffix, PptFileSuffix, VideoFileSuffix } from './types';
|
|
2
2
|
import { default as batchDownloadFile } from './batch-download-file';
|
|
3
3
|
import { FileSuffixEnum, ImageFileSuffixEnum } from './extends/enum';
|
|
4
4
|
import { default as getFileIcon } from './get-file-icon';
|
|
@@ -9,8 +9,9 @@ import { default as getFileTitle } from './get-file-title';
|
|
|
9
9
|
import { default as isDocumentFilePath } from './is-document-file-path';
|
|
10
10
|
import { default as isFilePath } from './is-file-path';
|
|
11
11
|
import { default as isImageFilePath } from './is-image-file-path';
|
|
12
|
+
import { default as isMusicFilePath } from './is-music-file-path';
|
|
12
13
|
import { default as isPptFilePath } from './is-ppt-file-path';
|
|
13
14
|
import { default as isVideoFilePath } from './is-video-file-path';
|
|
14
15
|
import { default as singleDownloadFile } from './single-download-file';
|
|
15
|
-
export type { DocumentFileSuffix, FileSuffix, ImageFileSuffix, PptFileSuffix, VideoFileSuffix, };
|
|
16
|
-
export { batchDownloadFile, FileSuffixEnum, getFileIcon, getFileName, getFileSuffix, getFileSuffixIcon, getFileTitle, ImageFileSuffixEnum, isDocumentFilePath, isFilePath, isImageFilePath, isPptFilePath, isVideoFilePath, singleDownloadFile, };
|
|
16
|
+
export type { DocumentFileSuffix, FileSuffix, ImageFileSuffix, MusicFileSuffix, PptFileSuffix, VideoFileSuffix, };
|
|
17
|
+
export { batchDownloadFile, FileSuffixEnum, getFileIcon, getFileName, getFileSuffix, getFileSuffixIcon, getFileTitle, ImageFileSuffixEnum, isDocumentFilePath, isFilePath, isImageFilePath, isMusicFilePath, isPptFilePath, isVideoFilePath, singleDownloadFile, };
|
package/dist/index.js
CHANGED
|
@@ -147,9 +147,9 @@ const DocumentFileSuffixEnum = {
|
|
|
147
147
|
XLS: FileSuffixEnum.XLS,
|
|
148
148
|
XLSX: FileSuffixEnum.XLSX
|
|
149
149
|
};
|
|
150
|
-
|
|
150
|
+
const MusicFileSuffixEnum = {
|
|
151
151
|
MP3: FileSuffixEnum.MP3
|
|
152
|
-
}
|
|
152
|
+
};
|
|
153
153
|
const filePathRegex = new RegExp(`(.*?)([^/.]*?)(\\.(${Object.values(FileSuffixEnum).join("|")}))?$`, "i");
|
|
154
154
|
function getFileSuffix(filePath) {
|
|
155
155
|
var _a, _b;
|
|
@@ -277,6 +277,13 @@ function isImageFilePath(filePath) {
|
|
|
277
277
|
const fileSuffix = getFileSuffix(filePath);
|
|
278
278
|
return Object.values(ImageFileSuffixEnum).includes(fileSuffix);
|
|
279
279
|
}
|
|
280
|
+
function isMusicFilePath(filePath) {
|
|
281
|
+
if (!isFilePath(filePath)) {
|
|
282
|
+
return false;
|
|
283
|
+
}
|
|
284
|
+
const fileSuffix = getFileSuffix(filePath);
|
|
285
|
+
return Object.values(MusicFileSuffixEnum).includes(fileSuffix);
|
|
286
|
+
}
|
|
280
287
|
function isPptFilePath(filePath) {
|
|
281
288
|
if (!isFilePath(filePath)) {
|
|
282
289
|
return false;
|
|
@@ -494,6 +501,7 @@ export {
|
|
|
494
501
|
isImageFilePath,
|
|
495
502
|
isIos,
|
|
496
503
|
isMobile,
|
|
504
|
+
isMusicFilePath,
|
|
497
505
|
isNullOrUndefined,
|
|
498
506
|
isNumber,
|
|
499
507
|
isObject,
|