doomistorage 1.0.9 → 2.0.0

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/cosfile.js DELETED
@@ -1,131 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.CosFile = void 0;
16
- const file_1 = require("./file");
17
- const cos_nodejs_sdk_v5_1 = __importDefault(require("cos-nodejs-sdk-v5"));
18
- class CosFile extends file_1.FileBase {
19
- constructor(config) {
20
- super();
21
- this.cos = new cos_nodejs_sdk_v5_1.default({
22
- SecretId: config.SecretId,
23
- SecretKey: config.SecretKey
24
- });
25
- this.bucket = config.bucket;
26
- this.region = config.region;
27
- }
28
- /**
29
- *
30
- * @param data
31
- * @param fileName
32
- * @param saveOption
33
- * @param userInfo
34
- */
35
- saveString2File(data, fileName, saveOption, userInfo = {}) {
36
- if (!data)
37
- data = '';
38
- let destinationFileName = this.getSaveFileName(saveOption, fileName, userInfo);
39
- const streamBuffer = data instanceof Buffer ? data : Buffer.from(data, "utf-8");
40
- const fileParam = {
41
- Bucket: this.bucket,
42
- Region: this.region,
43
- Key: destinationFileName,
44
- Body: streamBuffer,
45
- ContentLength: streamBuffer.byteLength
46
- };
47
- return new Promise((success) => {
48
- this.cos.putObject(fileParam, (err) => {
49
- return success({ successed: err == null, filePath: destinationFileName });
50
- });
51
- });
52
- }
53
- /**
54
- *
55
- * @param file
56
- * @param fileName
57
- * @param saveOption
58
- * @param userInfo
59
- * @returns
60
- */
61
- saveFileStream(file, fileName, saveOption, userInfo) {
62
- return __awaiter(this, void 0, void 0, function* () {
63
- const destinationFileName = this.getSaveFileName(saveOption, fileName, userInfo);
64
- return new Promise((resolve) => {
65
- if (saveOption.reRead) {
66
- let dataArr = [], //存储读取的结果集合
67
- len = 0;
68
- file.on('data', (chunk) => {
69
- dataArr.push(chunk);
70
- len += chunk.length;
71
- });
72
- file.on('end', () => {
73
- const fileParam = {
74
- Bucket: this.bucket,
75
- Region: this.region,
76
- Key: destinationFileName,
77
- Body: Buffer.concat(dataArr, len),
78
- ContentLength: len // file.byteCount || saveOption.contentLength
79
- };
80
- this.cos.putObject(fileParam, (err) => {
81
- return resolve({ successed: err == null, filePath: destinationFileName });
82
- });
83
- });
84
- }
85
- else {
86
- const fileParam = {
87
- Bucket: this.bucket,
88
- Region: this.region,
89
- // ContentDisposition: "form-data; name=\"file\"; filename=\"" + encodeURIComponent(destinationFileName) + "\"",
90
- Key: destinationFileName,
91
- Body: file,
92
- ContentLength: file.byteCount || file.length
93
- };
94
- this.cos.putObject(fileParam, function (err) {
95
- return resolve({ successed: err == null, filePath: destinationFileName });
96
- });
97
- }
98
- });
99
- });
100
- }
101
- /**
102
- * 删除指定位置的文件
103
- * @param filepath
104
- */
105
- deleteFile(filepath) {
106
- return __awaiter(this, void 0, void 0, function* () {
107
- return new Promise(reslove => {
108
- ///如果是数组,则一次性删除多个文件
109
- if (Array.isArray(filepath)) {
110
- const params = {
111
- Bucket: this.bucket,
112
- Region: this.region,
113
- Objects: filepath.map(item => { return { Key: item }; }),
114
- };
115
- return this.cos.deleteMultipleObject(params, (err) => {
116
- return reslove({ successed: err == null, error: err });
117
- });
118
- }
119
- const params = {
120
- Bucket: this.bucket,
121
- Region: this.region,
122
- Key: filepath,
123
- };
124
- this.cos.deleteObject(params, (err) => {
125
- return reslove({ successed: err == null, error: err });
126
- });
127
- });
128
- });
129
- }
130
- }
131
- exports.CosFile = CosFile;
package/dist/declare.d.ts DELETED
@@ -1,16 +0,0 @@
1
- export interface FileConfig {
2
- 'subFolder': string;
3
- 'saveDir': string;
4
- 'fileName': string;
5
- 'reRead'?: boolean;
6
- 'basefolder'?: string;
7
- }
8
- /**
9
- * 文件的API
10
- */
11
- export interface FileResult {
12
- 'successed': boolean;
13
- 'error'?: string;
14
- 'errcode'?: number;
15
- 'filePath'?: string;
16
- }
package/dist/declare.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
package/dist/file.d.ts DELETED
@@ -1,55 +0,0 @@
1
- /// <reference types="node" />
2
- import { FileConfig, FileResult } from './declare';
3
- export declare abstract class FileBase {
4
- /**
5
- * 根据DoomiSoft框架生成的唯一文件名,用户上传后的文件存储后名称,防止重复
6
- * @param {*} saveOption
7
- * @param {*} fileName
8
- * @param {*} userInfo
9
- */
10
- getSaveFileName(saveOption: FileConfig, fileName: string, userInfo?: any): string;
11
- /**
12
- * 获取文件需要保存的目录
13
- * @param {*} saveOption
14
- * @param {*} userInfo
15
- */
16
- getSaveFolder(saveOption: FileConfig, userInfo?: any): string;
17
- /**
18
- * 获取上传的文件仅包含文件名
19
- * @param {*} saveOption
20
- * @param {*} fileName
21
- * @param {*} userInfo
22
- */
23
- getSaveOnlyFileName(saveOption: FileConfig, fileName: string, userInfo?: any): string;
24
- /**
25
- * 保存文件流
26
- * @param fileName
27
- * @param file
28
- * @param saveOption
29
- * @param userInfo
30
- */
31
- abstract saveFileStream(file: any, fileName: string, saveOption: FileConfig, userInfo: any): Promise<FileResult>;
32
- /**
33
- * 直接保存字符
34
- * @param data
35
- * @param fileName
36
- * @param saveOption
37
- * @param userInfo
38
- */
39
- abstract saveString2File(data: string | Buffer, fileName: string, saveOption: FileConfig, userInfo: any): Promise<FileResult>;
40
- /**
41
- * 删除指定位置的文件
42
- * @param filepath
43
- */
44
- abstract deleteFile(filepath: string | string[]): Promise<{
45
- successed: boolean;
46
- error?: any;
47
- }>;
48
- /**
49
- * 创建多级目录
50
- * @param dirpath
51
- * @param mode
52
- * @returns
53
- */
54
- mkdirsSync(dirpath: string, mode?: any): boolean;
55
- }
package/dist/file.js DELETED
@@ -1,116 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.FileBase = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
9
- const moment_1 = __importDefault(require("moment"));
10
- const uuid_1 = require("uuid");
11
- class FileBase {
12
- /**
13
- * 根据DoomiSoft框架生成的唯一文件名,用户上传后的文件存储后名称,防止重复
14
- * @param {*} saveOption
15
- * @param {*} fileName
16
- * @param {*} userInfo
17
- */
18
- getSaveFileName(saveOption, fileName, userInfo = {}) {
19
- let saveFolder = this.getSaveFolder(saveOption, userInfo);
20
- // console.log('getSaveFileName', fileName)
21
- let _fileName = this.getSaveOnlyFileName(saveOption, fileName, userInfo);
22
- return path_1.default.join(saveFolder, _fileName);
23
- }
24
- /**
25
- * 获取文件需要保存的目录
26
- * @param {*} saveOption
27
- * @param {*} userInfo
28
- */
29
- getSaveFolder(saveOption, userInfo = {}) {
30
- var _a;
31
- let subFolder = '';
32
- ///分目录存储
33
- switch ((saveOption.subFolder || '').toLowerCase()) {
34
- ///按日建造一个目录
35
- case 'onebydate':
36
- subFolder = (0, moment_1.default)().format('YYYYMMDD');
37
- break;
38
- ///按日建造多级目录
39
- case 'mutilbydate':
40
- subFolder = (0, moment_1.default)().year() + path_1.default.sep + (0, moment_1.default)().month() + path_1.default.sep + (0, moment_1.default)().day();
41
- break;
42
- ///用自己的id(当前登录的id)建造目录
43
- case 'identity':
44
- subFolder = (_a = userInfo.id) !== null && _a !== void 0 ? _a : (0, uuid_1.v4)();
45
- break;
46
- }
47
- let saveFolder = path_1.default.join(saveOption.saveDir, subFolder + '');
48
- if (userInfo && userInfo.subfolder)
49
- saveFolder = path_1.default.join(saveFolder, userInfo.subfolder);
50
- ///如果包含当前调用用户的信息,则替换整个路径中的@@关键字
51
- if (userInfo) {
52
- const matched = saveFolder.match(/@.*?@/g);
53
- if (matched && matched.length > 0)
54
- matched.forEach(ele => {
55
- const matchValue = ele.substring(1, ele.length - 1);
56
- if (matchValue.indexOf(' ') >= 0 || matchValue.indexOf(':') >= 0 || matchValue.indexOf('=') >= 0)
57
- return;
58
- let keyName = ele.substring(1, ele.length - 1);
59
- const keyValue = userInfo[keyName] || '';
60
- saveFolder = saveFolder.replace(ele, keyValue);
61
- });
62
- }
63
- return saveFolder;
64
- }
65
- /**
66
- * 获取上传的文件仅包含文件名
67
- * @param {*} saveOption
68
- * @param {*} fileName
69
- * @param {*} userInfo
70
- */
71
- getSaveOnlyFileName(saveOption, fileName, userInfo = {}) {
72
- var _a;
73
- let _fileName = '';
74
- switch ((saveOption.fileName || 'keep').toLowerCase()) {
75
- ///保持和原有文件一致的文件名
76
- case "keep":
77
- _fileName = fileName;
78
- break;
79
- ///随机命名,但后缀必须一致
80
- case "random":
81
- _fileName = (0, uuid_1.v4)() + path_1.default.extname(fileName);
82
- break;
83
- ///使用当前账号的id命名
84
- case "identity":
85
- _fileName = ((_a = userInfo.id) !== null && _a !== void 0 ? _a : (0, uuid_1.v4)()) + path_1.default.extname(fileName);
86
- break;
87
- }
88
- return _fileName;
89
- }
90
- /**
91
- * 创建多级目录
92
- * @param dirpath
93
- * @param mode
94
- * @returns
95
- */
96
- mkdirsSync(dirpath, mode = null) {
97
- if (!fs_1.default.existsSync(dirpath)) {
98
- let pathtmp = '', splitPath = dirpath.split(path_1.default.sep);
99
- for (const dirname of splitPath) {
100
- if (dirname.length == 0) {
101
- pathtmp = path_1.default.sep;
102
- continue;
103
- }
104
- if (pathtmp)
105
- pathtmp = path_1.default.join(pathtmp, dirname);
106
- else
107
- pathtmp = dirname;
108
- if (!fs_1.default.existsSync(pathtmp)) {
109
- fs_1.default.mkdirSync(pathtmp, mode);
110
- }
111
- }
112
- }
113
- return true;
114
- }
115
- }
116
- exports.FileBase = FileBase;
@@ -1,91 +0,0 @@
1
- import { FileConfig, FileResult } from "./declare";
2
- import { FileBase } from "./file";
3
- /**
4
- * 文件处理器类型
5
- */
6
- export declare const FileProviderEnum: {
7
- readonly LOCAL: "local";
8
- readonly TENCENTCOS: "tencentcos";
9
- };
10
- export type FileProviderEnum = typeof FileProviderEnum[keyof typeof FileProviderEnum];
11
- /**
12
- * 获取到文件处理的对象
13
- * @param destination
14
- * @returns
15
- */
16
- export declare function FileHelper(provider?: FileProviderEnum, apiOption?: any): FileUtility;
17
- /**
18
- * 文件帮助工具
19
- */
20
- declare class FileUtility {
21
- private fileHandler;
22
- constructor(handler: FileBase);
23
- /**
24
- * 读取文件并保存至目标路径
25
- * @param file 文件对象
26
- * @param provider : 文件处理的实例名
27
- * @param fileName :最终需要保存的文件名称
28
- * @param saveOption :
29
- * @param userInfo
30
- * @returns
31
- */
32
- SaveFileStream(fileName: string, file: any, saveOption: FileConfig, userInfo?: any): Promise<FileResult>;
33
- /**
34
- * 保存字符流到对应的存储设备
35
- * @param bufferData
36
- * @param fileName
37
- * @param saveOption
38
- * @param userInfo
39
- * @returns
40
- */
41
- SaveString2File(bufferData: any, fileName: string, saveOption: FileConfig, userInfo?: any): Promise<FileResult>;
42
- /**
43
- * 删除指定位置的文件
44
- * @param filePath
45
- */
46
- DeleteFile(filePath: string | string[]): Promise<{
47
- successed: boolean;
48
- }>;
49
- /**
50
- * 批量下载指定的文件并上传到存储中
51
- * 替代原来file中的对应方法save2localForRemoteImage
52
- * 用于百度UEditor的保存文件
53
- * @param urlArray
54
- * @param saveOption
55
- * @param userInfo
56
- * @returns
57
- */
58
- BatchDownloadImage(urlArray: string[], saveOption: FileConfig, userInfo?: any): Promise<FileResult[]>;
59
- /**
60
- * 下载文件并且保存
61
- * @param saveDestination
62
- * @param fileUrl
63
- * @param savesetting
64
- * @param userinfo
65
- * @param allowWebPFormat
66
- * @returns
67
- */
68
- DownloadFile(fileUrl: string, savefileName: string | null, savesetting: FileConfig, userInfo?: any, allowWebPFormat?: boolean): Promise<FileResult>;
69
- /**
70
- * 预测生成文件保存后的文件路径
71
- * @param saveOption
72
- * @param fileName
73
- * @param userInfo
74
- */
75
- getSaveFileName(saveOption: FileConfig, fileName: string, userInfo?: any): string;
76
- /**
77
- * 预测生成文件保存后的文件路径
78
- * @param saveOption
79
- * @param fileName
80
- * @param userInfo
81
- */
82
- getSaveFolder(saveOption: FileConfig, userInfo?: any): string;
83
- /**
84
- * 预测生成文件保存后的文件名称
85
- * @param saveOption
86
- * @param fileName
87
- * @param userInfo
88
- */
89
- getSaveOnlyFileName(saveOption: FileConfig, fileName: string, userInfo?: any): string;
90
- }
91
- export {};
@@ -1,185 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.FileHelper = exports.FileProviderEnum = void 0;
16
- const cosfile_1 = require("./cosfile");
17
- const localfile_1 = require("./localfile");
18
- const axios_1 = __importDefault(require("axios"));
19
- const path_1 = __importDefault(require("path"));
20
- const fs_1 = __importDefault(require("fs"));
21
- let config;
22
- /**
23
- * 读取系统配置文件的腾讯云设置
24
- * @returns
25
- */
26
- function getConfigurationSetting(settingName, isSection = true) {
27
- var _a;
28
- if (!config) {
29
- let configfilename = process.env["CONFIGFILE"] || 'configuration.json';
30
- let configfile = path_1.default.join(process.cwd(), configfilename);
31
- if (!fs_1.default.existsSync(configfile))
32
- return null;
33
- config = require(configfile);
34
- }
35
- if (!config)
36
- return null;
37
- //const config = require(configfile)[settingName || 'tencentCOS'];
38
- return isSection ? config[settingName || 'tencentCOS'] : ((_a = config.appsetting[settingName || 'destination']) !== null && _a !== void 0 ? _a : 'tencentcos');
39
- }
40
- /**
41
- * 文件处理器类型
42
- */
43
- exports.FileProviderEnum = {
44
- LOCAL: 'local',
45
- TENCENTCOS: 'tencentcos',
46
- };
47
- /**
48
- * 获取到文件处理的对象
49
- * @param destination
50
- * @returns
51
- */
52
- function FileHelper(provider, apiOption) {
53
- if (!provider)
54
- provider = getConfigurationSetting('destination', false);
55
- let filehandler;
56
- switch (provider) {
57
- case exports.FileProviderEnum.LOCAL:
58
- filehandler = new localfile_1.LocalFile();
59
- break;
60
- case exports.FileProviderEnum.TENCENTCOS:
61
- if (!apiOption || typeof (apiOption) == 'string') {
62
- apiOption = getConfigurationSetting(apiOption);
63
- }
64
- filehandler = new cosfile_1.CosFile(apiOption);
65
- break;
66
- default: filehandler = new localfile_1.LocalFile();
67
- }
68
- return new FileUtility(filehandler);
69
- }
70
- exports.FileHelper = FileHelper;
71
- /**
72
- * 文件帮助工具
73
- */
74
- class FileUtility {
75
- constructor(handler) {
76
- this.fileHandler = handler;
77
- }
78
- /**
79
- * 读取文件并保存至目标路径
80
- * @param file 文件对象
81
- * @param provider : 文件处理的实例名
82
- * @param fileName :最终需要保存的文件名称
83
- * @param saveOption :
84
- * @param userInfo
85
- * @returns
86
- */
87
- SaveFileStream(fileName, file, saveOption, userInfo = {}) {
88
- return __awaiter(this, void 0, void 0, function* () {
89
- return yield this.fileHandler.saveFileStream(file, fileName, saveOption, userInfo);
90
- });
91
- }
92
- /**
93
- * 保存字符流到对应的存储设备
94
- * @param bufferData
95
- * @param fileName
96
- * @param saveOption
97
- * @param userInfo
98
- * @returns
99
- */
100
- SaveString2File(bufferData, fileName, saveOption, userInfo = {}) {
101
- return __awaiter(this, void 0, void 0, function* () {
102
- return yield this.fileHandler.saveString2File(bufferData, fileName, saveOption, userInfo);
103
- });
104
- }
105
- /**
106
- * 删除指定位置的文件
107
- * @param filePath
108
- */
109
- DeleteFile(filePath) {
110
- return __awaiter(this, void 0, void 0, function* () {
111
- return yield this.fileHandler.deleteFile(filePath);
112
- });
113
- }
114
- /**
115
- * 批量下载指定的文件并上传到存储中
116
- * 替代原来file中的对应方法save2localForRemoteImage
117
- * 用于百度UEditor的保存文件
118
- * @param urlArray
119
- * @param saveOption
120
- * @param userInfo
121
- * @returns
122
- */
123
- BatchDownloadImage(urlArray, saveOption, userInfo = {}) {
124
- return __awaiter(this, void 0, void 0, function* () {
125
- let promiseArr = [];
126
- for (const url of urlArray) {
127
- promiseArr.push(this.DownloadFile(url, null, saveOption, userInfo));
128
- }
129
- return yield Promise.all(promiseArr);
130
- });
131
- }
132
- /**
133
- * 下载文件并且保存
134
- * @param saveDestination
135
- * @param fileUrl
136
- * @param savesetting
137
- * @param userinfo
138
- * @param allowWebPFormat
139
- * @returns
140
- */
141
- DownloadFile(fileUrl, savefileName, savesetting, userInfo = {}, allowWebPFormat = false) {
142
- return __awaiter(this, void 0, void 0, function* () {
143
- if (!allowWebPFormat && fileUrl.indexOf('&tp=webp') >= 0)
144
- fileUrl = fileUrl.replace('&tp=webp', '');
145
- let fileName = savefileName ? savefileName : path_1.default.basename(fileUrl);
146
- try {
147
- const downloadResult = yield axios_1.default.get(fileUrl, { responseType: 'arraybuffer' });
148
- if (downloadResult.data) {
149
- return this.SaveString2File(downloadResult.data, fileName, savesetting, userInfo);
150
- }
151
- return { successed: false, error: '下载文件中没有任何内容' };
152
- }
153
- catch (error) {
154
- return { successed: false, error: error };
155
- }
156
- });
157
- }
158
- /**
159
- * 预测生成文件保存后的文件路径
160
- * @param saveOption
161
- * @param fileName
162
- * @param userInfo
163
- */
164
- getSaveFileName(saveOption, fileName, userInfo = {}) {
165
- return this.fileHandler.getSaveFileName(saveOption, fileName, userInfo);
166
- }
167
- /**
168
- * 预测生成文件保存后的文件路径
169
- * @param saveOption
170
- * @param fileName
171
- * @param userInfo
172
- */
173
- getSaveFolder(saveOption, userInfo = {}) {
174
- return this.fileHandler.getSaveFolder(saveOption, userInfo);
175
- }
176
- /**
177
- * 预测生成文件保存后的文件名称
178
- * @param saveOption
179
- * @param fileName
180
- * @param userInfo
181
- */
182
- getSaveOnlyFileName(saveOption, fileName, userInfo = {}) {
183
- return this.fileHandler.getSaveOnlyFileName(saveOption, fileName, userInfo);
184
- }
185
- }
package/dist/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './filehelper';
2
- export * from './uploader';
package/dist/index.js DELETED
@@ -1,18 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./filehelper"), exports);
18
- __exportStar(require("./uploader"), exports);
@@ -1,30 +0,0 @@
1
- /// <reference types="node" />
2
- import { FileBase } from "./file";
3
- import { FileConfig, FileResult } from "./declare";
4
- export declare class LocalFile extends FileBase {
5
- /**
6
- * 直接保存字符串
7
- * @param data
8
- * @param fileName
9
- * @param saveOption
10
- * @param userInfo
11
- */
12
- saveString2File(data: string | Buffer, fileName: string, saveOption: FileConfig, userInfo?: any): Promise<FileResult>;
13
- /**
14
- * 读取文件对象并保存至本地存储
15
- * @param file
16
- * @param fileName
17
- * @param saveOption
18
- * @param userInfo
19
- * @returns
20
- */
21
- saveFileStream(file: any, fileName: any, saveOption: FileConfig, userInfo: any): Promise<FileResult>;
22
- /**
23
- * 删除指定文件
24
- * @param filepath
25
- */
26
- deleteFile(filepath: string | string[]): Promise<{
27
- successed: boolean;
28
- error?: any;
29
- }>;
30
- }