pipe

User-space pipe for the Crystal programming language

pipe

Pipe provides reader and writer IOs, 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:

    dependencies:
      pipe:
        github: jgaskins/pipe
    
  2. Run shards install

Usage

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

Repository

pipe

Owner
Statistic
  • 1
  • 0
  • 0
  • 0
  • 0
  • 2 days ago
  • January 7, 2026
License

MIT License

Links
Synced at

Fri, 09 Jan 2026 10:39:50 GMT

Languages