html-pdf-chrome
Version:
HTML to PDF and image converter via Chrome/Chromium
78 lines (77 loc) • 1.88 kB
TypeScript
/// <reference types="node" />
/// <reference types="node" />
import Protocol from 'devtools-protocol';
import { Readable } from 'stream';
/**
* Allows exporting of PDF or image data to multiple formats.
*
* @export
* @class CreateResult
*/
export declare class CreateResult {
/**
* Writes the given data Buffer to the specified file location.
*
* @private
* @static
* @param {string} filename the file name to write to.
* @param {Buffer} data the data to write.
* @returns {Promise<void>}
*
* @memberof CreateResult
*/
private static writeFile;
/**
* Base64-encoded data.
*
* @private
* @type {string}
* @memberof CreateResult
*/
private data;
/**
* The main page network response, if any.
*/
readonly response?: Protocol.Network.Response;
/**
* Creates an instance of CreateResult.
* @param {string} data base64 data
* @param {Protocol.Network.Response} response the main page network response, if any.
*
* @memberof CreateResult
*/
constructor(data: string, response?: Protocol.Network.Response);
/**
* Get the base64 data.
*
* @returns {string} base64 data.
*
* @memberof CreateResult
*/
toBase64(): string;
/**
* Get a Buffer of the data.
*
* @returns {Buffer} data.
*
* @memberof CreateResult
*/
toBuffer(): Buffer;
/**
* Get a Stream (Readable) of the data.
*
* @returns {Readable} Stream of data.
*
* @memberof CreateResult
*/
toStream(): Readable;
/**
* Saves the result to a file.
*
* @param {string} filename the filename.
* @returns {Promise<void>} resolves upon successful create.
*
* @memberof CreateResult
*/
toFile(filename: string): Promise<void>;
}