pipe

Version, currently main branch1 version
  • main branchlatestJun 28, 2026

github.com/jgaskins/pipe

User-space pipe for the Crystal programming language

11 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  pipe:
    github: jgaskins/pipe
    branch: main

main is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
>= 1.18.2
License
MIT
Author
Jamie Gaskins <jgaskins@hey.com>

Dependencies

This version declares no dependencies.

README

# pipe

`Pipe` provides reader and writer `IO`s, similar to `IO.pipe`. The main difference is that `IO.pipe` uses kernel-level file descriptors, but `Pipe::Reader` and `Pipe::Writer` live entirely in user-space. This avoids consuming file descriptors on systems where they are limited and ends up being much lighter weight.

## Installation

1. Add the dependency to your `shard.yml`:

   ```yaml
   dependencies:
     pipe:
       github: jgaskins/pipe
   ```

2. Run `shards install`

## Usage

```crystal
require "pipe"

reader, writer = Pipe.create

spawn do
  # Avoid generating the entire JSON blob in RAM
  JSON.build writer do |json|
    json.array do
      10_000_000.times do |i|
        json.scalar i
      end
    end
  end
ensure
  writer.close
end

HTTP::Client.post "http://localhost:3000/data", body: reader
```

## Contributing

1. Fork it (<https://github.com/jgaskins/pipe/fork>)
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create a new Pull Request

## Contributors

- [Jamie Gaskins](https://github.com/jgaskins) - creator and maintainer