uti 6.9.2 → 7.1.0
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/LICENSE +1 -1
- package/README.md +2 -2
- package/package.json +5 -6
- package/src/uti.mjs +8 -5
- package/src/well-known-utis.mjs +18 -0
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -153,7 +153,7 @@ Then a lookup in the reistered UTIs for file name extions is executed.
|
|
|
153
153
|
|
|
154
154
|
* `fileName` **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)** file to detect UTI for
|
|
155
155
|
|
|
156
|
-
Returns **[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)
|
|
156
|
+
Returns **[Array](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array)<[string](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String)>** UTI for the given fileName or undefined if no UTI is registerd for the file names extension
|
|
157
157
|
|
|
158
158
|
### conformsTo
|
|
159
159
|
|
|
@@ -169,7 +169,7 @@ Returns **[boolean](https://developer.mozilla.org/docs/Web/JavaScript/Reference/
|
|
|
169
169
|
|
|
170
170
|
### fileNameConformsTo
|
|
171
171
|
|
|
172
|
-
Lookup a UTI for a file name and check conformance
|
|
172
|
+
Lookup a UTI for a file name and check conformance.
|
|
173
173
|
|
|
174
174
|
#### Parameters
|
|
175
175
|
|
package/package.json
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "uti",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.1.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
7
|
-
"sideEffects": false,
|
|
8
7
|
"exports": {
|
|
9
8
|
".": "./src/uti.mjs"
|
|
10
9
|
},
|
|
@@ -31,18 +30,18 @@
|
|
|
31
30
|
"lint:docs": "documentation lint ./src/**/*.mjs"
|
|
32
31
|
},
|
|
33
32
|
"devDependencies": {
|
|
34
|
-
"ava": "^5.1.
|
|
35
|
-
"browser-ava": "^1.3.
|
|
33
|
+
"ava": "^5.1.1",
|
|
34
|
+
"browser-ava": "^1.3.19",
|
|
36
35
|
"c8": "^7.12.0",
|
|
37
36
|
"documentation": "^14.0.1",
|
|
38
|
-
"semantic-release": "^
|
|
37
|
+
"semantic-release": "^20.0.4"
|
|
39
38
|
},
|
|
40
39
|
"engines": {
|
|
41
40
|
"node": ">=14.18.3"
|
|
42
41
|
},
|
|
43
42
|
"repository": {
|
|
44
43
|
"type": "git",
|
|
45
|
-
"url": "https://github.com/arlac77/uti
|
|
44
|
+
"url": "https://github.com/arlac77/uti"
|
|
46
45
|
},
|
|
47
46
|
"bugs": {
|
|
48
47
|
"url": "https://github.com/arlac77/uti/issues"
|
package/src/uti.mjs
CHANGED
|
@@ -72,8 +72,7 @@ export class UTIController {
|
|
|
72
72
|
utiByMimeType = new Map();
|
|
73
73
|
utiByFileNameExtension = new Map();
|
|
74
74
|
|
|
75
|
-
constructor()
|
|
76
|
-
{
|
|
75
|
+
constructor() {
|
|
77
76
|
this.register(types);
|
|
78
77
|
}
|
|
79
78
|
|
|
@@ -143,11 +142,15 @@ export class UTIController {
|
|
|
143
142
|
* First the file name extension is extracted.
|
|
144
143
|
* Then a lookup in the reistered UTIs for file name extions is executed.
|
|
145
144
|
* @param {string} fileName file to detect UTI for
|
|
146
|
-
* @return {string} UTI for the given fileName or undefined if no UTI is registerd for the file names extension
|
|
145
|
+
* @return {string[]} UTI for the given fileName or undefined if no UTI is registerd for the file names extension
|
|
147
146
|
*/
|
|
148
147
|
getUTIsForFileName(fileName) {
|
|
149
148
|
const m = fileName.match(/(\.[a-zA-Z_0-9]+)$/);
|
|
150
|
-
|
|
149
|
+
if (m) {
|
|
150
|
+
return this.utiByFileNameExtension.get(m[1]);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return [];
|
|
151
154
|
}
|
|
152
155
|
|
|
153
156
|
/**
|
|
@@ -163,7 +166,7 @@ export class UTIController {
|
|
|
163
166
|
}
|
|
164
167
|
|
|
165
168
|
/**
|
|
166
|
-
* Lookup a UTI for a file name and check conformance
|
|
169
|
+
* Lookup a UTI for a file name and check conformance.
|
|
167
170
|
* @param {string} fileName file to detect UTI for
|
|
168
171
|
* @param {string} uti to check conformance egainst
|
|
169
172
|
* @return {boolean} ture if utils for file name are conformant
|
package/src/well-known-utis.mjs
CHANGED
|
@@ -439,6 +439,24 @@ const types = [
|
|
|
439
439
|
fileNameExtension: [".dmg", ".smi", ".img"],
|
|
440
440
|
mimeType: "application/x-apple-diskimage"
|
|
441
441
|
},
|
|
442
|
+
{ name: "public.oci.image.layer.v1",
|
|
443
|
+
conformsTo: ["public.data"],
|
|
444
|
+
},
|
|
445
|
+
{ name: "public.oci.image.layer.v1.tar",
|
|
446
|
+
conformsTo: ["public.oci.image.layer.v1"],
|
|
447
|
+
filNameExtension: [".tar"],
|
|
448
|
+
mimeType: "application/vnd.oci.image.layer.v1.tar"
|
|
449
|
+
},
|
|
450
|
+
{ name: "public.oci.image.layer.v1.tar.gzip",
|
|
451
|
+
conformsTo: ["public.oci.image.layer.v1"],
|
|
452
|
+
filNameExtension: [".tar.gz"],
|
|
453
|
+
mimeType: "application/vnd.oci.image.layer.v1.tar+gzip"
|
|
454
|
+
},
|
|
455
|
+
{ name: "public.oci.image.layer.v1.tar.zstd",
|
|
456
|
+
conformsTo: ["public.oci.image.layer.v1"],
|
|
457
|
+
filNameExtension: [".tar.zstd"],
|
|
458
|
+
mimeType: "application/vnd.oci.image.layer.v1.tar+zstd"
|
|
459
|
+
},
|
|
442
460
|
{
|
|
443
461
|
name: "public.security.private-key",
|
|
444
462
|
conformsTo: "public.data"
|