# Tempfile should be binary by default, or at least a flag

**URL:** <https://www.ruby-forum.com/t/tempfile-should-be-binary-by-default-or-at-least-a-flag/65911>\
**Category:** Ruby\
**Created:** [August 22, 2006, 11:05am UTC](https://www.ruby-forum.com/t/tempfile-should-be-binary-by-default-or-at-least-a-flag/65911 "2006-08-22T11:05:22Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![benhiller](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/b/8e7dd6/32.png) [@benhiller](https://www.ruby-forum.com/u/benhiller)\
**Post date:** [August 22, 2006, 11:05am UTC](https://www.ruby-forum.com/t/tempfile-should-be-binary-by-default-or-at-least-a-flag/65911/1 "2006-08-22T11:05:22Z")

</div>

Shouldn’t tempfile open it’s file in binary mode by default?

One can of course call .binmode immediately after creating the tempfile,  
but doesn’t binary by default make more sense in the case of a temporary  
file?

If it’s too late to change the default behaviour, then perhaps  
tempfile.new should accept a flag parameter?
