title: Convert bytes into BufferedReader in python
body: <p>I have a bytearray and want to convert into a buffered reader. A way of doing it is to write the bytes into a file and read them again.</p>
  
  <pre><code>sample_bytes = bytes('this is a sample bytearray','utf-8')
  with open(path,'wb') as f:
      f.write(sample_bytes)
  with open(path,'rb') as f:
      extracted_bytes = f.read()
  print(type(f))
  </code></pre>
  
  <p>output:</p>
  
  <pre><code>&lt;class '_io.BufferedReader'&gt;
  </code></pre>
  
  <p>But I want these file-like features without having to save bytes into a file. In other words I want to wrap these bytes into a buffered reader so I can apply <code>read()</code> method on it without having to save to local disk. I tried the code below</p>
  
  <pre><code>from io import BufferedReader
  sample_bytes=bytes('this is a sample bytearray','utf-8')
  file_like = BufferedReader(sample_bytes)
  print(file_like.read())
  </code></pre>
  
  <p>but I'm getting an attribute error</p>
  
  <pre><code>AttributeError: 'bytes' object has no attribute 'readable'
  </code></pre>
  
  <p>How to I write and read bytes into a file like object, without saving it into local disc ?</p>