Question
· Jun 29, 2021

How would you recommend to delete a .stream in a REST Service?

Hello, first of all thanks for your time reading this question,

We would need some help, we would need to delete a %GlobalBinaryStream which is a variable called "pOutput" which is being sent from a REST Service to POSTMAN

Currently we have tried:

               set pOutput = ##class(%GlobalBinaryStream).%New()
                //set pOutput = msg
                while(msg.AtEnd=0){
                    do pOutput.Write(msg.Read())
                }
                do msg.Clear()
                Quit $$$OK

                do pOutput.Clear()
                $$$LOGWARNING("Despues de borrar en el Servicio: pOutput.Clear()")

 

As you would notice, we are currently clearing msg, however how could we remove "pOutput"?

We need to keep pOutput because is the variable which holds the pdf being returned from the REST Service to the POSTMAN

However we also need to delete its contents to remove the .stream file being store in /opt/ensemble/[namespace]/stream

 

➡️ How would you recommend to handle this task?

💭Thanks in advance for your help and time,

 

We have also read:

https://community.intersystems.com/post/delete-records-streamfilebinary-...

https://community.intersystems.com/post/stream-files-stored-server-when-...

 

Thanks for your replies and suggestion

Discussion (3)2
Log in or sign up to continue

Hello, thanks for your time reading our questions and doubts,

We have studied how to use the following data types: %Stream.TmpCharacter and %Stream.TmpBinary

We have used both as follows:

              

               set pOutput = ##class(%Stream.TmpBinary).%New()
                //set pOutput = msg
                while(msg.AtEnd=0){
                    do pOutput.Write(msg.Read())
                }
                do msg.Clear()
                Quit $$$OK
 
                do pOutput.Clear()
                $$$LOGWARNING("Despues de borrar en el Servicio: pOutput.Clear()")

However we still observing a .stream being created at: /opt/ensemble/ESBHCDSNS/stream

How could we delete a .stream which represents a pdf being returned from a REST Service to POSTMAN?

Thanks for your help 🙇‍♂️  and time reading our questions and code ⌚️

➡️ We would need some help if you could explain to us how would you recommend to delete a .stream in a REST Service? , please.

We have also read:

https://docs.intersystems.com/irislatest/csp/docbook/DocBook.UI.Page.cls...

https://docs.intersystems.com/irislatest/csp/documatic/%25CSP.Documatic....

https://docs.intersystems.com/irislatest/csp/documatic/%25CSP.Documatic....

https://docs.intersystems.com/latest/csp/documatic/%25CSP.Documatic.cls?...

Hello Eduard thanks for your reply

msg is a %GlobalCharacterStream

it is defined before, here is the code:

                            set msg=##class(%GlobalCharacterStream).%New()
                            if ('tSC) || (response.error '= "")||(response.informacion.mensaje '= "") {
                                do msg.Write("<br></br><H1>No existe el informe solicitado</H1>")
                            } else {
                                do ..Adapter.AssignOneSetting("Pdf","1","")
                                Do msg.Write($SYSTEM.Encryption.Base64Decode(response.datos.pdf))
                            }