Commit 27ebd2e8 by ZongLiang Committed by GitHub

Update parseOffice.ts (#3901)

更新本地导入pptx文件提示文件编码错误
The argument 'windows-1252' is invalid encoding. Received 'encoding'
parent 81a06718
...@@ -46,11 +46,9 @@ const parsePowerPoint = async ({ ...@@ -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');
} });
}) })
); );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment