Our client libraries follow theNode.js release schedule.
Libraries are compatible with all currentactiveandmaintenanceversions of
Node.js.
If you are using an end-of-life version of Node.js, we recommend that you update
as soon as possible to an actively supported LTS version.
Google's client libraries support legacy versions of Node.js runtimes on a
best-efforts basis with the following warnings:
Legacy versions are not tested in continuous integration.
Some security patches and features cannot be backported.
Dependencies cannot be kept up-to-date.
Client libraries targeting some end-of-life versions of Node.js are available, and
can be installed through npmdist-tags.
The dist-tags follow the naming conventionlegacy-(version).
For example,npm install @google-cloud/media-translation@legacy-8installs client libraries
for versions compatible with Node.js 8.
This library is considered to bestable. The code surface will not change in backwards-incompatible ways
unless absolutely necessary (e.g. because of critical security issues) or with
an extensive deprecation period. Issues and requests againststablelibraries
are addressed with the highest priority.
Please note that thisREADME.md, thesamples/README.md,
and a variety of configuration files in this repository (including.nycrcandtsconfig.json)
are generated from a central template. To edit one of these files, make an edit
to its templates indirectory.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-09-04 UTC."],[],[],null,["Version latestkeyboard_arrow_down\n\n- [5.1.0 (latest)](/nodejs/docs/reference/media-translation/latest)\n- [4.0.2](/nodejs/docs/reference/media-translation/4.0.2)\n- [3.1.2](/nodejs/docs/reference/media-translation/3.1.2)\n- [3.0.5](/nodejs/docs/reference/media-translation/3.0.5)\n- [2.4.0](/nodejs/docs/reference/media-translation/2.4.0)\n- [2.3.4](/nodejs/docs/reference/media-translation/2.3.4)\n- [2.2.3](/nodejs/docs/reference/media-translation/2.2.3) \n\n[Cloud Media Translation: Node.js Client](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-mediatranslation)\n===========================================================================================================================================\n\n[](https://cloud.google.com/terms/launch-stages)\n[](https://www.npmjs.org/package/@google-cloud/media-translation)\n\nMediatranslation client for Node.js\n\nA comprehensive list of changes in each version may be found in\n[the CHANGELOG](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-mediatranslation/CHANGELOG.md).\n\n- [Cloud Media Translation Node.js Client API Reference](https://cloud.google.com/nodejs/docs/reference/media-translation/latest)\n- [Cloud Media Translation Documentation](https://cloud.google.com/translate/media/docs/)\n- [github.com/googleapis/google-cloud-node/packages/media-translatation](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-mediatranslation)\n\nRead more about the client libraries for Cloud APIs, including the older\nGoogle APIs Client Libraries, in [Client Libraries Explained](https://cloud.google.com/apis/docs/client-libraries-explained).\n\n**Table of contents:**\n\n- [Quickstart](#quickstart)\n - [Before you begin](#before-you-begin)\n - [Installing the client library](#installing-the-client-library)\n - [Using the client library](#using-the-client-library)\n- [Samples](#samples)\n- [Versioning](#versioning)\n- [Contributing](#contributing)\n- [License](#license)\n\nQuickstart\n----------\n\n### Before you begin\n\n1. [Select or create a Cloud Platform project](https://console.cloud.google.com/project).\n2. [Enable billing for your project](https://support.google.com/cloud/answer/6293499#enable-billing).\n3. [Enable the Cloud Media Translation API](https://console.cloud.google.com/flows/enableapi?apiid=mediatranslation.googleapis.com).\n4. [Set up authentication](https://cloud.google.com/docs/authentication/external/set-up-adc-local) so you can access the API from your local workstation.\n\n### Installing the client library\n\n npm install @google-cloud/media-translation\n\n### Using the client library\n\n const fs = require('fs');\n\n // Imports the CLoud Media Translation client library\n const {\n SpeechTranslationServiceClient,\n } = require('https://cloud.google.com/nodejs/docs/reference/media-translation/latest/overview.html');\n\n // Creates a client\n const client = new https://cloud.google.com/nodejs/docs/reference/media-translation/latest/overview.html();\n\n async function quickstart() {\n /**\n * TODO(developer): Uncomment the following lines before running the sample.\n */\n // const filename = 'Local path to audio file, e.g. /path/to/audio.raw';\n // const encoding = 'Encoding of the audio file, e.g. LINEAR16';\n // const sourceLanguage = 'BCP-47 source language code, e.g. en-US';\n // const targetLanguage = 'BCP-47 target language code, e.g. es-ES';\n\n const config = {\n audioConfig: {\n audioEncoding: encoding,\n sourceLanguageCode: sourceLanguage,\n targetLanguageCode: targetLanguage,\n },\n };\n\n // First request needs to have only a streaming config, no data.\n const initialRequest = {\n streamingConfig: config,\n audioContent: null,\n };\n\n const readStream = fs.createReadStream(filename, {\n highWaterMark: 4096,\n encoding: 'base64',\n });\n\n const chunks = [];\n readStream\n .on('data', chunk =\u003e {\n const request = {\n streamingConfig: config,\n audioContent: chunk.toString(),\n };\n chunks.push(request);\n })\n .on('https://cloud.google.com/nodejs/docs/reference/media-translation/latest/media-translation/v1beta1.speechtranslationserviceclient.html', () =\u003e {\n // Config-only request should be first in stream of requests\n stream.write(initialRequest);\n for (let i = 0; i \u003c chunks.length; i++) {\n stream.write(chunks[i]);\n }\n stream.end();\n });\n\n const stream = client.streamingTranslateSpeech().on('data', response =\u003e {\n const {result} = response;\n if (result.textTranslationResult.isFinal) {\n console.log(\n `\\nFinal translation: ${result.textTranslationResult.translation}`\n );\n console.log(`Final recognition result: ${result.recognitionResult}`);\n } else {\n console.log(\n `\\nPartial translation: ${result.textTranslationResult.translation}`\n );\n console.log(`Partial recognition result: ${result.recognitionResult}`);\n }\n });\n\nSamples\n-------\n\nSamples are in the [`samples/`](https://github.com/googleapis/google-cloud-node/tree/main/packages/google-cloud-mediatranslation/samples) directory. Each sample's `README.md` has instructions for running its sample.\n\nThe [Cloud Media Translation Node.js Client API Reference](https://cloud.google.com/nodejs/docs/reference/media-translation/latest) documentation\nalso contains samples.\n\nSupported Node.js Versions\n--------------------------\n\nOur client libraries follow the [Node.js release schedule](https://github.com/nodejs/release#release-schedule).\nLibraries are compatible with all current *active* and *maintenance* versions of\nNode.js.\nIf you are using an end-of-life version of Node.js, we recommend that you update\nas soon as possible to an actively supported LTS version.\n\nGoogle's client libraries support legacy versions of Node.js runtimes on a\nbest-efforts basis with the following warnings:\n\n- Legacy versions are not tested in continuous integration.\n- Some security patches and features cannot be backported.\n- Dependencies cannot be kept up-to-date.\n\nClient libraries targeting some end-of-life versions of Node.js are available, and\ncan be installed through npm [dist-tags](https://docs.npmjs.com/cli/dist-tag).\nThe dist-tags follow the naming convention `legacy-(version)`.\nFor example, `npm install @google-cloud/media-translation@legacy-8` installs client libraries\nfor versions compatible with Node.js 8.\n\nVersioning\n----------\n\nThis library follows [Semantic Versioning](http://semver.org/).\n\nThis library is considered to be **stable** . The code surface will not change in backwards-incompatible ways\nunless absolutely necessary (e.g. because of critical security issues) or with\nan extensive deprecation period. Issues and requests against **stable** libraries\nare addressed with the highest priority.\n\nMore Information: [Google Cloud Platform Launch Stages](https://cloud.google.com/terms/launch-stages)\n\nContributing\n------------\n\nContributions welcome! See the [Contributing Guide](https://github.com/googleapis/google-cloud-node/blob/main/CONTRIBUTING.md).\n\nPlease note that this `README.md`, the `samples/README.md`,\nand a variety of configuration files in this repository (including `.nycrc` and `tsconfig.json`)\nare generated from a central template. To edit one of these files, make an edit\nto its templates in\n[directory](https://github.com/googleapis/synthtool).\n\nLicense\n-------\n\nApache Version 2.0\n\nSee [LICENSE](https://github.com/googleapis/google-cloud-node/blob/main/LICENSE)"]]