base64 encoding .txt file

Ok. If you are happy with that.

I notice you are not checking that the files open successfully.

How long are the lines? I suspect it is processing up to the 512 character block size that SD works in.