stegdoc 5.4.0 → 5.5.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/package.json +1 -1
- package/src/commands/encode.js +4 -2
- package/src/index.js +1 -1
package/package.json
CHANGED
package/src/commands/encode.js
CHANGED
|
@@ -30,12 +30,14 @@ function zipFolder(folderPath) {
|
|
|
30
30
|
*/
|
|
31
31
|
async function detectFileType(filePath) {
|
|
32
32
|
try {
|
|
33
|
-
const
|
|
33
|
+
const fileType = await import('file-type');
|
|
34
|
+
const fromBuffer = fileType.fileTypeFromBuffer || fileType.default?.fromBuffer;
|
|
35
|
+
if (!fromBuffer) return null;
|
|
34
36
|
const fd = await fs.promises.open(filePath, 'r');
|
|
35
37
|
const buf = Buffer.alloc(4100);
|
|
36
38
|
await fd.read(buf, 0, 4100, 0);
|
|
37
39
|
await fd.close();
|
|
38
|
-
return await
|
|
40
|
+
return await fromBuffer(buf);
|
|
39
41
|
} catch {
|
|
40
42
|
return null;
|
|
41
43
|
}
|
package/src/index.js
CHANGED