GithubHelp home page GithubHelp logo

files-analysis-starter-kit's Introduction

Files analysis starter kit


NodeJS package for analysing large amount of files.

Screen capture

This NodeJs library searches for all files within an specific folder - recursively - and sends each file info to your processing library. It takes care of multithreading, queuing and managing database connections.

## Usage

  1. Require the package
$ npm install fask --save
  1. Require it and define your analysis
const fask = require('files-analysis-starter-kit')

// Pre-analysis hook
fask.before = (dbs, callback) => { callback() }

// The actual file processing
fask.process = (dbs, fileInfo, callback) => {
  setImmediate(callback)
}

// Post-analysis hook
fask.after = (dbs, callback) => { callback() }

// Launch the analysis
fask.start({...})


Options

Options for the .start method:

Parameter Default Description
cpus 100 Max number of CPUs to use for concurrency
limitFiles -1 (no limit) Limit the number or files to be processed
mimeType null (no filter) Only
path "data" Files location
mongodb localhost MongoDB connection url

fileInfo

The fileInfo parameter have the following structure:

{
  root: '/',
  dir: '/.../files-analysis-starter-kit/data/subfolder',
  base: 'myPdfFile.PDF',
  ext: '.PDF',
  name: 'myPdfFile',
  route: '/.../files-analysis-starter-kit/data/subfolder/myPdfFile.PDF',
  mime: 'application/pdf',
  stats: {
    dev: 16777220,
    mode: 33188,
    nlink: 1,
    uid: 501, // user-id of the owner of the file.
    gid: 20, // group-id of the owner of the file.
    rdev: 0,
    blksize: 4096,
    ino: 29670994,
    size: 68704, // Size in bytes
    blocks: 136,
    atime: Thu Aug 11 2016 13:30:51 GMT+0200 (CEST), // last access
    mtime: Tue Apr 01 2008 08:52:56 GMT+0200 (CEST), // last modification
    ctime: Tue Aug 09 2016 04:20:35 GMT+0200 (CEST), // creation
    birthtime: Tue Apr 01 2008 08:52:56 GMT+0200 (CEST)
  }
}

Databases instances

To use the DB connections use the dbs object. i.e.:

dbs.mongo.getCollection('myCollection').insert(...)

files-analysis-starter-kit's People

Stargazers

 avatar

Watchers

 avatar  avatar

files-analysis-starter-kit's Issues

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.