Question Julian Matthews · Jul 26, 2018

GlobalBinaryStream write to file on server

I have a process which is passed a .rtf within a GlobalBinaryStream. I am trying to then output just the .rtf to a folder on a server, but not even sure where to start.

Is there a Built in Operation that I can pass the GlobalBinaryStream to which will then write the file to a folder, or do I need to use a custom class for the operation?

Thanks 

Comments

Vitaliy Serdtsev · Jul 26, 2018

Working with Streams E.g.

<FONT COLOR="#008000">;s stream=##class(%GlobalBinaryStream).%New()
;d stream.Write("--------")
   
</FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">file</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#000080">##class</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#008080">%Stream.FileBinary</FONT><FONT COLOR="#000000">).</FONT><FONT COLOR="#0000ff">%New</FONT><FONT COLOR="#000000">()
</FONT><FONT COLOR="#0000ff">s </FONT><FONT COLOR="#800000">file</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">Filename</FONT><FONT COLOR="#000000">=</FONT><FONT COLOR="#008000">"C:\temp\test.txt"
</FONT><FONT COLOR="#0000ff">d </FONT><FONT COLOR="#800000">file</FONT><FONT COLOR="#000000">.</FONT><FONT COLOR="#0000ff">CopyFromAndSave</FONT><FONT COLOR="#000000">(</FONT><FONT COLOR="#800000">stream</FONT><FONT COLOR="#000000">)</FONT>
0
Julian Matthews  Jul 27, 2018 to Vitaliy Serdtsev

Thank you Vitaliy, not sure how I missed that in the documentation!

0