Skip to content

Commit

Permalink
Let these commands fail upward
Browse files Browse the repository at this point in the history
  • Loading branch information
DustinBrett committed Oct 19, 2024
1 parent 7e1220c commit ef3e81e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 25 deletions.
18 changes: 7 additions & 11 deletions utils/ffmpeg/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,17 +43,13 @@ export const transcode = async (
const baseName = basename(fileName);
const newName = `${basename(fileName, extname(fileName))}.${extension}`;

try {
ffmpeg.FS("writeFile", baseName, fileData);
await ffmpeg.run("-i", baseName, newName);

returnFiles.push([
join(dirname(fileName), newName),
Buffer.from(ffmpeg.FS("readFile", newName) as Uint8Array),
]);
} catch {
// Ignore failure while reading/writing files
}
ffmpeg.FS("writeFile", baseName, fileData);
await ffmpeg.run("-i", baseName, newName);

returnFiles.push([
join(dirname(fileName), newName),
Buffer.from(ffmpeg.FS("readFile", newName) as Uint8Array),
]);
})
);

Expand Down
19 changes: 5 additions & 14 deletions utils/sheetjs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,9 @@ export const convertSheet = async (
numbers = window.XLSX_ZAHL_PAYLOAD;
}

// eslint-disable-next-line no-undef-init
let sheet: Uint8Array | undefined = undefined;

try {
sheet = sheetJs.write(sheetJs.read(fileData), {
bookType: extension as XLSX.BookType,
numbers,
type: "buffer",
}) as Uint8Array;
} catch {
// Ignore failure to read/write sheet
}

return sheet || Buffer.from("");
return sheetJs.write(sheetJs.read(fileData), {
bookType: extension as XLSX.BookType,
numbers,
type: "buffer",
}) as Uint8Array;
};

0 comments on commit ef3e81e

Please sign in to comment.