@signageos/front-applet 8.1.0 → 8.1.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/dist/bundle.js +1 -1
- package/dist/bundle.js.map +1 -1
- package/docs/fpath/index.md +12 -250
- package/es6/bundle.d.ts +14 -1
- package/es6/bundle.js +5 -16
- package/es6/bundle.js.map +1 -1
- package/package.json +1 -1
package/docs/fpath/index.md
CHANGED
|
@@ -1,48 +1,19 @@
|
|
|
1
1
|
---
|
|
2
|
-
sidebar_position:
|
|
2
|
+
sidebar_position: 0
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
# fpath
|
|
6
6
|
|
|
7
|
-
fpath utility mirrors node [path](https://nodejs.org/docs/latest/api/path.html)
|
|
8
|
-
module, but accepts IFilePath type instead of strings. It is useful when
|
|
9
|
-
working with [sos.fileSystem](/sdk/sos/fileSystem).
|
|
10
|
-
|
|
11
|
-
Not implemented functions:
|
|
12
|
-
- format
|
|
13
|
-
- matchesGlob
|
|
14
|
-
- parse
|
|
15
|
-
- relative
|
|
16
|
-
|
|
17
|
-
```ts
|
|
18
|
-
import { sos, fpath } from "@signageos/front-applet";
|
|
19
|
-
|
|
20
|
-
const [internal] = await sos.fileSystem.listInternalStorageUnits();
|
|
21
|
-
const rootPath = {
|
|
22
|
-
filePath: '', // Empty string is used as an absolute path instead of "/"
|
|
23
|
-
storageUnit: internal
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
// list saved files in videos/2025-05-19/ directory
|
|
27
|
-
const videos = await sos.fileSystem.listFiles(
|
|
28
|
-
fpath.join(rootPath, "videos", "2025-05-19"),
|
|
29
|
-
);
|
|
30
|
-
```
|
|
31
|
-
|
|
32
7
|
## Properties
|
|
33
8
|
|
|
34
9
|
### path
|
|
35
10
|
|
|
36
|
-
Underlying path polyfill
|
|
37
|
-
|
|
38
11
|
```ts expandable
|
|
39
|
-
path: path.Path;
|
|
12
|
+
path: import("path-browserify").Path;
|
|
40
13
|
```
|
|
41
14
|
|
|
42
15
|
### sep
|
|
43
16
|
|
|
44
|
-
Separator used for joining path segments
|
|
45
|
-
|
|
46
17
|
```ts expandable
|
|
47
18
|
sep: string;
|
|
48
19
|
```
|
|
@@ -51,287 +22,78 @@ sep: string;
|
|
|
51
22
|
|
|
52
23
|
### basename()
|
|
53
24
|
|
|
54
|
-
Return the last portion of path, since it is not a valid path, a string is returned.
|
|
55
|
-
|
|
56
25
|
```ts expandable
|
|
57
|
-
basename(filePath: IFilePath, suffix?: string): string;
|
|
58
|
-
// show-more
|
|
59
|
-
interface IFilePath {
|
|
60
|
-
storageUnit: IStorageUnit;
|
|
61
|
-
filePath: string;
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
interface IStorageUnit {
|
|
65
|
-
type: string;
|
|
66
|
-
capacity: number;
|
|
67
|
-
freeSpace: number;
|
|
68
|
-
usableSpace: number;
|
|
69
|
-
removable: boolean;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
#### Example
|
|
75
|
-
|
|
76
|
-
```ts
|
|
77
|
-
const path = { filePath: "images/picture.png", storageUnit: ... };
|
|
78
|
-
fpath.basename(path); // "picture.png"
|
|
26
|
+
basename(filePath: import("./FrontApplet/FileSystem/types").IFilePath, suffix?: string): string;
|
|
79
27
|
```
|
|
80
28
|
|
|
81
29
|
<Separator />
|
|
82
30
|
|
|
83
31
|
### concat()
|
|
84
32
|
|
|
85
|
-
Concatenate fp with paths without adding separator
|
|
86
|
-
|
|
87
33
|
```ts expandable
|
|
88
|
-
concat(filePath: IFilePath, ...paths: string[]): IFilePath;
|
|
89
|
-
// show-more
|
|
90
|
-
interface IFilePath {
|
|
91
|
-
storageUnit: IStorageUnit;
|
|
92
|
-
filePath: string;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
interface IStorageUnit {
|
|
96
|
-
type: string;
|
|
97
|
-
capacity: number;
|
|
98
|
-
freeSpace: number;
|
|
99
|
-
usableSpace: number;
|
|
100
|
-
removable: boolean;
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
```
|
|
104
|
-
|
|
105
|
-
#### Example
|
|
106
|
-
|
|
107
|
-
```ts
|
|
108
|
-
const path = { filePath: "uploads/archive.tar", storageUnit: ... };
|
|
109
|
-
fpath.concat(path, "_extracted"); // { filePath: "uploads/archive.tar_extracted", storageUnit: ... }
|
|
34
|
+
concat(filePath: import("./FrontApplet/FileSystem/types").IFilePath, ...paths: string[]): import("./FrontApplet/FileSystem/types").IFilePath;
|
|
110
35
|
```
|
|
111
36
|
|
|
112
37
|
<Separator />
|
|
113
38
|
|
|
114
39
|
### dirname()
|
|
115
40
|
|
|
116
|
-
Removes the last portion of path, returning the parent directory of the path. Ignores trailing slashes
|
|
117
|
-
|
|
118
41
|
```ts expandable
|
|
119
|
-
dirname(filePath: IFilePath): IFilePath;
|
|
120
|
-
// show-more
|
|
121
|
-
interface IFilePath {
|
|
122
|
-
storageUnit: IStorageUnit;
|
|
123
|
-
filePath: string;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
interface IStorageUnit {
|
|
127
|
-
type: string;
|
|
128
|
-
capacity: number;
|
|
129
|
-
freeSpace: number;
|
|
130
|
-
usableSpace: number;
|
|
131
|
-
removable: boolean;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
#### Example
|
|
137
|
-
|
|
138
|
-
```ts
|
|
139
|
-
const path = { filePath: "images/picture.png", storageUnit: ... };
|
|
140
|
-
fpath.dirname(path); // { filePath: "images", storageUnit: ... }
|
|
42
|
+
dirname(filePath: import("./FrontApplet/FileSystem/types").IFilePath): import("./FrontApplet/FileSystem/types").IFilePath;
|
|
141
43
|
```
|
|
142
44
|
|
|
143
45
|
<Separator />
|
|
144
46
|
|
|
145
47
|
### extname()
|
|
146
48
|
|
|
147
|
-
Returns extension of the path, from the last period, including the period.
|
|
148
|
-
|
|
149
49
|
```ts expandable
|
|
150
|
-
extname(filePath: IFilePath): string;
|
|
151
|
-
// show-more
|
|
152
|
-
interface IFilePath {
|
|
153
|
-
storageUnit: IStorageUnit;
|
|
154
|
-
filePath: string;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
interface IStorageUnit {
|
|
158
|
-
type: string;
|
|
159
|
-
capacity: number;
|
|
160
|
-
freeSpace: number;
|
|
161
|
-
usableSpace: number;
|
|
162
|
-
removable: boolean;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
```
|
|
166
|
-
|
|
167
|
-
#### Example
|
|
168
|
-
|
|
169
|
-
```ts
|
|
170
|
-
const path = { filePath: "images/picture.png", storageUnit: ... };
|
|
171
|
-
fpath.dirname(path); // .png
|
|
50
|
+
extname(filePath: import("./FrontApplet/FileSystem/types").IFilePath): string;
|
|
172
51
|
```
|
|
173
52
|
|
|
174
53
|
<Separator />
|
|
175
54
|
|
|
176
55
|
### isAbsolute()
|
|
177
56
|
|
|
178
|
-
Always returns true, because all file paths are absolute
|
|
179
|
-
|
|
180
57
|
```ts expandable
|
|
181
|
-
isAbsolute(_: IFilePath): boolean;
|
|
182
|
-
// show-more
|
|
183
|
-
interface IFilePath {
|
|
184
|
-
storageUnit: IStorageUnit;
|
|
185
|
-
filePath: string;
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
interface IStorageUnit {
|
|
189
|
-
type: string;
|
|
190
|
-
capacity: number;
|
|
191
|
-
freeSpace: number;
|
|
192
|
-
usableSpace: number;
|
|
193
|
-
removable: boolean;
|
|
194
|
-
}
|
|
195
|
-
|
|
58
|
+
isAbsolute(_: import("./FrontApplet/FileSystem/types").IFilePath): boolean;
|
|
196
59
|
```
|
|
197
60
|
|
|
198
61
|
<Separator />
|
|
199
62
|
|
|
200
63
|
### join()
|
|
201
64
|
|
|
202
|
-
Returns new filePath with paths appended to it and normalized (resolved . and ..)
|
|
203
|
-
|
|
204
65
|
```ts expandable
|
|
205
|
-
join(filePath: IFilePath, ...paths: string[]): IFilePath;
|
|
206
|
-
// show-more
|
|
207
|
-
interface IFilePath {
|
|
208
|
-
storageUnit: IStorageUnit;
|
|
209
|
-
filePath: string;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
interface IStorageUnit {
|
|
213
|
-
type: string;
|
|
214
|
-
capacity: number;
|
|
215
|
-
freeSpace: number;
|
|
216
|
-
usableSpace: number;
|
|
217
|
-
removable: boolean;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
#### Example
|
|
223
|
-
|
|
224
|
-
```ts
|
|
225
|
-
const path = { filePath: "images", storageUnit: ... };
|
|
226
|
-
fpath.join(path, "racoons", ".", "picture.png"); // { filePath: "images/racoons/picture.png", storageUnit: ... }
|
|
66
|
+
join(filePath: import("./FrontApplet/FileSystem/types").IFilePath, ...paths: string[]): import("./FrontApplet/FileSystem/types").IFilePath;
|
|
227
67
|
```
|
|
228
68
|
|
|
229
69
|
<Separator />
|
|
230
70
|
|
|
231
71
|
### normalize()
|
|
232
72
|
|
|
233
|
-
Resolves . and .. in the path and removes multiple slashes
|
|
234
|
-
|
|
235
73
|
```ts expandable
|
|
236
|
-
normalize(filePath: IFilePath): IFilePath;
|
|
237
|
-
// show-more
|
|
238
|
-
interface IFilePath {
|
|
239
|
-
storageUnit: IStorageUnit;
|
|
240
|
-
filePath: string;
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
interface IStorageUnit {
|
|
244
|
-
type: string;
|
|
245
|
-
capacity: number;
|
|
246
|
-
freeSpace: number;
|
|
247
|
-
usableSpace: number;
|
|
248
|
-
removable: boolean;
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
```
|
|
252
|
-
|
|
253
|
-
#### Example
|
|
254
|
-
|
|
255
|
-
```ts
|
|
256
|
-
const path = { filePath: "images//test/../test2/./", storageUnit: ... };
|
|
257
|
-
fpath.normalize(path); // { filePath: "images/test2/", storageUnit: ... }
|
|
74
|
+
normalize(filePath: import("./FrontApplet/FileSystem/types").IFilePath): import("./FrontApplet/FileSystem/types").IFilePath;
|
|
258
75
|
```
|
|
259
76
|
|
|
260
77
|
<Separator />
|
|
261
78
|
|
|
262
79
|
### resolve()
|
|
263
80
|
|
|
264
|
-
Same as fpath.join()
|
|
265
|
-
|
|
266
81
|
```ts expandable
|
|
267
|
-
resolve(filePath: IFilePath, ...paths: string[]): IFilePath;
|
|
268
|
-
// show-more
|
|
269
|
-
interface IFilePath {
|
|
270
|
-
storageUnit: IStorageUnit;
|
|
271
|
-
filePath: string;
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
interface IStorageUnit {
|
|
275
|
-
type: string;
|
|
276
|
-
capacity: number;
|
|
277
|
-
freeSpace: number;
|
|
278
|
-
usableSpace: number;
|
|
279
|
-
removable: boolean;
|
|
280
|
-
}
|
|
281
|
-
|
|
82
|
+
resolve(filePath: import("./FrontApplet/FileSystem/types").IFilePath, ...paths: string[]): import("./FrontApplet/FileSystem/types").IFilePath;
|
|
282
83
|
```
|
|
283
84
|
|
|
284
85
|
<Separator />
|
|
285
86
|
|
|
286
87
|
### safeJoin()
|
|
287
88
|
|
|
288
|
-
Similar to fpath.join, but resulting path will always be subdirectory of base
|
|
289
|
-
|
|
290
89
|
```ts expandable
|
|
291
|
-
safeJoin(base: IFilePath, ...paths: string[]): IFilePath;
|
|
292
|
-
// show-more
|
|
293
|
-
interface IFilePath {
|
|
294
|
-
storageUnit: IStorageUnit;
|
|
295
|
-
filePath: string;
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
interface IStorageUnit {
|
|
299
|
-
type: string;
|
|
300
|
-
capacity: number;
|
|
301
|
-
freeSpace: number;
|
|
302
|
-
usableSpace: number;
|
|
303
|
-
removable: boolean;
|
|
304
|
-
}
|
|
305
|
-
|
|
306
|
-
```
|
|
307
|
-
|
|
308
|
-
#### Example
|
|
309
|
-
|
|
310
|
-
```ts
|
|
311
|
-
const path = { filePath: "uploads/userA", storageUnit: ... };
|
|
312
|
-
fpath.safeJoin(path, "..", "userB", "picture.png"); // { filePath: "uploads/userA/userB/picture.png", storageUnit: ... }
|
|
90
|
+
safeJoin(base: import("./FrontApplet/FileSystem/types").IFilePath, ...paths: string[]): import("./FrontApplet/FileSystem/types").IFilePath;
|
|
313
91
|
```
|
|
314
92
|
|
|
315
93
|
<Separator />
|
|
316
94
|
|
|
317
95
|
### stringify()
|
|
318
96
|
|
|
319
|
-
Convert filePath to string, this string is not guaranteed to be unique and should be only used for debugging/logging
|
|
320
|
-
|
|
321
97
|
```ts expandable
|
|
322
|
-
stringify(filePath: IFilePath): string;
|
|
323
|
-
// show-more
|
|
324
|
-
interface IFilePath {
|
|
325
|
-
storageUnit: IStorageUnit;
|
|
326
|
-
filePath: string;
|
|
327
|
-
}
|
|
328
|
-
|
|
329
|
-
interface IStorageUnit {
|
|
330
|
-
type: string;
|
|
331
|
-
capacity: number;
|
|
332
|
-
freeSpace: number;
|
|
333
|
-
usableSpace: number;
|
|
334
|
-
removable: boolean;
|
|
335
|
-
}
|
|
336
|
-
|
|
98
|
+
stringify(filePath: import("./FrontApplet/FileSystem/types").IFilePath): string;
|
|
337
99
|
```
|
package/es6/bundle.d.ts
CHANGED
|
@@ -1,9 +1,22 @@
|
|
|
1
1
|
import FrontApplet from './FrontApplet/FrontApplet';
|
|
2
2
|
import Monitoring from './Monitoring/Monitoring';
|
|
3
|
-
export * from './fpath';
|
|
4
3
|
export declare const frontApplet: FrontApplet;
|
|
5
4
|
export declare const sos: FrontApplet;
|
|
6
5
|
export declare const monitoring: Monitoring;
|
|
6
|
+
export declare const fpath: {
|
|
7
|
+
basename(filePath: import("./FrontApplet/FileSystem/types").IFilePath, suffix?: string): string;
|
|
8
|
+
dirname(filePath: import("./FrontApplet/FileSystem/types").IFilePath): import("./FrontApplet/FileSystem/types").IFilePath;
|
|
9
|
+
extname(filePath: import("./FrontApplet/FileSystem/types").IFilePath): string;
|
|
10
|
+
isAbsolute(_: import("./FrontApplet/FileSystem/types").IFilePath): boolean;
|
|
11
|
+
join(filePath: import("./FrontApplet/FileSystem/types").IFilePath, ...paths: string[]): import("./FrontApplet/FileSystem/types").IFilePath;
|
|
12
|
+
safeJoin(base: import("./FrontApplet/FileSystem/types").IFilePath, ...paths: string[]): import("./FrontApplet/FileSystem/types").IFilePath;
|
|
13
|
+
normalize(filePath: import("./FrontApplet/FileSystem/types").IFilePath): import("./FrontApplet/FileSystem/types").IFilePath;
|
|
14
|
+
resolve(filePath: import("./FrontApplet/FileSystem/types").IFilePath, ...paths: string[]): import("./FrontApplet/FileSystem/types").IFilePath;
|
|
15
|
+
sep: string;
|
|
16
|
+
concat(filePath: import("./FrontApplet/FileSystem/types").IFilePath, ...paths: string[]): import("./FrontApplet/FileSystem/types").IFilePath;
|
|
17
|
+
stringify(filePath: import("./FrontApplet/FileSystem/types").IFilePath): string;
|
|
18
|
+
path: import("path-browserify").Path;
|
|
19
|
+
};
|
|
7
20
|
declare global {
|
|
8
21
|
interface Window {
|
|
9
22
|
sos: FrontApplet;
|
package/es6/bundle.js
CHANGED
|
@@ -1,30 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
4
|
};
|
|
19
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.monitoring = exports.sos = exports.frontApplet = void 0;
|
|
6
|
+
exports.fpath = exports.monitoring = exports.sos = exports.frontApplet = void 0;
|
|
21
7
|
const createFrontApplet_1 = __importDefault(require("./FrontApplet/createFrontApplet"));
|
|
22
8
|
const Monitoring_1 = __importDefault(require("./Monitoring/Monitoring"));
|
|
23
|
-
|
|
9
|
+
const fpath_1 = require("./fpath");
|
|
24
10
|
// fake exports for generating declarations which are overwritten by module.exports
|
|
25
11
|
exports.frontApplet = (0, createFrontApplet_1.default)(window, 'hug');
|
|
26
12
|
exports.sos = exports.frontApplet;
|
|
27
13
|
exports.monitoring = new Monitoring_1.default(exports.frontApplet);
|
|
14
|
+
exports.fpath = fpath_1.fpath;
|
|
28
15
|
// add exports to the frontApplet, which is assigned to module.exports
|
|
29
16
|
// @ts-ignore
|
|
30
17
|
exports.frontApplet.sos = exports.frontApplet;
|
|
@@ -34,6 +21,8 @@ exports.frontApplet.frontApplet = exports.frontApplet;
|
|
|
34
21
|
exports.frontApplet.monitoring = exports.monitoring;
|
|
35
22
|
// @ts-ignore
|
|
36
23
|
exports.frontApplet.default = exports.frontApplet;
|
|
24
|
+
// @ts-ignore
|
|
25
|
+
exports.frontApplet.fpath = exports.fpath;
|
|
37
26
|
window.sos = exports.frontApplet;
|
|
38
27
|
window.sosMonitoring = exports.monitoring;
|
|
39
28
|
exports.default = exports.frontApplet;
|
package/es6/bundle.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../src/bundle.ts"],"names":[],"mappings":";;;;;;AAAA,wFAAgE;AAEhE,yEAAiD;AACjD,mCAA0C;AAE1C,mFAAmF;AACtE,QAAA,WAAW,GAAG,IAAA,2BAAiB,EAAC,MAAM,EAAE,KAAK,CAAC,CAAC;AAC/C,QAAA,GAAG,GAAG,mBAAW,CAAC;AAClB,QAAA,UAAU,GAAG,IAAI,oBAAU,CAAC,mBAAW,CAAC,CAAC;AACzC,QAAA,KAAK,GAAG,aAAM,CAAC;AAE5B,sEAAsE;AACtE,aAAa;AACb,mBAAW,CAAC,GAAG,GAAG,mBAAW,CAAC;AAC9B,aAAa;AACb,mBAAW,CAAC,WAAW,GAAG,mBAAW,CAAC;AACtC,aAAa;AACb,mBAAW,CAAC,UAAU,GAAG,kBAAU,CAAC;AACpC,aAAa;AACb,mBAAW,CAAC,OAAO,GAAG,mBAAW,CAAC;AAClC,aAAa;AACb,mBAAW,CAAC,KAAK,GAAG,aAAK,CAAC;AAS1B,MAAM,CAAC,GAAG,GAAG,mBAAW,CAAC;AACzB,MAAM,CAAC,aAAa,GAAG,kBAAU,CAAC;AAElC,kBAAe,mBAAW,CAAC;AAC3B,MAAM,CAAC,OAAO,GAAG,mBAAW,CAAC"}
|