exodus-framework 2.0.988 → 2.0.989
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/lib/services/file.d.ts
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
import Service from '../app/classes/service';
|
2
|
+
import * as fs from 'fs';
|
2
3
|
import { TFilePathSettings } from '../contracts/settings';
|
3
4
|
declare class FileService extends Service {
|
4
5
|
onStart(): Promise<boolean>;
|
@@ -8,6 +9,7 @@ declare class FileService extends Service {
|
|
8
9
|
delete(filename: string, destiny: keyof TFilePathSettings): Promise<boolean>;
|
9
10
|
listFiles(origin: keyof TFilePathSettings, cb: (file: string[]) => void): void;
|
10
11
|
getFileBuffer(location: keyof TFilePathSettings, filename: string): Buffer;
|
12
|
+
getFileStream(location: keyof TFilePathSettings, filename: string): fs.ReadStream;
|
11
13
|
}
|
12
14
|
export default FileService;
|
13
15
|
//# sourceMappingURL=file.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/services/file.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,wBAAwB,CAAC;
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../src/services/file.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,wBAAwB,CAAC;AAE7C,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAGzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,uBAAuB,CAAC;AAG1D,cAAM,WAAY,SAAQ,OAAO;IAClB,OAAO;YAKN,UAAU;YAKV,SAAS;IASjB,IAAI,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,iBAAiB;IAavD,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,iBAAiB;IAW/D,SAAS,CAAC,MAAM,EAAE,MAAM,iBAAiB,EAAE,EAAE,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,IAAI;IAKhE,aAAa,CAAC,QAAQ,EAAE,MAAM,iBAAiB,EAAE,QAAQ,EAAE,MAAM;IAUjE,aAAa,CAAC,QAAQ,EAAE,MAAM,iBAAiB,EAAE,QAAQ,EAAE,MAAM;CASzE;AACD,eAAe,WAAW,CAAC"}
|
package/lib/services/file.js
CHANGED
@@ -69,5 +69,13 @@ class FileService extends _service.default {
|
|
69
69
|
const file = (0, _fs.readFileSync)(p);
|
70
70
|
return file;
|
71
71
|
}
|
72
|
+
getFileStream(location, filename) {
|
73
|
+
const p = _app.Core.settings.getAppication().filePaths[location] + '/' + filename;
|
74
|
+
if (!fs.existsSync(p)) {
|
75
|
+
return;
|
76
|
+
}
|
77
|
+
const file = fs.createReadStream(p);
|
78
|
+
return file;
|
79
|
+
}
|
72
80
|
}
|
73
81
|
var _default = exports.default = FileService;
|