New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

arff

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

arff

ARFF parsing and formatting

  • 0.1.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-75%
Maintainers
1
Weekly downloads
 
Created
Source

arff Build Status

ARFF parsing and formatting

Install

Download manually or with package-manager.

npm
> npm install --save exec-promise

Usage

var arff = require('arff');

Parsing

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'
    }
  ]
}

Formatting

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,?,?

Contributing

Contributions are very welcome, either on the documentation or on the code.

You may:

  • report any issue you've encountered;
  • fork and create a pull request.

License

ISC © Julien Fontanet

Keywords

FAQs

Package last updated on 26 Feb 2015

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc