Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ardalanamini committed May 17, 2019
0 parents commit 701ad37
Show file tree
Hide file tree
Showing 39 changed files with 8,098 additions and 0 deletions.
88 changes: 88 additions & 0 deletions .gitignore
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
3 changes: 3 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"trailingComma": "all"
}
24 changes: 24 additions & 0 deletions .travis.yml
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
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
18 changes: 18 additions & 0 deletions CHANGELOG.md
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
21 changes: 21 additions & 0 deletions LICENSE
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.
61 changes: 61 additions & 0 deletions README.md
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
1 change: 1 addition & 0 deletions _config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
theme: jekyll-theme-cayman
39 changes: 39 additions & 0 deletions benchmarks/README.md
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
```
18 changes: 18 additions & 0 deletions benchmarks/duplex-init.js
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 });
18 changes: 18 additions & 0 deletions benchmarks/readable-init.js
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 });
28 changes: 28 additions & 0 deletions benchmarks/readable-push-read-partial.js
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 });
28 changes: 28 additions & 0 deletions benchmarks/readable-push-read.js
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 });
13 changes: 13 additions & 0 deletions benchmarks/start.sh
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
18 changes: 18 additions & 0 deletions benchmarks/writable-init.js
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 });
Loading

0 comments on commit 701ad37

Please sign in to comment.