markdown-pdf
markdown-pdf copied to clipboard
Callback not called when runningsPath points to invalid file
I'm using this library in a typescript project based on NestJS. I recently ran into a problem where my runnings file was not correctly copied to the build directory. This resulted in a timeout and the callback not being called at all.
Code Clip
MarkdownPDF({
cssPath: path.join(__dirname, 'policy.css'),
paperFormat: 'Letter',
remarkable: {
preset: 'full',
html: true,
breaks: false,
typographer: true,
},
runningsPath: path.join(__dirname, 'runnings.js'),
}).from.string(replacedMarkdown).to.buffer({}, (err, buff) => {
this.logger.debug('In to.buffer callback');
this.logger.debug(err);
this.logger.debug(buff);
if (err) {
this.logger.error(`Error while generating pdf: ${err.message}`);
reject(err);
} else {
resolve(buff);
}
})
If runnings.js does not exist in the same directory as this file, the callback is never called (i.e. I don't see the logger message).
Expected Results
I expect that if the file specified in runningsPath or cssPath are not present that the callback be called with an appropriate err value.