dctap

0.0.6 • Public • Published

dctap.js

Javascript library to parse and manipulate DCTAP CSV files

Usage:

const { DcTap } = require('dctap');
const dctap = new DcTap();

Command Line

Convert DCTAP CSV to JSON:

dctap-to-json examples/allFeatures.csv

Convert DCTAP CSV to ShExJ:

dctap-to-shexj examples/allFeatures.csv

API

Parse text using a specified URL for relative URL resolution

await dctap.parse(text, new URL('file://' + __dirname));

Emit as Javascript object

const obj = dctap.toJson();
console.log(JSON.stringify(obj, null, 2));

Emit as ShEx Javascript object

const schema = dctap.toShEx();
console.log(JSON.stringify(schema, null, 2));

complete example

const Fs = require('fs');
const { DcTap } = require('dctap');

(async () => {
  const text = Fs.readFileSync('examples/allFeatures.csv');
  const dctap = new DcTap();
  await dctap.parse(text, new URL('file://' + __dirname));
  const schema = dctap.toShExJ();
  console.log(JSON.stringify(schema, null, 2));
})();

Readme

Keywords

none

Package Sidebar

Install

npm i dctap

Weekly Downloads

8

Version

0.0.6

License

ISC

Unpacked Size

37.6 kB

Total Files

28

Last publish

Collaborators

  • ericprud