Alternatively read and write in memory buffer

Can I use buffer instead of io.pipe as previously I was using single buffer for reading and writing Logs?