我正在尝试找到一种将mp3声音存储在文本文件中的方法。我的计划是将原始mp3文件转换为base64字符串,然后保存。
我花了很多时间问Google,但只能找到一种方法将base64字符串转换回mp3。
这有可能吗?我也愿意接受其他解决方案,我只需要能够将文件转换为文本,然后再转换为mp3格式。我正在使用Visual Basic .NET,但我认为C#也可以帮助我。
最佳答案
使用 Convert.ToBase64String
method将字节数组转换为base64字符串:
' load file into a byte array
Dim data As Byte() = File.ReadAllBytes(filename)
' convert the byte array to base64
Dim str As String = Convert.ToBase64String(data)
' write the string to a file
File.WriteAllText(newFilename, str)
关于vb.net - VB.NET-将MP3转换为Base64字符串,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18303070/