{"size": 742, "ext": "js", "max_stars_repo_path": "scripts/helpers/forwarder.js", "max_stars_repo_name": "jppresents/Documentation", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "scripts/helpers/forwarder.js", "max_issues_repo_name": "jppresents/Documentation", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "scripts/helpers/forwarder.js", "max_forks_repo_name": "jppresents/Documentation", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 32.2608695652, "max_line_length": 75, "alphanum_fraction": 0.6239892183}
var fs = require('fs'),
    path    = require('path'),
    appRoot = require('app-root-path').path,
    logger  = require(path.join(appRoot, 'config/logger')),
    marked = require('meta-marked'),
    __FILENAME__= 'data/forward.json';

module.exports.extractMeta = function(filePath, cb){
    fs.readFile(filePath, {encoding: 'utf-8'},function(err, data){
        if(err) throw err;
        var meta = marked(data).meta;
        cb(meta);
    });
};

module.exports.createForward = function(err, metaList, cb){
    if (err) throw err;
    fs.writeFile(__FILENAME__, JSON.stringify(metaList), function(error){
        if (error) throw error;
        logger.info('> data/forward.json has been successfully compiled.');
        cb();
    });
};