Skip to content
This repository has been archived by the owner on Dec 19, 2023. It is now read-only.

Commit

Permalink
Update quickstart to write mp3 file asynchronously
Browse files Browse the repository at this point in the history
  • Loading branch information
Rebecca Taylor committed Mar 24, 2018
1 parent e235bf3 commit ed07e6b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Expand Up @@ -88,12 +88,12 @@ const request = {
// Performs the Text-to-Speech request
client
.synthesizeSpeech(request)
.then(results => {
.then(async results => {
// The binary audio content returned from the API
const audioContent = results[0].audioContent;

// Write the audio content to a local file
fs.writeFileSync('output.mp3', audioContent, 'binary');
await fs.writeFile('output.mp3', audioContent, 'binary');
console.log('Audio content written to file: output.mp3');
})
.catch(err => {
Expand Down
4 changes: 2 additions & 2 deletions samples/quickstart.js
Expand Up @@ -39,12 +39,12 @@ const request = {
// Performs the Text-to-Speech request
client
.synthesizeSpeech(request)
.then(results => {
.then(async results => {
// The binary audio content returned from the API
const audioContent = results[0].audioContent;

// Write the audio content to a local file
fs.writeFileSync('output.mp3', audioContent, 'binary');
await fs.writeFile('output.mp3', audioContent, 'binary');
console.log('Audio content written to file: output.mp3');
})
.catch(err => {
Expand Down

0 comments on commit ed07e6b

Please sign in to comment.