Socket
Socket
Sign inDemoInstall

anyfileparser

Package Overview
Dependencies
81
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    anyfileparser

Node.JS library that can parse text from any kind of file, eg. text, image, pdf, office files.


Version published
Maintainers
1
Created

Readme

Source

anyFileParser

Node.JS library that can parse text from any kind of file, eg. text, image, pdf, office files.

Update
  • 2019/06/17 - Added method to change location for decompressing office files in places with restricted write access.
  • 2019/05/02 - Initial module with pdf, image, utf-8 and office files.

Install via npm

npm i anyfileparser

Usage

const anyFileParser = require('anyfileparser');

anyFileParser.parseFile("/path/to/file", function(data){
        // "data" string in the callback here is the text parsed from the file passed in the first argument above
        console.log(data)
})

Optionally change decompression location for office Files at persionalised locations for environments with restricted write access

const anyFileParser = require('anyfileparser');

// Default decompress location for office Files is "officeDist" in the directory where Node is started. 
// Put this file before parseOffice method to take effect.
anyFileParser.setDecompressionLocation("/tmp");  // New decompression location would be "/tmp/officeDist"

// P.S.: Setting location on a Windows environment with '\' heirarchy requires to be entered twice '\\'
anyFileParser.setDecompressionLocation("C:\\tmp");  // New decompression location would be "C:\tmp\officeDist"

anyFileParser.parseFile("/path/to/file", function(data){
        // "data" string in the callback here is the text parsed from the file passed in the first argument above
        console.log(data)
})

Example

const anyFileParser = require('anyfileparser');

anyFileParser.parseFile("C:\\files\\myText.docx", function(data){
        var newText = data + "look, I can parse any file"
        callSomeOtherFunction(newText);
})

// Using relative path for file is also fine
anyFileParser.parseFile("files/myWorkSheet.ods", function(data){
        var newText = data + "look, I can parse any file"
        callSomeOtherFunction(newText);
})

Keywords

FAQs

Last updated on 18 Jun 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc