Skip to main content
1-Visitor
February 3, 2020
Solved

How to set a BLOB property using LoadBinary Service

  • February 3, 2020
  • 1 reply
  • 1813 views

How do I use the LoadBinary Service of FileRepository TT to convert a pdf file in my SystemRepository to array/stream of bytes and assign it to a blob type property of a separate Thing.

 

Currently, If I'm running the LoadBinary service with the file path as input in the Composer for the SystemRepository Thing, nothing is returned by the service.

Best answer by slangley

Hi @ravi2.

 

In our testing, we were able to load a .pdf to a blob successfully.  We received a "No result" but were then able to validate that the object did exist in the blob.  Is this possibly what is happening in your case?

 

// Content: BLOB
var Content =  Things["SystemRepository"].LoadBinary({
    path: "/FILE_NAME_HERE.pdf" /* STRING */
});
me.MyBlobProperty = Content;

 

Another possibility could be the path.  Are you using the relative path for your System Repository? 

 

Regards.

 

--Sharon

 

 

1 reply

slangleyCommunity ManagerAnswer
Support
February 3, 2020

Hi @ravi2.

 

In our testing, we were able to load a .pdf to a blob successfully.  We received a "No result" but were then able to validate that the object did exist in the blob.  Is this possibly what is happening in your case?

 

// Content: BLOB
var Content =  Things["SystemRepository"].LoadBinary({
    path: "/FILE_NAME_HERE.pdf" /* STRING */
});
me.MyBlobProperty = Content;

 

Another possibility could be the path.  Are you using the relative path for your System Repository? 

 

Regards.

 

--Sharon