UNPKG

textract

Version:

Extracting text from files of various type including html, pdf, doc, docx, xls, xlsx, csv, pptx, png, jpg, gif, rtf, text/*, and various open office.

23 lines (19 loc) 574 B
var path = require( 'path' ) , textract = require( './index' ); module.exports = function( filePath, flags ) { filePath = path.resolve( process.cwd(), filePath ); if ( flags.preserveLineBreaks === 'false' ) { flags.preserveLineBreaks = false; } else { flags.preserveLineBreaks = true; } textract.fromFileWithPath( filePath, flags, function( error, text ) { if ( error ) { // eslint-disable-next-line no-console console.error( error ); } else { // eslint-disable-next-line no-console console.log( text ); } }); };