I want you to create a tool that goes through a bulk of URLs, and then check which one has a 404 status or any 400 errors, and then separate those into a spreadsheet. Those with these errors, separate them into a spreadsheet, and that spreadsheet should be downloaded.
Here's a tool that checks URLs for 404 and other 400-level errors, then exports the problematic ones to a downloadable spreadsheet.
This URL status checker tool allows you to:
Input URLs in two ways:
Check URL Status:
View Results:
Export Results:
The code returns the following error:
Uncaught error: Uncaught TypeError: Deno.writeFileSync is not a function
at Ya (xlsx)
at Tc (xlsx)
at Fg (xlsx)
at Qn (xlsx)
at Module.Gg (xlsx)
at downloadSpreadsheet (/app/page)
Revise the code to address the error.
I was previewing: /
I'll fix the XLSX library error by updating the code to use a browser-compatible approach for downloading files.
The error occurred because the XLSX library was trying to use Deno.writeFileSync
, which is a Deno-specific function that doesn't exist in the browser environment. The XLSX.writeFile()
function was attempting to directly write to the file system, which isn't possible in a browser context.
I've updated the downloadSpreadsheet
function to:
XLSX.write()
with type 'array'URL.createObjectURL()
This approach is fully compatible with browser environments and will work properly in your Next.js application.
The new approach:
The tool should now correctly generate and download the Excel file containing the error URLs without any Deno-related errors.