Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"parserOptions": {
"ecmaVersion": 5
},
"extends": "eslint:recommended",
"env": {
"node": true,
"commonjs": true
},
"rules": {
"strict": [2, "global"],
"block-scoped-var": 2,
"consistent-return": 2,
"eqeqeq": [2, "smart"],
"guard-for-in": 2,
"no-caller": 2,
"no-extend-native": 2,
"no-loop-func": 2,
"no-new": 2,
"no-param-reassign": 2,
"no-return-assign": 2,
"no-unused-expressions": 2,
"no-use-before-define": 2,
"radix": [2, "always"],
"indent": [2, 2],
"quotes": [2, "double"],
"semi": [2, "always"]
}
}
17 changes: 0 additions & 17 deletions .jscsrc

This file was deleted.

19 changes: 0 additions & 19 deletions .jshintrc

This file was deleted.

2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

A wrapper for Node's [Stream API](https://nodejs.org/api/stream.html).

See the `example` directory for a usage example.

## Installation

```
Expand Down
8 changes: 2 additions & 6 deletions example/Gzip.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
/* global exports */
/* global require */
"use strict";

// module Gzip

exports.gzip = require('zlib').createGzip;
exports.gzip = require("zlib").createGzip;
exports.fileStream = require("fs").createReadStream("example/Gzip.txt");
exports.stdout = process.stdout;
exports.stdin = process.stdin;
16 changes: 9 additions & 7 deletions example/Gzip.purs
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,20 @@ module Gzip where

import Prelude

import Node.Stream

import Control.Monad.Eff
import Control.Monad.Eff.Console
import Control.Monad.Eff (Eff, kind Effect)
import Control.Monad.Eff.Console (CONSOLE, log)
import Node.Stream (Duplex, Readable, Writable, onEnd, pipe)

foreign import data GZIP :: Effect

foreign import gzip :: forall eff. Eff (gzip :: GZIP | eff) (Duplex (gzip :: GZIP | eff))
foreign import stdin :: forall eff. Readable () (console :: CONSOLE | eff)
foreign import fileStream :: forall eff. Readable () (console :: CONSOLE | eff)
foreign import stdout :: forall eff. Writable () (console :: CONSOLE | eff)

main :: forall eff. Eff (gzip :: GZIP, console :: CONSOLE | eff) Unit
main = do
z <- gzip
_ <- stdin `pipe` z
z `pipe` stdout
_ <- fileStream `pipe` z
_ <- z `pipe` stdout
void <<< onEnd fileStream $
log "Done reading file, gzip output below"
1 change: 1 addition & 0 deletions example/Gzip.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Compress me pretty please!
Loading