dctap
v0.0.6
Published
Javascript library to parse and manipulate DCTAP CSV files
Downloads
14
Readme
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));
})();