1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.LocalUFS = void 0;
|
4 | var fs = require("fs");
|
5 | var app_1 = require("./app");
|
6 | var LocalUFS = (function () {
|
7 | function LocalUFS() {
|
8 | }
|
9 | LocalUFS.prototype.unlink = function (path, cb) {
|
10 | fs.unlink(path, cb);
|
11 | };
|
12 | LocalUFS.prototype.stat = function (path) {
|
13 | return new Promise(function (res, rej) {
|
14 | fs.stat(app_1.app.config.uploadPath + "/" + path, function (err, r) {
|
15 | if (err) {
|
16 | return rej(err);
|
17 | }
|
18 | res(r);
|
19 | });
|
20 | });
|
21 | };
|
22 | LocalUFS.prototype.getToCache = function (path, _) {
|
23 | return new Promise(function (res, _) {
|
24 | return res(app_1.app.config.uploadPath + "/" + path);
|
25 | });
|
26 | };
|
27 | LocalUFS.prototype.uploadFile = function (uploadMedia) {
|
28 | return new Promise(function (res, _) {
|
29 | return res(uploadMedia);
|
30 | });
|
31 | };
|
32 | LocalUFS.prototype.uploadFileFromCache = function (path, cachePath) {
|
33 | return new Promise(function (res, rej) {
|
34 | fs.copyFile(cachePath + "/" + path, app_1.app.config.uploadPath + "/" + path, function (err) {
|
35 | if (err) {
|
36 | return rej(err);
|
37 | }
|
38 | return res();
|
39 | });
|
40 | });
|
41 | };
|
42 | return LocalUFS;
|
43 | }());
|
44 | exports.LocalUFS = LocalUFS;
|