Created
April 30, 2015 08:05
-
-
Save phochste/fac239564a38f8c2eb8a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
/* | |
* Install: npm install n3 | |
* Usage: cat gigantic.ttl | tutle2ntriples | |
* Usage: tutle2ntriples gigantic.ttl | |
* | |
* See also: https://github.com/RubenVerborgh/N3.js | |
*/ | |
var file = undefined; | |
if (process.argv.length == 2) { | |
file = '/dev/stdin'; | |
} | |
else { | |
file = process.argv[2]; | |
} | |
var N3 = require('n3'); | |
var fs = require('fs'); | |
var streamParser = new N3.StreamParser(), | |
inputStream = fs.createReadStream(file), | |
streamWriter = new N3.StreamWriter({ format: 'N-Triples' }); | |
inputStream.pipe(streamParser); | |
streamParser.pipe(streamWriter); | |
streamWriter.pipe(process.stdout); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hehehe