Update parseOffice.ts (#3901)
更新本地导入pptx文件提示文件编码错误 The argument 'windows-1252' is invalid encoding. Received 'encoding'
This commit is contained in:
parent
81a06718d8
commit
27ebd2e8cf
@ -46,11 +46,9 @@ const parsePowerPoint = async ({
|
|||||||
// Returning an array of all the xml contents read using fs.readFileSync
|
// Returning an array of all the xml contents read using fs.readFileSync
|
||||||
const xmlContentArray = await Promise.all(
|
const xmlContentArray = await Promise.all(
|
||||||
files.map((file) => {
|
files.map((file) => {
|
||||||
try {
|
return fs.promises.readFile(`${decompressPath}/${file.path}`, encoding).catch(() => {
|
||||||
return fs.promises.readFile(`${decompressPath}/${file.path}`, encoding);
|
|
||||||
} catch (err) {
|
|
||||||
return fs.promises.readFile(`${decompressPath}/${file.path}`, 'utf-8');
|
return fs.promises.readFile(`${decompressPath}/${file.path}`, 'utf-8');
|
||||||
}
|
});
|
||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user