Socket
Socket
Sign inDemoInstall

@google-cloud/text-to-speech

Package Overview
Dependencies
118
Maintainers
1
Versions
57
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.1.0

7

CHANGELOG.md

@@ -7,2 +7,9 @@ # Changelog

## [1.1.0](https://www.github.com/googleapis/nodejs-text-to-speech/compare/v1.0.0...v1.1.0) (2019-06-05)
### Features
* support apiEndpoint override in client constructor ([#234](https://www.github.com/googleapis/nodejs-text-to-speech/issues/234)) ([519c36c](https://www.github.com/googleapis/nodejs-text-to-speech/commit/519c36c))
## [1.0.0](https://www.github.com/googleapis/nodejs-text-to-speech/compare/v0.5.1...v1.0.0) (2019-05-14)

@@ -9,0 +16,0 @@

17

package.json
{
"name": "@google-cloud/text-to-speech",
"description": "Cloud Text-to-Speech API client for Node.js",
"version": "1.0.0",
"version": "1.1.0",
"license": "Apache-2.0",

@@ -14,5 +14,3 @@ "author": "Google LLC",

"protos",
"src",
"AUTHORS",
"COPYING"
"src"
],

@@ -33,6 +31,3 @@ "keywords": [

"scripts": {
"test": "npm run cover",
"generate-scaffolding": "repo-tools generate all && repo-tools generate lib_samples_readme -l samples/ --config ../.cloud-repo-tools.json",
"cover": "nyc --reporter=lcov mocha test/*.js && nyc report",
"test-no-cover": "mocha test/*.js",
"test": "nyc mocha",
"lint": "eslint '**/*.js'",

@@ -47,7 +42,5 @@ "samples-test": "cd samples/ && npm link ../ && npm test && cd ../",

"dependencies": {
"google-gax": "^1.0.0",
"lodash.merge": "^4.6.0"
"google-gax": "^1.0.0"
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "^3.0.0",
"codecov": "^3.0.0",

@@ -58,3 +51,3 @@ "eslint": "^5.0.0",

"eslint-plugin-prettier": "^3.0.0",
"jsdoc-baseline": "git+https://github.com/hegemonic/jsdoc-baseline.git",
"jsdoc-baseline": "^0.1.0",
"intelli-espower-loader": "^1.0.1",

@@ -61,0 +54,0 @@ "jsdoc": "^3.5.5",

[//]: # "This README.md file is auto-generated, all changes to this file will be lost."
[//]: # "To regenerate it, use `npm run generate-scaffolding`."
[//]: # "To regenerate it, use `python -m synthtool`."
<img src="https://avatars2.githubusercontent.com/u/2810941?v=3&s=96" alt="Google Cloud Platform logo" title="Google Cloud Platform" align="right" height="96" width="96"/>
# [Google Cloud Text-to-Speech API: Node.js Client](https://github.com/googleapis/nodejs-text-to-speech)
# [Google Cloud Text-to-Speech: Node.js Client](https://github.com/googleapis/nodejs-text-to-speech)
[![release level](https://img.shields.io/badge/release%20level-alpha-orange.svg?style&#x3D;flat)](https://cloud.google.com/terms/launch-stages)
[![release level](https://img.shields.io/badge/release%20level-alpha-orange.svg?style=flat)](https://cloud.google.com/terms/launch-stages)
[![npm version](https://img.shields.io/npm/v/@google-cloud/text-to-speech.svg)](https://www.npmjs.org/package/@google-cloud/text-to-speech)
[![codecov](https://img.shields.io/codecov/c/github/googleapis/nodejs-text-to-speech/master.svg?style=flat)](https://codecov.io/gh/googleapis/nodejs-text-to-speech)
> Node.js idiomatic client for [Cloud Text-to-Speech API][product-docs].
The [Cloud Text-to-Speech API](https://cloud.google.com/text-to-speech/docs) converts text or Speech Synthesis Markup Language (SSML) input into audio data of natural human speech.
* [Cloud Text-to-Speech API Node.js Client API Reference][client-docs]
Cloud Text-to-Speech API client for Node.js
* [Google Cloud Text-to-Speech Node.js Client API Reference][client-docs]
* [Google Cloud Text-to-Speech Documentation][product-docs]
* [github.com/googleapis/nodejs-text-to-speech](https://github.com/googleapis/nodejs-text-to-speech)
* [Cloud Text-to-Speech API Documentation][product-docs]

@@ -27,2 +28,3 @@ Read more about the client libraries for Cloud APIs, including the older

* [Quickstart](#quickstart)

@@ -41,67 +43,52 @@ * [Before you begin](#before-you-begin)

1. Select or create a Cloud Platform project.
[Go to the projects page][projects]
1. Enable billing for your project.
[Enable billing][billing]
1. Enable the Google Cloud Text-to-Speech API.
[Enable the API][enable_api]
1. [Select or create a Cloud Platform project][projects].
1. [Enable billing for your project][billing].
1. [Enable the Google Cloud Text-to-Speech API][enable_api].
1. [Set up authentication with a service account][auth] so you can access the
API from your local workstation.
[projects]: https://console.cloud.google.com/project
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=texttospeech.googleapis.com
[auth]: https://cloud.google.com/docs/authentication/getting-started
### Installing the client library
npm install --save @google-cloud/text-to-speech
```bash
npm install @google-cloud/text-to-speech
```
### Using the client library
```javascript
const fs = require('fs');
// Imports the Google Cloud client library
const textToSpeech = require('@google-cloud/text-to-speech');
// Creates a client
const client = new textToSpeech.TextToSpeechClient();
// Import other required libraries
const fs = require('fs');
const util = require('util');
async function main() {
// Creates a client
const client = new textToSpeech.TextToSpeechClient();
// The text to synthesize
const text = 'Hello, world!';
// The text to synthesize
const text = 'Hello, world!';
// Construct the request
const request = {
input: {text: text},
// Select the language and SSML Voice Gender (optional)
voice: {languageCode: 'en-US', ssmlGender: 'NEUTRAL'},
// Select the type of audio encoding
audioConfig: {audioEncoding: 'MP3'},
};
// Construct the request
const request = {
input: {text: text},
// Select the language and SSML Voice Gender (optional)
voice: {languageCode: 'en-US', ssmlGender: 'NEUTRAL'},
// Select the type of audio encoding
audioConfig: {audioEncoding: 'MP3'},
};
// Performs the Text-to-Speech request
client.synthesizeSpeech(request, (err, response) => {
if (err) {
console.error('ERROR:', err);
return;
}
// Performs the Text-to-Speech request
const [response] = await client.synthesizeSpeech(request);
// Write the binary audio content to a local file
const writeFile = util.promisify(fs.writeFile);
await writeFile('output.mp3', response.audioContent, 'binary');
console.log('Audio content written to file: output.mp3');
}
// Write the binary audio content to a local file
fs.writeFile('output.mp3', response.audioContent, 'binary', err => {
if (err) {
console.error('ERROR:', err);
return;
}
console.log('Audio content written to file: output.mp3');
});
});
```
## Samples

@@ -114,6 +101,10 @@

| --------------------------- | --------------------------------- | ------ |
| Synthesize Speech | [source code](https://github.com/googleapis/nodejs-text-to-speech/blob/master/samples/synthesize.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-text-to-speech&page=editor&open_in_editor=samples/synthesize.js,samples/README.md) |
| List supported voices | [source code](https://github.com/googleapis/nodejs-text-to-speech/blob/master/samples/listVoices.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-text-to-speech&page=editor&open_in_editor=samples/listVoices.js,samples/README.md) |
| Audio Profile | [source code](https://github.com/googleapis/nodejs-text-to-speech/blob/master/samples/audioProfile.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-text-to-speech&page=editor&open_in_editor=samples/audioProfile.js,samples/README.md) |
| List Voices | [source code](https://github.com/googleapis/nodejs-text-to-speech/blob/master/samples/listVoices.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-text-to-speech&page=editor&open_in_editor=samples/listVoices.js,samples/README.md) |
| Quickstart | [source code](https://github.com/googleapis/nodejs-text-to-speech/blob/master/samples/quickstart.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-text-to-speech&page=editor&open_in_editor=samples/quickstart.js,samples/README.md) |
| Synthesize | [source code](https://github.com/googleapis/nodejs-text-to-speech/blob/master/samples/synthesize.js) | [![Open in Cloud Shell][shell_img]](https://console.cloud.google.com/cloudshell/open?git_repo=https://github.com/googleapis/nodejs-text-to-speech&page=editor&open_in_editor=samples/synthesize.js,samples/README.md) |
The [Cloud Text-to-Speech API Node.js Client API Reference][client-docs] documentation
The [Google Cloud Text-to-Speech Node.js Client API Reference][client-docs] documentation
also contains samples.

@@ -125,2 +116,5 @@

This library is considered to be in **alpha**. This means it is still a

@@ -130,2 +124,4 @@ work-in-progress and under active development. Any release is subject to

More Information: [Google Cloud Platform Launch Stages][launch_stages]

@@ -146,4 +142,7 @@

[client-docs]: https://cloud.google.com/nodejs/docs/reference/text-to-speech/latest/
[product-docs]: https://cloud.google.com/text-to-speech/docs
[product-docs]: https://cloud.google.com/text-to-speech
[shell_img]: https://gstatic.com/cloudssh/images/open-btn.png
[projects]: https://console.cloud.google.com/project
[billing]: https://support.google.com/cloud/answer/6293499#enable-billing
[enable_api]: https://console.cloud.google.com/flows/enableapi?apiid=texttospeech.googleapis.com
[auth]: https://cloud.google.com/docs/authentication/getting-started

@@ -19,3 +19,2 @@ // Copyright 2019 Google LLC

const gax = require('google-gax');
const merge = require('lodash.merge');
const path = require('path');

@@ -60,4 +59,8 @@

constructor(opts) {
opts = opts || {};
this._descriptors = {};
const servicePath =
opts.servicePath || opts.apiEndpoint || this.constructor.servicePath;
// Ensure that options include the service address and port.

@@ -68,3 +71,3 @@ opts = Object.assign(

port: this.constructor.port,
servicePath: this.constructor.servicePath,
servicePath,
},

@@ -94,8 +97,5 @@ opts

// Load the applicable protos.
const protos = merge(
{},
gaxGrpc.loadProto(
path.join(__dirname, '..', '..', 'protos'),
'google/cloud/texttospeech/v1/cloud_tts.proto'
)
const protos = gaxGrpc.loadProto(
path.join(__dirname, '..', '..', 'protos'),
['google/cloud/texttospeech/v1/cloud_tts.proto']
);

@@ -153,2 +153,10 @@

/**
* The DNS address for this API service - same as servicePath(),
* exists for compatibility reasons.
*/
static get apiEndpoint() {
return 'texttospeech.googleapis.com';
}
/**
* The port for this API service.

@@ -197,3 +205,3 @@ */

* Optional parameters. You can override the default settings for this call, e.g, timeout,
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details.
* @param {function(?Error, ?Object)} [callback]

@@ -255,3 +263,3 @@ * The function which will be called with the result of the API call.

* Optional parameters. You can override the default settings for this call, e.g, timeout,
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details.
* @param {function(?Error, ?Object)} [callback]

@@ -258,0 +266,0 @@ * The function which will be called with the result of the API call.

@@ -19,3 +19,2 @@ // Copyright 2019 Google LLC

const gax = require('google-gax');
const merge = require('lodash.merge');
const path = require('path');

@@ -60,4 +59,8 @@

constructor(opts) {
opts = opts || {};
this._descriptors = {};
const servicePath =
opts.servicePath || opts.apiEndpoint || this.constructor.servicePath;
// Ensure that options include the service address and port.

@@ -68,3 +71,3 @@ opts = Object.assign(

port: this.constructor.port,
servicePath: this.constructor.servicePath,
servicePath,
},

@@ -94,8 +97,5 @@ opts

// Load the applicable protos.
const protos = merge(
{},
gaxGrpc.loadProto(
path.join(__dirname, '..', '..', 'protos'),
'google/cloud/texttospeech/v1beta1/cloud_tts.proto'
)
const protos = gaxGrpc.loadProto(
path.join(__dirname, '..', '..', 'protos'),
['google/cloud/texttospeech/v1beta1/cloud_tts.proto']
);

@@ -153,2 +153,10 @@

/**
* The DNS address for this API service - same as servicePath(),
* exists for compatibility reasons.
*/
static get apiEndpoint() {
return 'texttospeech.googleapis.com';
}
/**
* The port for this API service.

@@ -198,3 +206,3 @@ */

* Optional parameters. You can override the default settings for this call, e.g, timeout,
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details.
* @param {function(?Error, ?Object)} [callback]

@@ -256,3 +264,3 @@ * The function which will be called with the result of the API call.

* Optional parameters. You can override the default settings for this call, e.g, timeout,
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the details.
* retries, paginations, etc. See [gax.CallOptions]{@link https://googleapis.github.io/gax-nodejs/interfaces/CallOptions.html} for the details.
* @param {function(?Error, ?Object)} [callback]

@@ -259,0 +267,0 @@ * The function which will be called with the result of the API call.

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc