Set objStreamIn = objFileIn.OpenAsTextStream(foForReading, foAsASCII) Set objFileIn = objFSO.GetFile("encoded.txt")
' Variables for reading base64 code from file ' of MSXml2.DOMDocument object and saves data to SuperPicture.jpg fileĬonst foForReading = 1 ' Open base 64 code file for readingĬonst foAsASCII = 0 ' Open base 64 code file as ASCII fileĬonst adSaveCreateOverWrite = 2 ' Mode for ADODB.Stream
' converts it in to back to binary reprisentation using encoding abilities Декодер: ' This script reads base64 encoded picture from file named encoded.txt, Set objFileOut = objFSO.CreateTextFile("encoded.txt", fsDoOverwrite, fsAsASCII)
Set objFSO = CreateObject("Scripting.FileSystemObject") ObjDocElem.nodeTypedValue = objStream.Read() Set objDocElem = objXML.createElement("Base64Data") Set objXML = CreateObject("MSXml2.DOMDocument") ' Create XML Document object and root node ObjStream.LoadFromFile("SuperPicture.jpg") Set objStream = CreateObject("ADODB.Stream") ' Variables for writing base64 code to file ' code using encoding abilities of MSXml2.DOMDocument object and savesĬonst fsDoOverwrite = true ' Overwrite file with base64 codeĬonst fsAsASCII = false ' Create base64 code file as ASCII fileĬonst adTypeBinary = 1 ' Binary file is encoded
Кодировщик: ' This script reads jpg picture named SuperPicture.jpg, converts it to base64 Stream_BinaryToString = BinaryStream.ReadText 'Open the stream And get text/string data from the object 'Specify charset For the output text (unicode) data. 'Open the stream And write binary data To the object 'Specify stream type - we want To save binary data. 'Binary - VT_UI1 | VT_ARRAY data To convert To a string Stream_StringToBinary = BinaryStream.Read 'Open the stream And get binary data from the object 'Open the stream And write text/string data To the object 'Specify charset For the source text (unicode) data. 'Specify stream type - we want To save text/string data.
Set BinaryStream = CreateObject("ADODB.Stream") 'Text - string parameter To convert To binary data ONode.nodeTypedValue =Stream_StringToBinary(sText)īase64Decode = Stream_BinaryToString(oNode.nodeTypedValue) Set oXML = CreateObject("Msxml2.DOMDocument.3.0")