@minto-ai/tools 1.0.33 → 1.0.35
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.
|
@@ -60,4 +60,10 @@ declare const DocumentFileSuffixEnum: {
|
|
|
60
60
|
readonly XLS: "xls";
|
|
61
61
|
readonly XLSX: "xlsx";
|
|
62
62
|
};
|
|
63
|
-
|
|
63
|
+
/**
|
|
64
|
+
* 音乐文件后缀类型枚举
|
|
65
|
+
*/
|
|
66
|
+
declare const MusicFileSuffixEnum: {
|
|
67
|
+
readonly MP3: "mp3";
|
|
68
|
+
};
|
|
69
|
+
export { DocumentFileSuffixEnum, FileSuffixEnum, ImageFileSuffixEnum, MusicFileSuffixEnum, PptFileSuffixEnum, VideoFileSuffixEnum, };
|
package/dist/file/index.d.ts
CHANGED
|
@@ -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
16
|
export type { DocumentFileSuffix, FileSuffix, ImageFileSuffix, PptFileSuffix, VideoFileSuffix, };
|
|
16
|
-
export { batchDownloadFile, FileSuffixEnum, getFileIcon, getFileName, getFileSuffix, getFileSuffixIcon, getFileTitle, ImageFileSuffixEnum, isDocumentFilePath, isFilePath, isImageFilePath, isPptFilePath, isVideoFilePath, singleDownloadFile, };
|
|
17
|
+
export { batchDownloadFile, FileSuffixEnum, getFileIcon, getFileName, getFileSuffix, getFileSuffixIcon, getFileTitle, ImageFileSuffixEnum, isDocumentFilePath, isFilePath, isImageFilePath, isMusicFilePath, isPptFilePath, isVideoFilePath, singleDownloadFile, };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { DocumentFileSuffixEnum, FileSuffixEnum, ImageFileSuffixEnum, PptFileSuffixEnum, VideoFileSuffixEnum } from '../extends/enum';
|
|
1
|
+
import { DocumentFileSuffixEnum, FileSuffixEnum, ImageFileSuffixEnum, MusicFileSuffixEnum, PptFileSuffixEnum, VideoFileSuffixEnum } from '../extends/enum';
|
|
2
2
|
type FileSuffix = (typeof FileSuffixEnum)[keyof typeof FileSuffixEnum];
|
|
3
3
|
type ImageFileSuffix = (typeof ImageFileSuffixEnum)[keyof typeof ImageFileSuffixEnum];
|
|
4
4
|
type VideoFileSuffix = (typeof VideoFileSuffixEnum)[keyof typeof VideoFileSuffixEnum];
|
|
5
5
|
type PptFileSuffix = (typeof PptFileSuffixEnum)[keyof typeof PptFileSuffixEnum];
|
|
6
6
|
type DocumentFileSuffix = (typeof DocumentFileSuffixEnum)[keyof typeof DocumentFileSuffixEnum];
|
|
7
|
-
|
|
7
|
+
type MusicFileSuffix = (typeof MusicFileSuffixEnum)[keyof typeof MusicFileSuffixEnum];
|
|
8
|
+
export type { DocumentFileSuffix, FileSuffix, ImageFileSuffix, MusicFileSuffix, PptFileSuffix, VideoFileSuffix, };
|
package/dist/index.js
CHANGED
|
@@ -147,6 +147,9 @@ const DocumentFileSuffixEnum = {
|
|
|
147
147
|
XLS: FileSuffixEnum.XLS,
|
|
148
148
|
XLSX: FileSuffixEnum.XLSX
|
|
149
149
|
};
|
|
150
|
+
const MusicFileSuffixEnum = {
|
|
151
|
+
MP3: FileSuffixEnum.MP3
|
|
152
|
+
};
|
|
150
153
|
const filePathRegex = new RegExp(`(.*?)([^/.]*?)(\\.(${Object.values(FileSuffixEnum).join("|")}))?$`, "i");
|
|
151
154
|
function getFileSuffix(filePath) {
|
|
152
155
|
var _a, _b;
|
|
@@ -274,6 +277,13 @@ function isImageFilePath(filePath) {
|
|
|
274
277
|
const fileSuffix = getFileSuffix(filePath);
|
|
275
278
|
return Object.values(ImageFileSuffixEnum).includes(fileSuffix);
|
|
276
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
|
+
}
|
|
277
287
|
function isPptFilePath(filePath) {
|
|
278
288
|
if (!isFilePath(filePath)) {
|
|
279
289
|
return false;
|
|
@@ -491,6 +501,7 @@ export {
|
|
|
491
501
|
isImageFilePath,
|
|
492
502
|
isIos,
|
|
493
503
|
isMobile,
|
|
504
|
+
isMusicFilePath,
|
|
494
505
|
isNullOrUndefined,
|
|
495
506
|
isNumber,
|
|
496
507
|
isObject,
|