@stormking/emere
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

Emere

Small tool to retrieve HTML or PDF from a loaded webpage with electron.

Works as a minimal replacement for nightmare.js since it hasn't been getting updates for years.

Usage

See src/main.test.ts for more examples.

import run from 'emere';

let bufferWithHtml = await run({
	url: 'http://example.org',
	waitForSelector: 'h1'
});

Options API

type RunScript = {
	url: string,								//webpage to call
	header?: Record<string, string|string[]>,	//headers to send when loading
	body?: string,								//request body to send
	method?: string,							//HTTP method to use
	referrer?: string,							//HTTP referrer to set
	waitAfterLoad?: number,						//wait for ms before grabbing the page. still respects timeout
	waitForSelector?: string,					//wait up to the timeout until this element appears on the page
	userAgent?: string,							//user-agent to set
	timeout?: number,							//timeout for the whole process. will kill electron process
	get?: 'html'|'pdf'							//defaults to html when not set
}

Package Sidebar

Install

npm i @stormking/emere

Weekly Downloads

1

Version

2.0.1

License

ISC

Unpacked Size

49.4 kB

Total Files

15

Last publish

Collaborators

  • stormking