code: def fromfile(file, dtype, count, *args, **kwargs):
      
      try:
          return numpy.fromfile(file, dtype=dtype, count=count, *args, **kwargs)
      except (TypeError, IOError):
          return numpy.frombuffer(file.read(count * numpy.dtype(dtype).itemsize),
                                  dtype=dtype, count=count, *args, **kwargs)
docs: Wrapper around np.fromfile to support any file-like object.