るりまサーチ (Ruby 2.3.0)

最速Rubyリファレンスマニュアル検索!
1件ヒット [1-1件を表示] (0.016秒)

別のキーワード

  1. tempfile open
  2. tempfile create
  3. tempfile size
  4. tempfile new
  5. tempfile close!

ライブラリ

クラス

検索結果

File::Stat#size? -> Integer | nil (54376.0)

サイズが0の時にはnil、それ以外の場合はファイルサイズを返します。

サイズが0の時にはnil、それ以外の場合はファイルサイズを返します。

//emlist[][ruby]{
require 'tempfile'

fp = Tempfile.new("temp")
p fp.size #=> 0
p File::Stat.new(fp.path).size? #=> nil
fp.print "not 0 "
fp.close
p FileTest.exist?(fp.path) #=> true
p File::Stat.new(fp.path).size? #=> 6
//}