@flystorage/file-storage 1.2.0 → 1.2.1
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/changelog.md
CHANGED
|
@@ -6,7 +6,7 @@ class PathPrefixer {
|
|
|
6
6
|
separator;
|
|
7
7
|
joinFunc;
|
|
8
8
|
prefix = '';
|
|
9
|
-
constructor(prefix = '', separator = '/', joinFunc = node_path_1.join) {
|
|
9
|
+
constructor(prefix = '', separator = '/', joinFunc = node_path_1.posix.join) {
|
|
10
10
|
this.separator = separator;
|
|
11
11
|
this.joinFunc = joinFunc;
|
|
12
12
|
if (prefix.length > 0) {
|
|
@@ -17,7 +17,13 @@ class PathPrefixer {
|
|
|
17
17
|
return this.prefix.length > 0 ? this.joinFunc(this.prefix, path) : path;
|
|
18
18
|
}
|
|
19
19
|
prefixDirectoryPath(path) {
|
|
20
|
-
|
|
20
|
+
let fullPath = this.prefix.length > 0
|
|
21
|
+
? this.joinFunc(this.prefix, path)
|
|
22
|
+
: path;
|
|
23
|
+
if (fullPath.length > 0 && !fullPath.endsWith(this.separator)) {
|
|
24
|
+
fullPath = `${fullPath}${this.separator}`;
|
|
25
|
+
}
|
|
26
|
+
return fullPath;
|
|
21
27
|
}
|
|
22
28
|
stripFilePath(path) {
|
|
23
29
|
return path.substring(this.prefix.length);
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { posix } from 'node:path';
|
|
2
2
|
export class PathPrefixer {
|
|
3
3
|
separator;
|
|
4
4
|
joinFunc;
|
|
5
5
|
prefix = '';
|
|
6
|
-
constructor(prefix = '', separator = '/', joinFunc = join) {
|
|
6
|
+
constructor(prefix = '', separator = '/', joinFunc = posix.join) {
|
|
7
7
|
this.separator = separator;
|
|
8
8
|
this.joinFunc = joinFunc;
|
|
9
9
|
if (prefix.length > 0) {
|
|
@@ -14,7 +14,13 @@ export class PathPrefixer {
|
|
|
14
14
|
return this.prefix.length > 0 ? this.joinFunc(this.prefix, path) : path;
|
|
15
15
|
}
|
|
16
16
|
prefixDirectoryPath(path) {
|
|
17
|
-
|
|
17
|
+
let fullPath = this.prefix.length > 0
|
|
18
|
+
? this.joinFunc(this.prefix, path)
|
|
19
|
+
: path;
|
|
20
|
+
if (fullPath.length > 0 && !fullPath.endsWith(this.separator)) {
|
|
21
|
+
fullPath = `${fullPath}${this.separator}`;
|
|
22
|
+
}
|
|
23
|
+
return fullPath;
|
|
18
24
|
}
|
|
19
25
|
stripFilePath(path) {
|
|
20
26
|
return path.substring(this.prefix.length);
|
package/package.json
CHANGED