(targetPath, dataUrl)
| 44 | } |
| 45 | |
| 46 | function writePngFromDataUrl(targetPath, dataUrl) { |
| 47 | const comma = String(dataUrl || '').indexOf(','); |
| 48 | if (comma < 0) { |
| 49 | return false; |
| 50 | } |
| 51 | const body = String(dataUrl).substring(comma + 1); |
| 52 | fs.writeFileSync(targetPath, Buffer.from(body, 'base64')); |
| 53 | return true; |
| 54 | } |
| 55 | |
| 56 | const browser = await chromium.launch({ |
| 57 | headless: true, |
no test coverage detected