I am writing .png file to aerospike as byte array using c code which works pretty good. While reading from aerospike data is coming as as_bytes, how to convert this as_bytes to string or pass it to my application?
To convert as_bytes to string, call as_bytes_to_string().
To pass to an application, do one of the following:
- Pass as_bytes directly after calling as_val_reserve((as_val*)bytes).
- Copy size and value fields using malloc() and memcpy().
- Transfer fields using:
uint32_t s = bytes->size; uint8_t* b = bytes->value; bool f = bytes->free; bytes->free = false;
Cross posted on StackOverflow - Storing images using Blob data type in aerospike - Stack Overflow