@ostro/filesystem 0.0.0-alpha.4 → 1.0.2
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/filesystem.js +0 -2
- package/filesystemAdapter.js +6 -6
- package/filesystemManager.js +5 -5
- package/filesystemServiceProvider.js +1 -0
- package/package.json +7 -4
package/filesystem.js
CHANGED
package/filesystemAdapter.js
CHANGED
|
@@ -38,8 +38,9 @@ class FilesystemAdapter {
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
delete($path, ...rest) {
|
|
41
|
-
|
|
42
|
-
let
|
|
41
|
+
rest = Array.from(rest)
|
|
42
|
+
let callback = rest.find(arg => typeof arg == 'function')
|
|
43
|
+
let options = rest.find(arg => typeof arg == 'object') || {}
|
|
43
44
|
if (callback)
|
|
44
45
|
return this[kAdapter].delete($path, options, callback)
|
|
45
46
|
else {
|
|
@@ -68,7 +69,7 @@ class FilesystemAdapter {
|
|
|
68
69
|
}
|
|
69
70
|
|
|
70
71
|
put($path, content, options = {}) {
|
|
71
|
-
|
|
72
|
+
|
|
72
73
|
return new Promise((resolve, reject) => {
|
|
73
74
|
this[kAdapter].write($path, content, options, (err, data, basePath) => {
|
|
74
75
|
if (err) {
|
|
@@ -81,12 +82,11 @@ class FilesystemAdapter {
|
|
|
81
82
|
}
|
|
82
83
|
|
|
83
84
|
putFile($path, $file, $options = {}) {
|
|
84
|
-
$
|
|
85
|
-
return this.putFileAs($path, $file, $options);
|
|
85
|
+
return this.putFileAs($path, $file, $file.getHashname(), $options);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
putFileAs($path, $file, $name, $options = {}) {
|
|
89
|
-
$path = path.join($path
|
|
89
|
+
$path = path.join($path, $name)
|
|
90
90
|
return this.put($path, $file.getBufferData(), $options);
|
|
91
91
|
}
|
|
92
92
|
|
package/filesystemManager.js
CHANGED
|
@@ -8,7 +8,7 @@ class FileSystemManager extends Manager {
|
|
|
8
8
|
|
|
9
9
|
$type = 'filesystem';
|
|
10
10
|
|
|
11
|
-
constructor($app){
|
|
11
|
+
constructor($app) {
|
|
12
12
|
super($app)
|
|
13
13
|
this[kHandler] = this.getConfig('handler')
|
|
14
14
|
if (typeof this[kHandler] != 'function' || typeof this[kHandler] != 'object') {
|
|
@@ -43,7 +43,7 @@ class FileSystemManager extends Manager {
|
|
|
43
43
|
return super.resolve($name, $config)
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
createLocalDriver($config) {
|
|
48
48
|
return this.adapt(new(require('./adapter/local'))($config['root'], $config), $config);
|
|
49
49
|
}
|
|
@@ -57,7 +57,7 @@ class FileSystemManager extends Manager {
|
|
|
57
57
|
}
|
|
58
58
|
|
|
59
59
|
adapt(adapter, config) {
|
|
60
|
-
return new FilesystemAdapter(adapter,this[kHandler]);
|
|
60
|
+
return new FilesystemAdapter(adapter, this[kHandler]);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
getConfig(name) {
|
|
@@ -65,7 +65,7 @@ class FileSystemManager extends Manager {
|
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
getDefaultCloudDriver() {
|
|
68
|
-
return
|
|
68
|
+
return super.getConfig('cloud');
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
registerToRequest(FileRequest) {
|
|
@@ -82,7 +82,7 @@ class FileSystemManager extends Manager {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
}
|
|
85
|
-
|
|
85
|
+
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
module.exports = FileSystemManager
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ostro/filesystem",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "filesystem module for OstroJS",
|
|
5
5
|
"main": "filesystemManager.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
8
|
},
|
|
9
9
|
"dependencies": {
|
|
10
|
-
"@ostro/
|
|
11
|
-
"@ostro/
|
|
10
|
+
"@ostro/support": "^1.0.2",
|
|
11
|
+
"@ostro/contracts": "^1.0.0",
|
|
12
12
|
"fs-extra": "^10.0.0",
|
|
13
13
|
"lodash.get": "^4.4.2",
|
|
14
14
|
"filehound": "^1.17.4",
|
|
@@ -19,7 +19,10 @@
|
|
|
19
19
|
},
|
|
20
20
|
"engineStrict": true,
|
|
21
21
|
"keywords": [
|
|
22
|
-
"filesystem"
|
|
22
|
+
"filesystem",
|
|
23
|
+
"storage",
|
|
24
|
+
"NodeJS Filesystem",
|
|
25
|
+
"OstroJS Filesystem"
|
|
23
26
|
],
|
|
24
27
|
"author": "amar",
|
|
25
28
|
"license": "MIT",
|