toByteString package:bytestring-conversion

Please note that this needs to convert from a lazy ByteString to a strict one which involves copying the whole string.