npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

s4-client-lib

v2.1.1

Published

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.

Downloads

7

Readme

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

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.
});