title: Issues getting all data from an image file using Lua io.read('*a')
body: <p>I'm trying to get all the data from image file (jpg/jpeg/gif/png/bmp etc.) use Lua's io.read() function, but I'm not having much luck as it only seems to read a small piece of the data.</p>
  
  <p>As a side note all plain text files are being read just fine, so I'm assuming that the problem is with character encoding or some such thing.</p>
  
  <p>Example:</p>
  
  <pre><code>local data
  local fileHandle
  
  fileHandle = io.open ( 'pic.jpg')
  data = fileHandle:read('*a')
  
  print(data)
  </code></pre>