New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

calm-lake

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

calm-lake

A stable stream with a buffer like calm lake.

latest
Source
npmnpm
Version
0.1.1
Version published
Maintainers
1
Created
Source

Calm Lake

I want to use a stable stream but there are so many unexpected situations.

Rationale

In mobile, a stream can be broken in many reasons such as changing network AP, signal weakness or a failure from the back-end. If a stream is stable, of course it can be not perfect, I think it will be very useful because we can delete many exception-catch codes.

Examples

Google Speech-to-text Streaming

// First, create a stream proxy with Google Speech-to-text stream.
class GoogleStreamProxy extends BasicStreamProxy<Buffer, SpeechEvent> {
  constructor(
    controller: StreamProxyController,
    private readonly recognizeStream: NodeJS.WritableStream,
  ) {
    super();
    this.recognizeStream
      .on('error', error => this.fire('error', error))
      .on('data', data => {
        this.fire('data', data);
        // https://github.com/vin-ni/Google-Cloud-Speech-Node-Socket-Playground/issues/9
        if (/* is end of utterance */) {
          controller.goNextProxy();
        }
      });
  }

  public send = (data: Buffer) => {
    this.recognzeStream.write(data);
  }

  public destroy = () => {
    this.recognizeStream.end();
  }
}

// Make a lake to be calm.
const lake = calm(async controller => new GoogleStreamProxy(
  controller,
  googleSpeechClient.streamingRecognize(/*request*/)),
)
  .on('data', console.info)
  .on('error', console.warn);

// Send a data into a lake.
lake.send(audioBuffer);

License

MIT

Keywords

stable

FAQs

Package last updated on 28 Mar 2019

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