import fs from 'fs' export default abstract class Result { /** * Get the PDF as a Buffer. */ abstract buffer(): Promise /** * Save the PDF to the given filepath. */ saveTo(path: string): Promise { return new Promise(async (res, rej) => { fs.writeFile(path, await this.buffer(), err => { if (err) { rej(err) return } res() }) }) } }