https://github.com/scalajs-io/throttle
Node.js Transform stream that passes data through at n bytes per second
https://github.com/scalajs-io/throttle
Last synced: 4 months ago
JSON representation
Node.js Transform stream that passes data through at n bytes per second
- Host: GitHub
- URL: https://github.com/scalajs-io/throttle
- Owner: scalajs-io
- License: apache-2.0
- Created: 2017-03-07T03:16:19.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2019-06-17T23:11:25.000Z (about 6 years ago)
- Last Synced: 2025-01-17T22:42:26.295Z (5 months ago)
- Language: Scala
- Size: 13.7 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Throttle API for Scala.js
================================
[throttle](https://www.npmjs.com/package/throttle) - Node.js Transform stream that passes data through at n bytes per second.### Description
This module offers a Throttle passthrough stream class, which allows you to write data to it and it will be passed
through in n bytes per second. It can be useful for throttling HTTP uploads or to simulate reading from a file in
real-time, etc.### Build Dependencies
* [SBT v1.2.x](http://www.scala-sbt.org/download.html)
### Build/publish the SDK locally
```bash
$ sbt clean publish-local
```### Running the tests
Before running the tests the first time, you must ensure the npm packages are installed:
```bash
$ npm install
```Then you can run the tests:
```bash
$ sbt test
```### Examples
```scala
import io.scalajs.nodejs.process
import io.scalajs.npm.throttle._process.stdin.pipe(new Throttle(100 * 1024)).pipe(process.stdout)
```### Artifacts and Resolvers
To add the `Throttle` binding to your project, add the following to your build.sbt:
```sbt
libraryDependencies += "io.scalajs.npm" %%% "throttle" % "0.5.0"
```Optionally, you may add the Sonatype Repository resolver:
```sbt
resolvers += Resolver.sonatypeRepo("releases")
```