Skip to content

Instantly share code, notes, and snippets.

@larryyangsen
Created May 28, 2018 14:41
Show Gist options
  • Star 6 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save larryyangsen/b2f293edaefde4067e2a289756c2f188 to your computer and use it in GitHub Desktop.
Save larryyangsen/b2f293edaefde4067e2a289756c2f188 to your computer and use it in GitHub Desktop.
axios download audio file
const { data } = await axios.get(url, {
responseType: 'arraybuffer',
headers: {
'Content-Type': 'audio/wav'
}
});
const blob = new Blob([data], {
type: 'audio/wav'
});
const url = URL.createObjectURL(blob);
@k-wasilewski
Copy link

exactly what I was looking for, thanks

@saeedeyvazy
Copy link

Oooooops! thanks for this.

@JoaoDias61
Copy link

exactly what I was looking for, thanks

@JESUSS1
Copy link

JESUSS1 commented Mar 31, 2023

Thanks for the information :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment