public finalizeStream()

in src/js/server/dialogflow.ts [178:195]


    public finalizeStream() {

      // start streaming the contents of the wav file
      // to the Dialogflow Streaming API
      pump(
        fs.createReadStream('temp/' + this.sessionId + '.wav'),
        // Format the audio stream into the request format.
        through2.obj((obj:any, _:any, next:any) => {
          next(null, {inputAudio: obj});
        }),
        this.detectStreamCall
      );

      fs.unlink('temp/' + this.sessionId + '.wav', (err) => {
        if (err) throw console.log(err);
        console.log('Audio file was deleted');
      });
    }