mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-27 08:14:10 +00:00
294088fb27
* make the content cache manager tests configurable * extend stream content in unit tests * [ContentCacheManagerTests] prepare for full object caching * filesystem stream for pdfjs * working?? * cleaning up * handle overflow * [misc] install pdfjs-dist * [misc] move pdfjs code into app/lib/ and scripts/, also use CamelCase * [misc] abstract the file loading and parsing of xRef tables into helper * [misc] pdfjsTests: add snapshot based tests for the Xref table parser * [misc] FSStream: throw proper error and drop commented code * [misc] FSStream: integrate throwing of MissingDataException into getter * [misc] pdfjs: fix eslint errors * [misc] pdfjs: run format_fix * [misc] pdfjs: allocate very small non empty dummy buffers explicitly * [misc] install @overleaf/o-error * [ContentCacheManager] use PDF.js Xref table instead of stream detection Co-Authored-By: Brian Gough <brian.gough@overleaf.com> * [pdfjs] parseXrefTable: handle empty PDF files gracefully Co-authored-by: Brian Gough <brian.gough@overleaf.com>
12 lines
339 B
JavaScript
12 lines
339 B
JavaScript
const fs = require('fs')
|
|
const { parseXrefTable } = require('../app/lib/pdfjs/parseXrefTable')
|
|
|
|
const pdfPath = process.argv[2]
|
|
|
|
async function main() {
|
|
const size = (await fs.promises.stat(pdfPath)).size
|
|
const xRefEntries = await parseXrefTable(pdfPath, size)
|
|
console.log('Xref entries', xRefEntries)
|
|
}
|
|
|
|
main().catch(console.error)
|