@opendevise/antora-office-to-pdf-extension
Version:
An Antora extension that converts office files (.doc, .docx, .rtf, etc.) in the attachments family to PDF using either LibreOffice or Microsoft Office via docto and updates the file metadata so references point to the converted PDF file.
19 lines (15 loc) • 543 B
JavaScript
const { PassThrough } = require('node:stream')
// adapted from https://github.com/jpommerening/node-lazystream/blob/master/lib/lazystream.js | license: MIT
class LazyReadable extends PassThrough {
constructor (fn, options) {
super(options)
this._read = function () {
delete this._read // restores original method
fn.call(this, options).on('error', this.emit.bind(this, 'error')).pipe(this)
return this._read.apply(this, arguments)
}
this.emit('readable')
}
}
module.exports = LazyReadable