Skip to content

An alternative for generating temporary files with Ruby

Notifications You must be signed in to change notification settings

joerixaop/file-temp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

== Description
   The file-temp library is an alternate way to handle tempfile generation.

== Requirements
   ffi 0.5.0 or later

== Synopsis
   require 'file/temp'

   fh = File::Temp.new
   fh.puts "hello"
   fh.close # => Tempfile automatically deleted

   fh = File::Temp.new(false)
   fh.puts "world"
   fh.close # => Tempfile still on your filesystem

== Installation
=== Rubygems
   gem install file-temp
   
=== Standard Installation
   rake test (optional)
   rake install

== Motivation
   Ruby's tempfile.rb is overwrought and susceptible to race conditions. This
   This library uses your system's native tmpfile() or mkstemp() functions
   instead of trying to handle race conditions manually via pure Ruby.
   
   This library is also more secure because it restricts file permission via
   umask() for files created with mkstemp().

   Finally, this library subclasses the File class. This means you get almost
   exactly the same interface as the File class. The only difference is the
   constructor.

== JRuby
   As of JRuby 1.4.0 this library will not work with JRuby because it does
   not support low level systems programming.

== MS Windows
   You may need to use the mingw build in order to use this library.

== License
   Artistic 2.0

== Copyright
   (C) 2007-2009 Daniel J. Berger
   All Rights Reserved

== Warranty
   This library is provided "as is" and without any express or
   implied warranties, including, without limitation, the implied
   warranties of merchantability and fitness for a particular purpose.

== Author
   Daniel J. Berger

== See also
   tmpfile(), mkstemp(), tmpnam()

About

An alternative for generating temporary files with Ruby

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Ruby 100.0%