-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbin.js
More file actions
26 lines (20 loc) · 699 Bytes
/
Copy pathbin.js
File metadata and controls
26 lines (20 loc) · 699 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/env node
var vttshift = require('./')
var minimist = require('minimist')
var fs = require('fs')
var argv = minimist(process.argv.slice(2), {
alias: {out: 'o', help: 'h'},
default: {out: '-'}
})
if (argv.help) {
console.error('Usage: vtt-shift [filename] [--offsetMs=<value>] [--out=<filename>?]')
process.exit(1)
}
process.stdout.on('error', function (err) {
if (err.code !== 'EPIPE') throw err
})
var filename = argv._[0] || '-'
var options = { offsetMs: argv.offsetMs }
var input = filename === '-' ? process.stdin : fs.createReadStream(filename)
var output = argv.out === '-' ? process.stdout : fs.createWriteStream(argv.out)
input.pipe(vttshift(options)).pipe(output)