This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const puppeteer = require('puppeteer'); | |
class Webpage { | |
static async generatePDF(url) { | |
const browser = await puppeteer.launch({ headless: true }); // Puppeteer can only generate pdf in headless mode. | |
const page = await browser.newPage(); | |
await page.goto(url, { waitUntil: 'networkidle', networkIdleTimeout: 5000 }); // Adjust network idle as required. | |
const pdfConfig = { | |
path: 'url.pdf', // Saves pdf to disk. | |
format: 'A4', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Tit Petric, Monotek d.o.o., Thu 27 Oct 2016 10:43:38 AM CEST | |
-- | |
-- Delete nginx cached assets with a PURGE request against an endpoint | |
-- | |
local md5 = ngx.md5 | |
function file_exists(name) | |
local f = io.open(name, "r") | |
if f~=nil then io.close(f) return true else return false end |