-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 701ad37
Showing
39 changed files
with
8,098 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# Logs | ||
logs | ||
*.log | ||
npm-debug.log* | ||
yarn-debug.log* | ||
yarn-error.log* | ||
lerna-debug.log* | ||
|
||
# Diagnostic reports (https://nodejs.org/api/report.html) | ||
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json | ||
|
||
# Runtime data | ||
pids | ||
*.pid | ||
*.seed | ||
*.pid.lock | ||
|
||
# Directory for instrumented libs generated by jscoverage/JSCover | ||
lib-cov | ||
|
||
# Coverage directory used by tools like istanbul | ||
coverage | ||
|
||
# nyc test coverage | ||
.nyc_output | ||
|
||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files) | ||
.grunt | ||
|
||
# Bower dependency directory (https://bower.io/) | ||
bower_components | ||
|
||
# node-waf configuration | ||
.lock-wscript | ||
|
||
# Compiled binary addons (https://nodejs.org/api/addons.html) | ||
build/Release | ||
|
||
# Dependency directories | ||
node_modules/ | ||
jspm_packages/ | ||
|
||
# TypeScript v1 declaration files | ||
typings/ | ||
|
||
# Optional npm cache directory | ||
.npm | ||
|
||
# Optional eslint cache | ||
.eslintcache | ||
|
||
# Optional REPL history | ||
.node_repl_history | ||
|
||
# Output of 'npm pack' | ||
*.tgz | ||
|
||
# Yarn Integrity file | ||
.yarn-integrity | ||
|
||
# dotenv environment variables file | ||
.env | ||
.env.test | ||
|
||
# parcel-bundler cache (https://parceljs.org/) | ||
.cache | ||
|
||
# next.js build output | ||
.next | ||
|
||
# nuxt.js build output | ||
.nuxt | ||
|
||
# vuepress build output | ||
.vuepress/dist | ||
|
||
# Serverless directories | ||
.serverless/ | ||
|
||
# FuseBox cache | ||
.fusebox/ | ||
|
||
# DynamoDB Local files | ||
.dynamodb/ | ||
|
||
dist/ | ||
|
||
tsconfig.tsbuildinfo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"trailingComma": "all" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
language: node_js | ||
|
||
os: | ||
- linux | ||
- osx | ||
|
||
node_js: | ||
- "8" | ||
- "9" | ||
- "10" | ||
- "11" | ||
- "12" | ||
|
||
script: | ||
- npm run codecov | ||
|
||
cache: | ||
directories: | ||
- "node_modules" | ||
|
||
notifications: | ||
email: | ||
on_success: never | ||
on_failure: always |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"typescript.tsdk": "node_modules/typescript/lib" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Changelog | ||
|
||
## Emojis | ||
|
||
- New Features -> :zap: | ||
- Enhancements -> :star2: | ||
- Breaking Changes -> :boom: | ||
- Dependency Changes -> :package: | ||
- Bugs -> :beetle: | ||
- Pull Requests -> :book: | ||
- Documents -> :mortar_board: | ||
- Tests -> :eyeglasses: | ||
|
||
--- | ||
|
||
## [v1.0.0](https://github.com/foxifyjs/stream/releases/tag/v1.0.0) - _(2019-05-17)_ | ||
|
||
- :tada: First Release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2019 Ardalan Amini | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Stream <!-- omit in toc --> | ||
|
||
`@foxify/stream` is a high performance Stream alternative for Node.js and browser that has been optimized to be faster than the native version, (why not?!). | ||
|
||
[![NPM Version](https://img.shields.io/npm/v/@foxify/stream.svg)](https://www.npmjs.com/package/@foxify/stream) | ||
[![TypeScript Version](https://img.shields.io/npm/types/@foxify/stream.svg)](https://www.typescriptlang.org) | ||
[![npm bundle size (minified)](https://img.shields.io/bundlephobia/min/@foxify/stream.svg)](https://www.npmjs.com/package/@foxify/stream) | ||
[![npm bundle size (minified + gzip)](https://img.shields.io/bundlephobia/minzip/@foxify/stream.svg)](https://www.npmjs.com/package/@foxify/stream) | ||
[![Tested With Jest](https://img.shields.io/badge/tested_with-jest-99424f.svg)](https://github.com/facebook/jest) | ||
[![Pull Requests](https://img.shields.io/badge/PRs-Welcome-brightgreen.svg)](https://github.com/foxifyjs/stream/pulls) | ||
[![License](https://img.shields.io/github/license/foxifyjs/stream.svg)](https://github.com/foxifyjs/stream/blob/master/LICENSE) | ||
[![Build Status](https://api.travis-ci.com/foxifyjs/stream.svg?branch=master)](https://travis-ci.com/foxifyjs/stream) | ||
[![Coverage Status](https://codecov.io/gh/foxifyjs/stream/branch/master/graph/badge.svg)](https://codecov.io/gh/foxifyjs/stream) | ||
[![Package Quality](http://npm.packagequality.com/shield/%40foxify%2Fodin.svg)](http://packagequality.com/#?package=@foxify/stream) | ||
[![Dependencies Status](https://david-dm.org/foxifyjs/stream.svg)](https://david-dm.org/foxifyjs/stream) | ||
[![NPM Total Downloads](https://img.shields.io/npm/dt/@foxify/stream.svg)](https://www.npmjs.com/package/@foxify/stream) | ||
[![NPM Monthly Downloads](https://img.shields.io/npm/dm/@foxify/stream.svg)](https://www.npmjs.com/package/@foxify/stream) | ||
[![Open Issues](https://img.shields.io/github/issues-raw/foxifyjs/stream.svg)](https://github.com/foxifyjs/stream/issues?q=is%3Aopen+is%3Aissue) | ||
[![Closed Issues](https://img.shields.io/github/issues-closed-raw/foxifyjs/stream.svg)](https://github.com/foxifyjs/stream/issues?q=is%3Aissue+is%3Aclosed) | ||
[![known vulnerabilities](https://snyk.io/test/github/foxifyjs/stream/badge.svg?targetFile=package.json)](https://snyk.io/test/github/foxifyjs/stream?targetFile=package.json) | ||
[![Github Stars](https://img.shields.io/github/stars/foxifyjs/stream.svg?style=social)](https://github.com/foxifyjs/stream) | ||
[![Github Forks](https://img.shields.io/github/forks/foxifyjs/stream.svg?style=social&label=Fork)](https://github.com/foxifyjs/stream) | ||
|
||
This module is API compatible with the Stream that ships by default with Node.js but there are some slight differences: | ||
|
||
- Uses [`@foxify/events`](https://github.com/foxifyjs/events) as the EventEmitter. | ||
- The `emitClose` option is not available. | ||
|
||
## Table of Contents <!-- omit in toc -->## Installation | ||
|
||
```bash | ||
npm i @foxify/events | ||
``` | ||
|
||
## Usage | ||
|
||
```js | ||
const { EventEmitter } = require("@foxify/events"); | ||
``` | ||
|
||
For the API documentation, please follow the official Node.js [documentation](https://nodejs.org/api/stream.html). | ||
|
||
## Benchmarks | ||
|
||
```bash | ||
npm run benchmarks | ||
``` | ||
|
||
## Versioning | ||
|
||
We use [SemVer](http://semver.org) for versioning. For the versions available, see the [tags on this repository](https://github.com/foxifyjs/stream/tags). | ||
|
||
## Authors | ||
|
||
- **Ardalan Amini** - *Core Maintainer* - [@ardalanamini](https://github.com/ardalanamini) | ||
|
||
See also the list of [contributors](https://github.com/foxifyjs/stream/contributors) who participated in this project. | ||
|
||
## License | ||
|
||
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
theme: jekyll-theme-cayman |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# Benchmarks | ||
|
||
```bash | ||
Starting benchmark writable-init.js | ||
|
||
stream x 6,868,577 ops/sec ±0.55% (84 runs sampled) | ||
@foxify/stream x 16,114,537 ops/sec ±1.03% (85 runs sampled) | ||
Fastest is @foxify/stream | ||
|
||
Starting benchmark readable-init.js | ||
|
||
stream x 9,383,906 ops/sec ±0.63% (91 runs sampled) | ||
@foxify/stream x 21,576,924 ops/sec ±0.38% (91 runs sampled) | ||
Fastest is @foxify/stream | ||
|
||
Starting benchmark readable-push-read.js | ||
|
||
stream x 2,616,205 ops/sec ±4.77% (73 runs sampled) | ||
@foxify/stream x 7,178,360 ops/sec ±2.58% (79 runs sampled) | ||
Fastest is @foxify/stream | ||
|
||
Starting benchmark writable-write.js | ||
|
||
stream x 3,385,225 ops/sec ±5.04% (69 runs sampled) | ||
@foxify/stream x 29,699,009 ops/sec ±2.83% (81 runs sampled) | ||
Fastest is @foxify/stream | ||
|
||
Starting benchmark readable-push-read-partial.js | ||
|
||
stream x 4,211 ops/sec ±0.40% (89 runs sampled) | ||
@foxify/stream x 4,199 ops/sec ±0.94% (86 runs sampled) | ||
Fastest is stream,@foxify/stream | ||
|
||
Starting benchmark duplex-init.js | ||
|
||
stream x 4,067,127 ops/sec ±0.41% (89 runs sampled) | ||
@foxify/stream x 11,110,275 ops/sec ±0.66% (87 runs sampled) | ||
Fastest is @foxify/stream | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const { Suite } = require("benchmark"); | ||
const { Duplex } = require("stream"); | ||
const { Duplex: FoxifyDuplex } = require(".."); | ||
|
||
new Suite() | ||
.add("stream", () => { | ||
const duplex = new Duplex(); | ||
}) | ||
.add("@foxify/stream", () => { | ||
const duplex = new FoxifyDuplex(); | ||
}) | ||
.on("cycle", e => { | ||
console.log(e.target.toString()); | ||
}) | ||
.on("complete", function onComplete() { | ||
console.log("Fastest is %s", this.filter("fastest").map("name")); | ||
}) | ||
.run({ async: true }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const { Suite } = require("benchmark"); | ||
const { Readable } = require("stream"); | ||
const { Readable: FoxifyReadable } = require(".."); | ||
|
||
new Suite() | ||
.add("stream", () => { | ||
const readable = new Readable(); | ||
}) | ||
.add("@foxify/stream", () => { | ||
const readable = new FoxifyReadable(); | ||
}) | ||
.on("cycle", e => { | ||
console.log(e.target.toString()); | ||
}) | ||
.on("complete", function onComplete() { | ||
console.log("Fastest is %s", this.filter("fastest").map("name")); | ||
}) | ||
.run({ async: true }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const { Suite } = require("benchmark"); | ||
const { Readable } = require("stream"); | ||
const { Readable: FoxifyReadable } = require(".."); | ||
|
||
const buffer = Buffer.alloc(1024 * 1024); | ||
|
||
function read() { | ||
} | ||
|
||
const readable = new Readable({ read }); | ||
const foxifyReadable = new FoxifyReadable({ read }); | ||
|
||
new Suite() | ||
.add("stream", () => { | ||
readable.push(buffer); | ||
while (readable.read(1024)); | ||
}) | ||
.add("@foxify/stream", () => { | ||
foxifyReadable.push(buffer); | ||
while (foxifyReadable.read(1024)); | ||
}) | ||
.on("cycle", e => { | ||
console.log(e.target.toString()); | ||
}) | ||
.on("complete", function onComplete() { | ||
console.log("Fastest is %s", this.filter("fastest").map("name")); | ||
}) | ||
.run({ async: true }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
const { Suite } = require("benchmark"); | ||
const { Readable } = require("stream"); | ||
const { Readable: FoxifyReadable } = require(".."); | ||
|
||
const buffer = Buffer.alloc(1024 * 1024); | ||
|
||
function read() { | ||
} | ||
|
||
const readable = new Readable({ read }); | ||
const foxifyReadable = new FoxifyReadable({ read }); | ||
|
||
new Suite() | ||
.add("stream", () => { | ||
readable.push(buffer); | ||
readable.read(); | ||
}) | ||
.add("@foxify/stream", () => { | ||
foxifyReadable.push(buffer); | ||
foxifyReadable.read(); | ||
}) | ||
.on("cycle", e => { | ||
console.log(e.target.toString()); | ||
}) | ||
.on("complete", function onComplete() { | ||
console.log("Fastest is %s", this.filter("fastest").map("name")); | ||
}) | ||
.run({ async: true }); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
#!/usr/bin/env bash | ||
|
||
if [ $# -eq 0 ]; then | ||
echo "usage: $0 <benchmark>" | ||
exit 1 | ||
fi | ||
|
||
benchmark=$1 | ||
|
||
echo Starting benchmark "${benchmark##*/}" | ||
echo | ||
node "$benchmark" | ||
echo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
const { Suite } = require("benchmark"); | ||
const { Writable } = require("stream"); | ||
const { Writable: FoxifyWritable } = require(".."); | ||
|
||
new Suite() | ||
.add("stream", () => { | ||
const writable = new Writable(); | ||
}) | ||
.add("@foxify/stream", () => { | ||
const writable = new FoxifyWritable(); | ||
}) | ||
.on("cycle", e => { | ||
console.log(e.target.toString()); | ||
}) | ||
.on("complete", function onComplete() { | ||
console.log("Fastest is %s", this.filter("fastest").map("name")); | ||
}) | ||
.run({ async: true }); |
Oops, something went wrong.