title: How to zstd compress a chunk of bytes from an input file?
body: <p>Not enough example on zstd compression. I am using zstandard 0.8.1, trying to compress 2 bytes at a time. Came across <a href="https://anaconda.org/rolando/zstandard" rel="nofollow noreferrer">https://anaconda.org/rolando/zstandard</a> on using <code>write_to(fh)</code>, but not sure how to use it. Below is my partial code trying to read a chuck bytes from a file, then compresses each chuck,
      cctx = zstd.ZstdCompressor(level=4)
      with open(path, 'rb') as fh:
      while True:
          bin_data = fh.read(2) #read 2 bytes
          if not bin_data:
              break
          compressed = cctx.compress(bin_data)
      fh.close()</p>
  
  <pre><code>with open(path, 'rb') as fh:
      with open(outpath, 'wb') as outfile:
          outfile.write(compressed)
          ...
  </code></pre>
  
  <p>But how shall i use the write_to()?</p>