Skip to content

Commit 5cff833

Browse files
committed
docs: update examples that returned streams
1 parent 574a974 commit 5cff833

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

examples/personality_insights.v3.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,16 @@ personalityInsights.profile(
7878
* https://console.bluemix.net/docs/services/personality-insights/output-csv.html#outputCSV
7979
*/
8080
personalityInsights
81-
.profileAsCsv({
81+
.profileAsCsv(
82+
{
8283
content: 'Enter more than 100 unique words here...',
8384
content_type: 'text/plain',
8485
csv_headers: true
85-
})
86-
.pipe(fs.createWriteStream('./output.csv'));
86+
},
87+
(err, res) => {
88+
if (err) {
89+
console.log('error:', err);
90+
} else {
91+
fs.writeFileSync('./output.csv', res);
92+
}
93+
});

examples/text_to_speech_to_speakers.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,11 @@ reader.on('format', function(format) {
2323
reader.pipe(new Speaker(format));
2424
});
2525

26-
textToSpeech.synthesize({ text: 'hello from IBM Watson', accept: 'audio/wav' }).pipe(reader);
26+
textToSpeech
27+
.synthesize({ text: 'hello from IBM Watson', accept: 'audio/wav' })
28+
.then(res => {
29+
res.pipe(reader);
30+
})
31+
.catch(err => {
32+
console.log(err);
33+
});

0 commit comments

Comments
 (0)