This may sound weird, or why do you want to do that.
I'm trying to write a cucumber feature to test uploading large image file (>16M) So, I don't want to store the large file on github or in my project. I'm using imagemagick to create an image but as far as I can do is just 1M. Can I increase the file size in ruby? I don't care about the content inside the file, just the file size. Thanks, is there anyway I could trick cucumber to believe me that I'm uploading a large file size?
Thanks
The
dd(1)
tool can make a file quite large while using very little disk space:The file
huge
looks to be 102400000 bytes long. (Roughly 98M.) But it only takes 12 kilobytes on disk, because theseek
parameter todd(1)
causes it to start writing way "into" the file. If the earlier bytes are read, the OS will supply an endless stream of zeros. (0x00 kind of zeros, not the ASCII kind of zeros: "0".)If you wanted to replicate this in Ruby, you'd use the
File#seek
function:Just ruby code: