@tstdl/base 0.92.17 → 0.92.18
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/file/mime-type.js +13 -5
- package/package.json +1 -1
package/file/mime-type.js
CHANGED
|
@@ -11,9 +11,17 @@ export function getMimeTypeExtensions(mimeType) {
|
|
|
11
11
|
}
|
|
12
12
|
async function spawnFileCommand(args, file) {
|
|
13
13
|
const process = await spawnCommand('file', args, { stdinPipeOptions: { preventCancel: true } });
|
|
14
|
-
const
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
const { code } = await process.wait();
|
|
15
|
+
if (isDefined(file)) {
|
|
16
|
+
await process.write(file);
|
|
17
|
+
}
|
|
18
|
+
if (code != 0) {
|
|
19
|
+
const errorOutput = await process.readError();
|
|
20
|
+
throw new Error(errorOutput.trim());
|
|
21
|
+
}
|
|
22
|
+
const output = await process.readOutput();
|
|
23
|
+
if (output.includes('file or directory')) {
|
|
24
|
+
throw new Error(output.trim());
|
|
25
|
+
}
|
|
26
|
+
return output.trim();
|
|
19
27
|
}
|