How to store image in binary format in Ne4j from xamarin application in c#.net


(Hdeshmukh87) #1

How to store image in binary format in Ne4j from xamarin application in c#.net


(M. David Allen) #2

I don't recommend you do this at all.

The way to do it would be to serialize your image into an array of bytes and then store it as a node property. But storing BLOBs (binary large objects) is a neo4j "worst practice":

From that:

Worst Practices for BLOBs in Neo4j

Another common mistake I see is using Neo4j as a Binary Large Object (BLOB) store. You might have heard that we do support byte type properties, and we do support arrays of primitives so byte arrays are possible. This, of course, opens up the possibility of storing gigabytes of data in a property value.

Honestly, the reason for that is because we organize properties in BLOB. At the end of the day, all the properties go into one file, and if it’s a huge property, it’s cluttered all over the file, and it takes a very long time to read that.

Using BLOB data in Neo4j is one of the very few real anti-patterns for graph databases, in my opinion. If you have to deal with BLOB data, choose an appropriate store for that use case and use Neo4j to store the URL that points you to the binary data.

So consider to put the image in Amazon S3 or equivalent, and store the URL to the image as a node property.