This package has been deprecated

Author message:

This project has been renamed to @uyamazak/fastify-hc-pages. Install using @uyamazak/fastify-hc-pages instead.

@uyamazak/fastify-hc-pages-plugin
TypeScript icon, indicating that this package has built-in type declarations

0.2.1 • Public • Published

fastify-hc-pages-plugin

A plugin that allows you to use Headless Chrome Pages with Puppeteer from Fastify

This plugin was derived from the following repository.

https://github.com/uyamazak/hc-pdf-server

Getting started

Preparing.

Usage

import fastify from 'fastify'
import { hcPagesPlugin } from '@uyamazak/fastify-hc-pages-plugin'

const app = async () => {
  server.register(hcPagesPlugin)
  // Work together with Puppeteer's Page in callback function.
  server.get('/gettitle', async (_, reply) => {
    const result = await server.runOnPage<string>(async (page: Page) => {
      await page.setContent(contentHtml, { waitUntil: 'domcontentloaded' })
      return await page.title()
    })
    reply.send(result)
  })
}

Contributing

Pull requests, Issues, GitHub Sponsors are welcome.

Contributors

Thanks!

salos1982 (Pull Request)

Author

uyamazak

Readme

Keywords

Package Sidebar

Install

npm i @uyamazak/fastify-hc-pages-plugin

Weekly Downloads

0

Version

0.2.1

License

MIT

Unpacked Size

82.2 kB

Total Files

16

Last publish

Collaborators

  • uyamazak