How to get local recording data while recording (to implement progressive uploading)?

Hi there!
I want to upload local recording data to server while recording in order to avoid dataloss