
Security News
Open Source CAI Framework Handles Pen Testing Tasks up to 3,600Γ Faster Than Humans
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600Γ faster than humans.
data-file-parser
Advanced tools
parse data from file using regular expression (regex)
This plugin requires Grunt ~0.4.0
you may install this module with this command:
npm install data-file-parser --save-dev
after instalation you can load it like so
var dataFileParser = require('data-file-parser');
Returns: Q promise object
Type: String
Required
path to input file wich will be parsed
Type: String
Default: utf8
encoding in which input file is written this option is passed to fs.readFile function
Type: String
Required
path to output file in wich parsed data will be written
Type: RegExp
Required
Example:/^([a-z]+) ([a-z]+). (.+)/gim,
using this regular expresion will be parsed input file. you should use at list one group in it.
Type: String
Required
Example: 'word|type|desc'
it should contain keys (seperated using '|' ) of parsed data using thous keys will be generated date items in output.
Type: String
Default: false
name of variable to wich parsed data vill be esigned and will be written. it should be saved as '*.js' file and then included using script tag so thet variable vill be available
this is content of words.txt
abase v. To lower in position, estimation, or the like;
abbess n. The lady superior of a nunnery.
abbey n. The group of buildings which collectively form the dwelling-place of a society of monks or nuns.
abbot n. The superior of a community of monks.
abdicate v. To give up (royal power or the like).
abdomen n. In mammals, the visceral cavity between the diaphragm and the pelvic floor; the belly.
abdominal n. Of, pertaining to, or situated on the abdomen.
abduction n. A carrying away of a person against his will, or illegally.
this is index.js
var dataParser = require('data-file-parser');
dataParser.parse({
in: 'words.txt', //input file
out: 'words.js', //output file
var:'words', //variable name
// g for global
// i for ignore case
// m fot ^ to be start of every line not whole string
regex: /^([a-z\-]+) ([a-z]+)\. (.+)/gim,
as:'word|type|desc' //object keys
}).then(function(arr){
console.log(arr.length+" words");
})
so after runing it
node index.js
this will be in wors.js
var words = [
{
"word": "abase",
"type": "v",
"desc": "To lower in position, estimation, or the like;"
},
{
"word": "abbess",
"type": "n",
"desc": "The lady superior of a nunnery. "
},
{
"word": "abbey",
"type": "n",
"desc": "The group of buildings which collectively form the dwelling-place of a society of monks or nuns."
},
{
"word": "abbot",
"type": "n",
"desc": "The superior of a community of monks. "
},
{
"word": "abdicate",
"type": "v",
"desc": "To give up (royal power or the like). "
},
{
"word": "abdomen",
"type": "n",
"desc": "In mammals, the visceral cavity between the diaphragm and the pelvic floor; the belly. "
},
{
"word": "abdominal",
"type": "n",
"desc": "Of, pertaining to, or situated on the abdomen. "
},
{
"word": "abduction",
"type": "n",
"desc": "A carrying away of a person against his will, or illegally. "
}
];
and it will be ready to use in your static web project or whatever
// Project configuration.
<script src="words.js"></script>
<script>
console.log(words.length);
</script>
author Irakli Safareli
FAQs
node module for parsing file and writing into another file
The npm package data-file-parser receives a total of 5 weekly downloads. As such, data-file-parser popularity was classified as not popular.
We found that data-file-parser demonstrated a not healthy version release cadence and project activity because the last version was released a year ago.Β It has 1 open source maintainer collaborating on the project.
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.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600Γ faster than humans.
Security News
Deno 2.4 brings back bundling, improves dependency updates and telemetry, and makes the runtime more practical for real-world JavaScript projects.
Security News
CVEForecast.org uses machine learning to project a record-breaking surge in vulnerability disclosures in 2025.