Created
April 8, 2020 11:56
-
-
Save savelee/ed39c217b8346a2eb67cff4b41fd3560 to your computer and use it in GitHub Desktop.
Server - streaming to Dialogflow
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
//1 | |
io.on('connect', (client) => { | |
//2 | |
client.on('message', async function(data) { | |
const dataURL = data.audio.dataURL.split(',').pop(); | |
let fileBuffer = Buffer.from(dataURL, 'base64'); | |
//3 ... | |
}); | |
// 4 | |
ss(client).on('stream', function(stream, data) { | |
const filename = path.basename(data.name); | |
stream.pipe(fs.createWriteStream(filename)); | |
//5 ... | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment