`error: Uncaught TypeError: fileHandle.writeFile is not a function`

#4 · closed · 2 comments

View on GitHub ↗

jerrygreen

After fixing https://github.com/ratson/puppeteer_plus/issues/2, I'm still not able to convert to pdf, ```txt error: Uncaught TypeError: fileHandle.writeFile is not a function await fileHandle.writeFile(chunk); ^ at getReadableAsBuffer (https://raw.githubusercontent.com/jerrygreen/puppeteer_plus/issue_2/vendor/puppeteer/src/common/util.ts:459:24) at Object.runMicrotasks (deno:core/01_core.js:263:30) at processTicksAndRejections (https://deno.land/[email protected]/node/_next_tick.ts:62:10) at async Page.pdf (https://raw.githubusercontent.com/jerrygreen/puppeteer_plus/issue_2/vendor/puppeteer/src/common/Page.ts:3056:20) at async file:///home/ubuntu/Projects/html-to-pdf/html2pdf.ts:7:1 ``` `html2pdf.ts`: ```ts import puppeteer from "https://raw.githubusercontent.com/jerrygreen/puppeteer_plus/issue_2/mod.ts"; const browser = await puppeteer.launch(); const page = await browser.newPage(); await page.goto("https://example.com"); await page.pdf({ path: 'file.pdf' }) await browser.close(); ``` `Deno.version`: ```json { "deno": "1.24.3", "v8":" 10.4.132.20", "typescript": "4.7.4" } ``` --- The issue is related to this code here, but I don't yet know how to get over it (I don't feel brave enough to investigate so deeply, but maybe someone else will solve it): https://github.com/ratson/puppeteer_plus/blob/68223f46614434d2f089068e07c5b9ace05e52ba/vendor/puppeteer/src/common/util.ts#L456-L460

Comments

ratson

It will be fixed once the upstream has complete `fs` compat support. https://github.com/denoland/deno/issues/18218

salemalem

Any update? Having this error: TypeError: fileHandle.stat is not a function