Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

s4-client-lib

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

s4-client-lib

Client library for S4 clients. Provides the necessary API to convert a stream of incoming data into an HTTP request with necessary metadata in headers.

  • 2.1.1
  • latest
  • npm
  • Socket score

Version published
Weekly downloads
4
Maintainers
1
Weekly downloads
 
Created
Source

S4 Client Library

A client library developed on node.js that can be used to send data files to the S4 service for processing.

Contents

  • Overview
  • Installation
  • Usage

Overview

The goal of this library is to abstract from an end user application the mechanics of creating and dispatching HTTP requests, and handling coressponding responses. In addition to using this library in scenarios where the input data is a real time audio stream, it can also be used in test scenarios, where the data is read from a static file and sent to the server for testing/evaluation.

This documentation outlines how the library can be downloaded and used as a dependency to an application.

This library has been developed using JavaScript for the NodeJs engine, specifically version 10+ of NodeJS.

Installation

This library can be installed by using the npm tool as follows:

npm install git+https://gitlab.lyricsemiconductor.com/platformdevops/s4-client-lib.git

** NOTE: **

  • Use the --save option to save the dependency in your project's package.json file

Usage

Include the library in your code by using require:

var s4ClientLib = require('s4-client-lib');

Making Requests

Before data can be sent to a server, a new client object must be created as follows:

var client = new s4ClientLib.S4Client('http://asr.lyricsemiconductor.com/service_path', {
    apiKey: 'QRTV4Fh2W+ID',
    micConfig: '<mic config data>'
});

The first argument to the constructor is the url of the S4 service endpoint. The second argument is configuration information for the client request. Details are as follows:

  • apiKey: A shared secret key that the client can use to authenticate against the server
  • micConfig: A string that specifies the microphone configuration

Once a client object has been created, a data can be streamed to the service by invoking the sendStream(readable) method, with a readable stream as the first argument.

var stream = createStreamFromSource();
var promise = client.sendStream(stream);

Handling Responses

All requests made using the client object will return a promise that conforms to the (Promises/A+)[https://promisesaplus.com/] specification. Each promise supports a then method that can be invoked with a success handler and a failure handler, as shown below:

promise.then(function(response) {
    //Handle success here. The response parameter is the return object from the server.
}, function(err) {
    // Handle failure here. The err object contains details of the error that caused the failure.
});

Keywords

FAQs

Package last updated on 15 Jun 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc