Project

sendfile

0.02
No commit activity in last 3 years
No release in over 3 years
Allows Ruby programs to access sendfile(2) functionality on any IO object. Works on Linux, Solaris, FreeBSD and Darwin with blocking and non-blocking sockets.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Ruby sendfile(2) Interface

This module allows Ruby programs to access their OS’s native sendfile(2) system call from any IO object. Your kernel must export a recognized signature for the sendfile(2) system call to use this module. Currently, that includes Linux, Solaris and FreeBSD.

Installation

Download and install the latest package from the rubyforge.org RubyGems repository.

$ gem install sendfile

If the tests all pass, you’re ready to start using sendfile!

Usage

Here’s a small example of a use of IO#sendfile.

require 'socket'
require 'rubygems'
require 'sendfile'
s = TCPSocket.new 'yourdomain.com', 5000
File.open 'somefile.txt' { |f| s.sendfile f }
s.close

See the test scripts for more examples on how to use this module.