@signageos/front-applet 8.5.2 → 8.5.3
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/bundle.js +1 -1
- package/dist/bundle.js.map +1 -1
- package/docs/fpath/index.md +623 -13
- package/docs/sos_management/network.md +6 -7
- package/es6/FrontApplet/Management/Network/INetwork.d.ts +2 -3
- package/es6/FrontApplet/Management/Network/INetwork.js +1 -1
- package/es6/FrontApplet/Management/Network/INetwork.js.map +1 -1
- package/es6/FrontApplet/Management/Network/Network.d.ts +3 -3
- package/es6/FrontApplet/Management/Network/Network.js +3 -3
- package/es6/fpath.d.ts +46 -11
- package/es6/fpath.js +46 -11
- package/es6/fpath.js.map +1 -1
- package/package.json +1 -1
|
@@ -68,7 +68,7 @@ importCertificate(details: CertificateEapDetails): Promise<void>;
|
|
|
68
68
|
/** Details for importing a certificate for EAP authentication. */
|
|
69
69
|
interface CertificateEapDetails {
|
|
70
70
|
/** Type of EAP authentication */
|
|
71
|
-
type:
|
|
71
|
+
type: EAPMethod;
|
|
72
72
|
/** CA certificate */
|
|
73
73
|
caCertificate?: string;
|
|
74
74
|
/** Client certificate for EAP-TLS */
|
|
@@ -79,8 +79,7 @@ interface CertificateEapDetails {
|
|
|
79
79
|
clientCertificatePassword?: string;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
|
|
83
|
-
type EAPType = 'EAP-TLS' | 'PEAP' | 'EAP-TTLS';
|
|
82
|
+
type EAPMethod = 'PEAP' | 'TLS' | 'TTLS';
|
|
84
83
|
|
|
85
84
|
```
|
|
86
85
|
|
|
@@ -89,7 +88,7 @@ type EAPType = 'EAP-TLS' | 'PEAP' | 'EAP-TTLS';
|
|
|
89
88
|
| Name | Type | Required | Description |
|
|
90
89
|
|-------------------------------------|-------------------------|------------------|-----------------------------------------------------------------------------------|
|
|
91
90
|
| `details` | `CertificateEapDetails` | <div>Yes</div> | The certificate details. |
|
|
92
|
-
| `details.type` | `
|
|
91
|
+
| `details.type` | `EAPMethod` | <div>Yes</div> | The type of the certificate is for. |
|
|
93
92
|
| `details.caCertificate` | `string \| undefined` | <div>No</div> | The CA certificate in PEM format. Required for 'PEAP' and 'EAP-TTLS'. |
|
|
94
93
|
| `details.clientCertificate` | `string \| undefined` | <div>No</div> | The client certificate in PEM format. Required for 'EAP-TLS'. |
|
|
95
94
|
| `details.clientKey` | `string \| undefined` | <div>No</div> | The private key for the client certificate in PEM format. Required for 'EAP-TLS'. |
|
|
@@ -110,7 +109,7 @@ A promise that resolves when the certificate is imported.
|
|
|
110
109
|
```ts
|
|
111
110
|
// Importing an EAP-TLS certificate
|
|
112
111
|
const certDetails = {
|
|
113
|
-
type: '
|
|
112
|
+
type: 'TLS',
|
|
114
113
|
caCertificate: '-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----',
|
|
115
114
|
clientCertificate: '-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----',
|
|
116
115
|
clientKey: '-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----',
|
|
@@ -127,7 +126,7 @@ await sos.management.network.importCertificate(certDetailsEapPeap);
|
|
|
127
126
|
|
|
128
127
|
// Importing an EAP-TTLS certificate
|
|
129
128
|
const certDetailsEapTtls = {
|
|
130
|
-
type: '
|
|
129
|
+
type: 'TTLS',
|
|
131
130
|
caCertificate: '-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----',
|
|
132
131
|
};
|
|
133
132
|
await sos.management.network.importCertificate(certDetailsEapTtls);
|
|
@@ -174,7 +173,7 @@ Resolves to an array of network interfaces with their information.
|
|
|
174
173
|
```ts
|
|
175
174
|
const interfaces = await sos.management.network.listInterfaces();
|
|
176
175
|
interfaces.forEach((iface) => {
|
|
177
|
-
console.log(`Interface: ${iface.
|
|
176
|
+
console.log(`Interface: ${iface.type}, IP: ${iface.localAddress ?? 'Unknown'}, MAC: ${iface.macAddress}`);
|
|
178
177
|
});
|
|
179
178
|
```
|
|
180
179
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
+
import { EAPMethod } from '../Wifi/IWifi';
|
|
1
2
|
import INetworkInfo, { INetworkInterface, INetworkOptions, INetworkOptionsLegacy, NetworkInterface } from './INetworkInfo';
|
|
2
|
-
/** Allowed types of EAP authentication */
|
|
3
|
-
export type EAPType = 'EAP-TLS' | 'PEAP' | 'EAP-TTLS';
|
|
4
3
|
/** Details for importing a certificate for EAP authentication. */
|
|
5
4
|
export interface CertificateEapDetails {
|
|
6
5
|
/** Type of EAP authentication */
|
|
7
|
-
type:
|
|
6
|
+
type: EAPMethod;
|
|
8
7
|
/** CA certificate */
|
|
9
8
|
caCertificate?: string;
|
|
10
9
|
/** Client certificate for EAP-TLS */
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.VCertificateEapDetails = void 0;
|
|
4
4
|
exports.VCertificateEapDetails = {
|
|
5
|
-
type: { string: ['
|
|
5
|
+
type: { string: ['TLS', 'PEAP', 'TTLS'] },
|
|
6
6
|
caCertificate: '?string',
|
|
7
7
|
clientCertificate: '?string',
|
|
8
8
|
clientKey: '?string',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"INetwork.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Management/Network/INetwork.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"INetwork.js","sourceRoot":"","sources":["../../../../src/FrontApplet/Management/Network/INetwork.ts"],"names":[],"mappings":";;;AA4Ba,QAAA,sBAAsB,GAAG;IACrC,IAAI,EAAE,EAAE,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE;IACzC,aAAa,EAAE,SAAS;IACxB,iBAAiB,EAAE,SAAS;IAC5B,SAAS,EAAE,SAAS;IACpB,yBAAyB,EAAE,SAAS;CACpC,CAAC"}
|
|
@@ -32,7 +32,7 @@ export default class Network implements INetwork {
|
|
|
32
32
|
* @example
|
|
33
33
|
* const interfaces = await sos.management.network.listInterfaces();
|
|
34
34
|
* interfaces.forEach((iface) => {
|
|
35
|
-
* console.log(`Interface: ${iface.
|
|
35
|
+
* console.log(`Interface: ${iface.type}, IP: ${iface.localAddress ?? 'Unknown'}, MAC: ${iface.macAddress}`);
|
|
36
36
|
* });
|
|
37
37
|
*/
|
|
38
38
|
listInterfaces(): Promise<INetworkInterface[]>;
|
|
@@ -113,7 +113,7 @@ export default class Network implements INetwork {
|
|
|
113
113
|
* @example
|
|
114
114
|
* // Importing an EAP-TLS certificate
|
|
115
115
|
* const certDetails = {
|
|
116
|
-
* type: '
|
|
116
|
+
* type: 'TLS',
|
|
117
117
|
* caCertificate: '-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----',
|
|
118
118
|
* clientCertificate: '-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----',
|
|
119
119
|
* clientKey: '-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----',
|
|
@@ -130,7 +130,7 @@ export default class Network implements INetwork {
|
|
|
130
130
|
*
|
|
131
131
|
* // Importing an EAP-TTLS certificate
|
|
132
132
|
* const certDetailsEapTtls = {
|
|
133
|
-
* type: '
|
|
133
|
+
* type: 'TTLS',
|
|
134
134
|
* caCertificate: '-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----',
|
|
135
135
|
* };
|
|
136
136
|
* await sos.management.network.importCertificate(certDetailsEapTtls);
|
|
@@ -45,7 +45,7 @@ class Network {
|
|
|
45
45
|
* @example
|
|
46
46
|
* const interfaces = await sos.management.network.listInterfaces();
|
|
47
47
|
* interfaces.forEach((iface) => {
|
|
48
|
-
* console.log(`Interface: ${iface.
|
|
48
|
+
* console.log(`Interface: ${iface.type}, IP: ${iface.localAddress ?? 'Unknown'}, MAC: ${iface.macAddress}`);
|
|
49
49
|
* });
|
|
50
50
|
*/
|
|
51
51
|
async listInterfaces() {
|
|
@@ -139,7 +139,7 @@ class Network {
|
|
|
139
139
|
* @example
|
|
140
140
|
* // Importing an EAP-TLS certificate
|
|
141
141
|
* const certDetails = {
|
|
142
|
-
* type: '
|
|
142
|
+
* type: 'TLS',
|
|
143
143
|
* caCertificate: '-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----',
|
|
144
144
|
* clientCertificate: '-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----',
|
|
145
145
|
* clientKey: '-----BEGIN PRIVATE KEY-----\n...\n-----END PRIVATE KEY-----',
|
|
@@ -156,7 +156,7 @@ class Network {
|
|
|
156
156
|
*
|
|
157
157
|
* // Importing an EAP-TTLS certificate
|
|
158
158
|
* const certDetailsEapTtls = {
|
|
159
|
-
* type: '
|
|
159
|
+
* type: 'TTLS',
|
|
160
160
|
* caCertificate: '-----BEGIN CERTIFICATE-----\n...\n-----END CERTIFICATE-----',
|
|
161
161
|
* };
|
|
162
162
|
* await sos.management.network.importCertificate(certDetailsEapTtls);
|
package/es6/fpath.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
import * as path from 'path-browserify';
|
|
2
2
|
import { IFilePath } from './FrontApplet/FileSystem/types';
|
|
3
3
|
/**
|
|
4
|
-
* fpath utility mirrors node [path](https://nodejs.org/docs/latest/api/path.html)
|
|
4
|
+
* `fpath` utility mirrors node [path](https://nodejs.org/docs/latest/api/path.html)
|
|
5
5
|
* module, but accepts IFilePath type instead of strings. It is useful when
|
|
6
6
|
* working with [sos.fileSystem](/sdk/sos/fileSystem).
|
|
7
7
|
*
|
|
8
|
-
* Not implemented functions:
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
8
|
+
* :::info Not implemented functions:
|
|
9
|
+
* - `format()`
|
|
10
|
+
* - `matchesGlob()`
|
|
11
|
+
* - `parse()`
|
|
12
|
+
* - `relative()`
|
|
13
|
+
* :::
|
|
13
14
|
*
|
|
14
15
|
* @position 99
|
|
15
16
|
*
|
|
@@ -31,6 +32,10 @@ export declare const fpath: {
|
|
|
31
32
|
/**
|
|
32
33
|
* Return the last portion of path, since it is not a valid path, a string is returned.
|
|
33
34
|
*
|
|
35
|
+
* @param filePath The file path to extract the base name from.
|
|
36
|
+
* @param suffix An optional suffix to remove from the result.
|
|
37
|
+
* @return {string} The last portion of path, with suffix removed if it is provided and present in the path.
|
|
38
|
+
*
|
|
34
39
|
* @example
|
|
35
40
|
* const path = { filePath: "images/picture.png", storageUnit: ... };
|
|
36
41
|
* fpath.basename(path); // "picture.png"
|
|
@@ -39,6 +44,9 @@ export declare const fpath: {
|
|
|
39
44
|
/**
|
|
40
45
|
* Removes the last portion of path, returning the parent directory of the path. Ignores trailing slashes
|
|
41
46
|
*
|
|
47
|
+
* @param filePath The file path to get the directory from.
|
|
48
|
+
* @return {IFilePath} The parent directory of the path, with the same storage unit.
|
|
49
|
+
*
|
|
42
50
|
* @example
|
|
43
51
|
* const path = { filePath: "images/picture.png", storageUnit: ... };
|
|
44
52
|
* fpath.dirname(path); // { filePath: "images", storageUnit: ... }
|
|
@@ -47,6 +55,9 @@ export declare const fpath: {
|
|
|
47
55
|
/**
|
|
48
56
|
* Returns extension of the path, from the last period, including the period.
|
|
49
57
|
*
|
|
58
|
+
* @param filePath The file path to extract the extension from.
|
|
59
|
+
* @return {string} The extension of the path, from the last period, including the period.
|
|
60
|
+
*
|
|
50
61
|
* @example
|
|
51
62
|
* const path = { filePath: "images/picture.png", storageUnit: ... };
|
|
52
63
|
* fpath.dirname(path); // .png
|
|
@@ -54,18 +65,28 @@ export declare const fpath: {
|
|
|
54
65
|
extname(filePath: IFilePath): string;
|
|
55
66
|
/**
|
|
56
67
|
* Always returns true, because all file paths are absolute
|
|
68
|
+
*
|
|
69
|
+
* @param _ The file path to check.
|
|
57
70
|
*/
|
|
58
71
|
isAbsolute(_: IFilePath): boolean;
|
|
59
72
|
/**
|
|
60
73
|
* Returns new filePath with paths appended to it and normalized (resolved . and ..)
|
|
61
74
|
*
|
|
75
|
+
* @param filePath The base file path.
|
|
76
|
+
* @param paths Path segments to append.
|
|
77
|
+
* @return {IFilePath} New file path with paths appended to it and normalized.
|
|
78
|
+
*
|
|
62
79
|
* @example
|
|
63
80
|
* const path = { filePath: "images", storageUnit: ... };
|
|
64
81
|
* fpath.join(path, "racoons", ".", "picture.png"); // { filePath: "images/racoons/picture.png", storageUnit: ... }
|
|
65
82
|
*/
|
|
66
83
|
join(filePath: IFilePath, ...paths: string[]): IFilePath;
|
|
67
84
|
/**
|
|
68
|
-
* Similar to fpath.join
|
|
85
|
+
* Similar to `fpath.join()`, but resulting path will always be subdirectory of base.
|
|
86
|
+
*
|
|
87
|
+
* @param base The base file path that the result will always be a subdirectory of.
|
|
88
|
+
* @param paths Path segments to append.
|
|
89
|
+
* @return {IFilePath} New file path with paths appended to it, normalized and guaranteed to be a subdirectory of base.
|
|
69
90
|
*
|
|
70
91
|
* @example
|
|
71
92
|
* const path = { filePath: "uploads/userA", storageUnit: ... };
|
|
@@ -73,7 +94,10 @@ export declare const fpath: {
|
|
|
73
94
|
*/
|
|
74
95
|
safeJoin(base: IFilePath, ...paths: string[]): IFilePath;
|
|
75
96
|
/**
|
|
76
|
-
* Resolves
|
|
97
|
+
* Resolves `.` and `..` in the path and removes multiple slashes.
|
|
98
|
+
*
|
|
99
|
+
* @param filePath The file path to normalize.
|
|
100
|
+
* @returns {IFilePath} Normalized file path.
|
|
77
101
|
*
|
|
78
102
|
* @example
|
|
79
103
|
* const path = { filePath: "images//test/../test2/./", storageUnit: ... };
|
|
@@ -81,7 +105,11 @@ export declare const fpath: {
|
|
|
81
105
|
*/
|
|
82
106
|
normalize(filePath: IFilePath): IFilePath;
|
|
83
107
|
/**
|
|
84
|
-
*
|
|
108
|
+
* Works like `fpath.join()`, but if any of the paths is an absolute path, it will be resolved to the root of the storage unit instead of the root of the file system.
|
|
109
|
+
*
|
|
110
|
+
* @param filePath The base file path.
|
|
111
|
+
* @param paths Path segments to resolve.
|
|
112
|
+
* @return {IFilePath} New file path with paths resolved to it.
|
|
85
113
|
*/
|
|
86
114
|
resolve(filePath: IFilePath, ...paths: string[]): IFilePath;
|
|
87
115
|
/**
|
|
@@ -89,7 +117,11 @@ export declare const fpath: {
|
|
|
89
117
|
*/
|
|
90
118
|
sep: string;
|
|
91
119
|
/**
|
|
92
|
-
* Concatenate
|
|
120
|
+
* Concatenate filePath with paths without adding separator.
|
|
121
|
+
*
|
|
122
|
+
* @param filePath The file path to concatenate to.
|
|
123
|
+
* @param paths Strings to concatenate.
|
|
124
|
+
* @return {IFilePath} New file path with paths concatenated to it.
|
|
93
125
|
*
|
|
94
126
|
* @example
|
|
95
127
|
* const path = { filePath: "uploads/archive.tar", storageUnit: ... };
|
|
@@ -97,7 +129,10 @@ export declare const fpath: {
|
|
|
97
129
|
*/
|
|
98
130
|
concat(filePath: IFilePath, ...paths: string[]): IFilePath;
|
|
99
131
|
/**
|
|
100
|
-
* Convert filePath to string, this string is not guaranteed to be unique and should be only used for debugging/logging
|
|
132
|
+
* Convert filePath to string, this string is not guaranteed to be unique and should be only used for debugging/logging.
|
|
133
|
+
*
|
|
134
|
+
* @param filePath The file path to convert to string.
|
|
135
|
+
* @return {string} The string representation of the file path.
|
|
101
136
|
*/
|
|
102
137
|
stringify(filePath: IFilePath): string;
|
|
103
138
|
/**
|
package/es6/fpath.js
CHANGED
|
@@ -36,15 +36,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.fpath = void 0;
|
|
37
37
|
const path = __importStar(require("path-browserify"));
|
|
38
38
|
/**
|
|
39
|
-
* fpath utility mirrors node [path](https://nodejs.org/docs/latest/api/path.html)
|
|
39
|
+
* `fpath` utility mirrors node [path](https://nodejs.org/docs/latest/api/path.html)
|
|
40
40
|
* module, but accepts IFilePath type instead of strings. It is useful when
|
|
41
41
|
* working with [sos.fileSystem](/sdk/sos/fileSystem).
|
|
42
42
|
*
|
|
43
|
-
* Not implemented functions:
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
43
|
+
* :::info Not implemented functions:
|
|
44
|
+
* - `format()`
|
|
45
|
+
* - `matchesGlob()`
|
|
46
|
+
* - `parse()`
|
|
47
|
+
* - `relative()`
|
|
48
|
+
* :::
|
|
48
49
|
*
|
|
49
50
|
* @position 99
|
|
50
51
|
*
|
|
@@ -66,6 +67,10 @@ exports.fpath = {
|
|
|
66
67
|
/**
|
|
67
68
|
* Return the last portion of path, since it is not a valid path, a string is returned.
|
|
68
69
|
*
|
|
70
|
+
* @param filePath The file path to extract the base name from.
|
|
71
|
+
* @param suffix An optional suffix to remove from the result.
|
|
72
|
+
* @return {string} The last portion of path, with suffix removed if it is provided and present in the path.
|
|
73
|
+
*
|
|
69
74
|
* @example
|
|
70
75
|
* const path = { filePath: "images/picture.png", storageUnit: ... };
|
|
71
76
|
* fpath.basename(path); // "picture.png"
|
|
@@ -76,6 +81,9 @@ exports.fpath = {
|
|
|
76
81
|
/**
|
|
77
82
|
* Removes the last portion of path, returning the parent directory of the path. Ignores trailing slashes
|
|
78
83
|
*
|
|
84
|
+
* @param filePath The file path to get the directory from.
|
|
85
|
+
* @return {IFilePath} The parent directory of the path, with the same storage unit.
|
|
86
|
+
*
|
|
79
87
|
* @example
|
|
80
88
|
* const path = { filePath: "images/picture.png", storageUnit: ... };
|
|
81
89
|
* fpath.dirname(path); // { filePath: "images", storageUnit: ... }
|
|
@@ -94,6 +102,9 @@ exports.fpath = {
|
|
|
94
102
|
/**
|
|
95
103
|
* Returns extension of the path, from the last period, including the period.
|
|
96
104
|
*
|
|
105
|
+
* @param filePath The file path to extract the extension from.
|
|
106
|
+
* @return {string} The extension of the path, from the last period, including the period.
|
|
107
|
+
*
|
|
97
108
|
* @example
|
|
98
109
|
* const path = { filePath: "images/picture.png", storageUnit: ... };
|
|
99
110
|
* fpath.dirname(path); // .png
|
|
@@ -103,6 +114,8 @@ exports.fpath = {
|
|
|
103
114
|
},
|
|
104
115
|
/**
|
|
105
116
|
* Always returns true, because all file paths are absolute
|
|
117
|
+
*
|
|
118
|
+
* @param _ The file path to check.
|
|
106
119
|
*/
|
|
107
120
|
isAbsolute(_) {
|
|
108
121
|
return true;
|
|
@@ -110,6 +123,10 @@ exports.fpath = {
|
|
|
110
123
|
/**
|
|
111
124
|
* Returns new filePath with paths appended to it and normalized (resolved . and ..)
|
|
112
125
|
*
|
|
126
|
+
* @param filePath The base file path.
|
|
127
|
+
* @param paths Path segments to append.
|
|
128
|
+
* @return {IFilePath} New file path with paths appended to it and normalized.
|
|
129
|
+
*
|
|
113
130
|
* @example
|
|
114
131
|
* const path = { filePath: "images", storageUnit: ... };
|
|
115
132
|
* fpath.join(path, "racoons", ".", "picture.png"); // { filePath: "images/racoons/picture.png", storageUnit: ... }
|
|
@@ -121,7 +138,11 @@ exports.fpath = {
|
|
|
121
138
|
};
|
|
122
139
|
},
|
|
123
140
|
/**
|
|
124
|
-
* Similar to fpath.join
|
|
141
|
+
* Similar to `fpath.join()`, but resulting path will always be subdirectory of base.
|
|
142
|
+
*
|
|
143
|
+
* @param base The base file path that the result will always be a subdirectory of.
|
|
144
|
+
* @param paths Path segments to append.
|
|
145
|
+
* @return {IFilePath} New file path with paths appended to it, normalized and guaranteed to be a subdirectory of base.
|
|
125
146
|
*
|
|
126
147
|
* @example
|
|
127
148
|
* const path = { filePath: "uploads/userA", storageUnit: ... };
|
|
@@ -134,7 +155,10 @@ exports.fpath = {
|
|
|
134
155
|
};
|
|
135
156
|
},
|
|
136
157
|
/**
|
|
137
|
-
* Resolves
|
|
158
|
+
* Resolves `.` and `..` in the path and removes multiple slashes.
|
|
159
|
+
*
|
|
160
|
+
* @param filePath The file path to normalize.
|
|
161
|
+
* @returns {IFilePath} Normalized file path.
|
|
138
162
|
*
|
|
139
163
|
* @example
|
|
140
164
|
* const path = { filePath: "images//test/../test2/./", storageUnit: ... };
|
|
@@ -147,7 +171,11 @@ exports.fpath = {
|
|
|
147
171
|
};
|
|
148
172
|
},
|
|
149
173
|
/**
|
|
150
|
-
*
|
|
174
|
+
* Works like `fpath.join()`, but if any of the paths is an absolute path, it will be resolved to the root of the storage unit instead of the root of the file system.
|
|
175
|
+
*
|
|
176
|
+
* @param filePath The base file path.
|
|
177
|
+
* @param paths Path segments to resolve.
|
|
178
|
+
* @return {IFilePath} New file path with paths resolved to it.
|
|
151
179
|
*/
|
|
152
180
|
resolve(filePath, ...paths) {
|
|
153
181
|
return exports.fpath.join(filePath, ...paths);
|
|
@@ -157,7 +185,11 @@ exports.fpath = {
|
|
|
157
185
|
*/
|
|
158
186
|
sep: path.sep,
|
|
159
187
|
/**
|
|
160
|
-
* Concatenate
|
|
188
|
+
* Concatenate filePath with paths without adding separator.
|
|
189
|
+
*
|
|
190
|
+
* @param filePath The file path to concatenate to.
|
|
191
|
+
* @param paths Strings to concatenate.
|
|
192
|
+
* @return {IFilePath} New file path with paths concatenated to it.
|
|
161
193
|
*
|
|
162
194
|
* @example
|
|
163
195
|
* const path = { filePath: "uploads/archive.tar", storageUnit: ... };
|
|
@@ -170,7 +202,10 @@ exports.fpath = {
|
|
|
170
202
|
};
|
|
171
203
|
},
|
|
172
204
|
/**
|
|
173
|
-
* Convert filePath to string, this string is not guaranteed to be unique and should be only used for debugging/logging
|
|
205
|
+
* Convert filePath to string, this string is not guaranteed to be unique and should be only used for debugging/logging.
|
|
206
|
+
*
|
|
207
|
+
* @param filePath The file path to convert to string.
|
|
208
|
+
* @return {string} The string representation of the file path.
|
|
174
209
|
*/
|
|
175
210
|
stringify(filePath) {
|
|
176
211
|
return path.join(`[${filePath.storageUnit.type}]`, filePath.filePath);
|
package/es6/fpath.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fpath.js","sourceRoot":"","sources":["../src/fpath.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAwC;AAGxC
|
|
1
|
+
{"version":3,"file":"fpath.js","sourceRoot":"","sources":["../src/fpath.ts"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