UNPKG
json-append
Version:
latest (1.1.1)
1.1.1
1.1.0
1.0.2
1.0.1
command line tool that append item to array of json file.
github.com/azu/json-append
azu/json-append
json-append
/
bin
/
cmd.js
11 lines
•
312 B
JavaScript
View Raw
1
2
3
4
5
6
7
8
9
10
11
#!/usr/bin/env node
var
append =
require
(
'../'
).
append
;
var
concat =
require
(
'concat-stream'
);
var
file = process.
argv
[
2
];
if
(!file) {
throw
new
Error
(
"usage: echo 'data' | json-append output.json"
) }
var
input = process.
stdin
; input.
pipe
(
concat
(
function
(
buf
) {
append
(buf.
toString
(
'utf8'
), file); }));