'Encode Binary file to Base64

inputFile = "c:\scripts\myfile.bin"
outputFile = "c:\scripts\myfile.txt"

Set inStream = CreateObject("ADODB.Stream")
inStream.Open
inStream.type= 1'TypeBinary
inStream.LoadFromFile(inputFile)
readBytes = inStream.Read()
  
Set oXML = CreateObject("Msxml2.DOMDocument")
Set oNode = oXML.CreateElement("base64")
oNode.dataType = "bin.base64"
oNode.nodeTypedValue = readBytes
Base64Encode = oNode.text

Set fso = CreateObject("Scripting.Filesystemobject")
Set output=fso.CreateTextFile(outputFile,1)
output.Write base64Encode
output.Close


search for scripts

VbsEdit contains all these sample scripts!


Download Now!



Download   Home   Scripts

Copyright © 2001-2024 adersοft