Skip to content

Commit

Permalink
fix (scraper): truncate files before writing to them
Browse files Browse the repository at this point in the history
  • Loading branch information
kripod committed Apr 20, 2024
1 parent 9e5cb09 commit c55ce7c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/content/quoteRecords/_scraper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ for (const [currency, rateByDate] of rateByDateByCurrency) {
}
quotes.sort(([aDate], [bDate]) => Date.parse(aDate) - Date.parse(bDate));

await file.truncate();
await file.write(
JSON.stringify(Object.fromEntries(quotes), null, 2) + "\n",
0,
Expand Down

0 comments on commit c55ce7c

Please sign in to comment.