Convert strings directly to bytes rather than writing to text files first