Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
xLabelPadding: 3,
xPadding: 5,
label: 'Memory (MB)',
showLegend: true,
legend: { width: 12 }
})
screen.append(line)
screen.key(['escape', 'q', 'C-c'], () => {
return process.exit(0)
})
}
pump(net.connect(argv._[0], argv._[1]),
split(JSON.parse),
writer.obj(argv.data ? write : plot), (err) => {
if (err) {
console.error(err.message)
} else {
console.error('stream closed')
}
try {
fs.unlinkSync(argv._[0])
} catch (err) {
// nothing to do it might not be a file
}
})
function write (chunk, enc, cb) {
console.dir(chunk)
cb()
module.exports = function (callback) {
var state = core.parserState()
return pumpify(
parser(),
flushWriteStream.obj(
function (token, _, done) {
/* istanbul ignore next */
try {
core.parseToken(state, token)
} catch (error) {
return done(error)
}
done()
},
function (done) {
callback(core.parserResult(state))
}
)
)
}
function sink (func) {
const result = split((data) => {
try {
return JSON.parse(data)
} catch (err) {
console.log(err)
console.log(data)
}
})
if (func) result.pipe(writer.obj(func))
return result
}
GetUserMediaToText.prototype.start = function () {
var self = this
if (this.listening) return this.emit('status', 'Already Listening')
if (!this.mediaStream) {
if (this.waiting) return this.emit('status', 'Waiting for userMedia')
this.waiting = true
return this.once('mediaStream', function () {
self.waiting = false
self.start()
})
}
if (!this.sinkStream) {
var recognizeStream = this.speech.createRecognizeStream(this._opts.request)
var emitter = writer.obj(function (data, enc, cb) {
self.emit('data', data)
cb()
})
this.sinkStream = pumpify(pcm(), recognizeStream, emitter)
}
if (!this.audioStream) {
this.audioStream = audio(this.mediaStream, {
channels: 1,
volume: 0.8
})
}
this.listening = true
this.emit('listening', true)
this.emit('status', 'Started listening')
this.pipeline = pump(this.audioStream, this.sinkStream, function (err) {
function concatTrackDict (obj) {
function writeTrackDict (data, enc, cb) {
log.info(`Scanning ${data.filepath}`)
parseMetadata(data, handleMeta)
function handleMeta (err, meta) {
if (err) throw err
obj[meta.filepath] = meta
cb(null)
}
}
return writer.obj(writeTrackDict)
}