Permalink
Browse files

Use rw instead of concat-stream, modernize

  • Loading branch information...
1 parent 76455ef commit acb92def6c482913bf34cb40dbd72ca0428577c9 @tmcw tmcw committed Jun 19, 2014
Showing with 8 additions and 15 deletions.
  1. +3 −4 package.json
  2. +5 −11 tokml
View
@@ -31,9 +31,8 @@
"istanbul": "~0.2.11"
},
"dependencies": {
- "minimist": "0.0.5",
- "concat-stream": "~1.0.1",
- "sharkdown": "0.0.1",
- "strxml": "0.0.0"
+ "minimist": "0.1.0",
+ "strxml": "0.0.0",
+ "rw": "0.0.4"
}
}
View
@@ -1,21 +1,15 @@
#!/usr/bin/env node
var tokml = require('./'),
- sharkdown = require('sharkdown'),
- concat = require('concat-stream'),
- fs = require('fs'),
+ rw = require('rw'),
argv = require('minimist')(process.argv.slice(2), {
boolean: 'simplestyle'
- }),
- simplestyle = !!argv.simplestyle;
+ });
if (process.stdin.isTTY && !argv._[0]) {
- process.stdout.write(sharkdown(fs.readFileSync(__dirname + '/HELP.md')));
+ process.stdout.write(rw.readSync(__dirname + '/HELP.md'));
process.exit(1);
}
-(argv._.length ? fs.createReadStream(argv._[0]) : process.stdin).pipe(concat(convert));
-
-function convert(data) {
- process.stdout.write(tokml(JSON.parse(data), argv));
-}
+var input = rw.readSync(argv._.length ? argv._[0] : '/dev/stdin', 'utf8');
+process.stdout.write(tokml(JSON.parse(input), argv));

0 comments on commit acb92de

Please sign in to comment.