Question
Enzo Toscano · Mar 9, 2021

BinaryStream to file

First of all thank you for your time in reading this question and writing a response,

We would need some help,

What is the best method for save a %CSP.BinaryStream to a file?

Thank you in advance!! 

Product version: Caché 2014.1
0
0 158
Discussion (2)2
Log in or sign up to continue

You can use %Stream.FileBinary to create a file-based stream and then copy the contents from the %CSP.BinaryStream to it.

  Set stream=##class(%Stream.FileBinary).%New()
  Set sc=stream.LinkToFile("c:\myfile.txt")
  Set sc=stream.CopyFromAndSave(myCSPBinaryStream)

Nice and clean solution! Thank you Marc!