Skip to content

Commit

Permalink
Merge pull request #10 from NoamGaash/fix/encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
NoamGaash authored Dec 17, 2023
2 parents 580971e + fd1fc95 commit 8f4d9c0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 86 deletions.
81 changes: 0 additions & 81 deletions .github/workflows/deploy.yml

This file was deleted.

11 changes: 6 additions & 5 deletions src/utils/serveFromHar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,16 +62,17 @@ function findEntry(
return bestEntry?.entry ?? null;
}

async function parseContent(content: Content & { _file?: string }, dirName: string = ".") {
async function parseContent(
content: Omit<Content & { _file?: string }, "text"> & { text?: Buffer | string },
dirName: string = ".",
) {
if (!content) return undefined;
if (content._file && !content.text) {
const contentFilePath = path.join(dirName, content._file);
content.text = await promises.readFile(contentFilePath, {
encoding: "utf8",
});
content.text = await promises.readFile(contentFilePath);
}
if (!content.text) return undefined;
if (content.encoding === "base64") {
if (content.encoding === "base64" && typeof content.text === "string") {
return Buffer.from(content.text, "base64");
} else {
return content.text;
Expand Down

0 comments on commit 8f4d9c0

Please sign in to comment.