Copy buffer into bytestring.