SHARE
TWEET

Untitled

a guest Jan 29th, 2020 65 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. app.post('/api/tts', (req, res) => {
  2.     let payload = '';
  3.  
  4.     req.on('data', chunk => {
  5.         payload += chunk;
  6.     });
  7.  
  8.     req.on('end', () => {
  9.         textToSpeech.request(payload, (data) => {
  10.             const respString = data.toString('base64');
  11.             const base64String = `data:audio/mpeg;base64,${respString}`
  12.             res.send(base64String);
  13.         });
  14.     });
  15. });
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Top