How to use @aws-sdk/eventstream-marshaller - 3 common examples

To help you get started, we’ve selected a few @aws-sdk/eventstream-marshaller examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws-samples / amazon-transcribe-websocket-static / lib / main.js View on Github external
const audioUtils        = require('./audioUtils');  // for encoding audio data as PCM
const crypto            = require('crypto'); // tot sign our pre-signed URL
const v4                = require('./aws-signature-v4'); // to generate our pre-signed URL
const marshaller        = require("@aws-sdk/eventstream-marshaller"); // for converting binary event stream messages to and from JSON
const util_utf8_node    = require("@aws-sdk/util-utf8-node"); // utilities for encoding and decoding UTF8
const mic               = require('microphone-stream'); // collect microphone input as a stream of raw bytes

// our converter between binary event streams messages and JSON
const eventStreamMarshaller = new marshaller.EventStreamMarshaller(util_utf8_node.toUtf8, util_utf8_node.fromUtf8);

// our global variables for managing state
let languageCode;
let region;
let sampleRate;
let transcription = "";
let socket;
let micStream;
let socketError = false;
let transcribeException = false;

// check to see if the browser allows mic access
if (!window.navigator.mediaDevices.getUserMedia) {
    // Use our helper method to show an error on the page
    showError('We support the latest versions of Chrome, Firefox, Safari, and Edge. Update your browser and try your request again.');
github aws / aws-sdk-js-v3 / packages / util-eventstream-node / src / EventStreamMarshaller.ts View on Github external
constructor(toUtf8: Encoder, fromUtf8: Decoder) {
    this.eventMarshaller = new EventMarshaller(toUtf8, fromUtf8);
  }
  deserialize(
github aws-amplify / amplify-js / packages / predictions / src / Providers / AmazonAIConvertPredictionsProvider.ts View on Github external
import { AbstractConvertPredictionsProvider } from "../types/Providers/AbstractConvertPredictionsProvider";
import * as Translate from 'aws-sdk/clients/translate';
import * as TextToSpeech from 'aws-sdk/clients/polly';
import {
    TranslateTextInput, TextToSpeechInput,
    SpeechToTextInput, TranslateTextOutput, TextToSpeechOutput,
    SpeechToTextOutput, isBytesSource} from "../types";
import { Credentials, ConsoleLogger as Logger, Signer } from '@aws-amplify/core';
import { EventStreamMarshaller, MessageHeaderValue } from '@aws-sdk/eventstream-marshaller';
import { fromUtf8, toUtf8 } from '@aws-sdk/util-utf8-node';

const logger = new Logger('AmazonAIConvertPredictionsProvider');
const eventBuilder = new EventStreamMarshaller(toUtf8, fromUtf8);

export default class AmazonAIConvertPredictionsProvider extends AbstractConvertPredictionsProvider {

    private translate: Translate;
    private textToSpeech: TextToSpeech;
    constructor() {
        super();
    }

    getProviderName() {
        return "AmazonAIConvertPredictionsProvider";
    }

    protected translateText(input: TranslateTextInput): Promise {
        logger.debug("Starting translation");
        return new Promise(async (res, rej) => {

@aws-sdk/eventstream-marshaller

[![NPM version](https://img.shields.io/npm/v/@aws-sdk/eventstream-marshaller/latest.svg)](https://www.npmjs.com/package/@aws-sdk/eventstream-marshaller) [![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/eventstream-marshaller.svg)](https://www.npmj

Apache-2.0
Latest version published 2 years ago

Package Health Score

70 / 100
Full package analysis

Popular @aws-sdk/eventstream-marshaller functions

Similar packages