
Product
Announcing Socket Fix 2.0
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
ARFF parsing and formatting
Download manually or with package-manager.
> npm install --save exec-promise
var arff = require('arff');
var readFile = require('fs').readFile;
readFile('data.arff', 'utf8', function (error, content) {
if (error) {
return console.error(error);
}
console.log(arff.parse(content));
});
For the folling data.arff
:
% My ARFF file.
@RELATION user
@ATTRIBUTE name STRING
@ATTRIBUTE lastSignIn DATE
@ATTRIBUTE group {none,read,write,admin}
@DATA
root,?,admin
julien-f,2014-12-16T19:42:01,write
It will give this output:
{
relation: 'user',
attributes: [
{
name: 'name',
type: 'string'
},
{
name: 'lastSignIn',
type: 'date'
},
{
name: 'name',
type: 'enum',
values: [
'none',
'read',
'write',
'admin'
]
}
],
data: [
{
name: 'root',
group: 'admin'
},
{
name: 'julien-f',
lastSignIn: '2014-12-16T19:42:01',
group: 'write'
}
]
}
console.log(arff.format(require('./relation')));
Which will display:
@RELATION foo
@ATTRIBUTE date date
@ATTRIBUTE dateWithFormat date "MM/DD/YY"
@ATTRIBUTE numeric numeric
@ATTRIBUTE string string
@ATTRIBUTE enumerate {"foo","bar","baz"}
@DATA
"2014-12-16T19:42:01+00:00","06/23/15",3.259,"can have spaces","bar"
"2014-12-16T19:42:01+00:00",?,42,?,?
Contributions are very welcome, either on the documentation or on the code.
You may:
ISC © Julien Fontanet
FAQs
ARFF parsing and formatting
We found that arff 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.
Product
Socket Fix 2.0 brings targeted CVE remediation, smarter upgrade planning, and broader ecosystem support to help developers get to zero alerts.
Security News
Socket CEO Feross Aboukhadijeh joins Risky Business Weekly to unpack recent npm phishing attacks, their limited impact, and the risks if attackers get smarter.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.