I am considering to store small amount of data to a parse object to save this extra 30% storage over saving a base64 string. The data size is rather small - short encrypted text for example so using files and their urls would not be optimal - but considering there will be millions of these short datas, the 30% size reduction is appealing.
Do I understand it correctly that I should set the field in Dashboard as Array and then use var data: [UInt8]? in my ParseSwift client? Or there is some other trick?
What I am not sure about is the javaScriptâs Number vs swiftâs UInt8 conversion and if that at the end will not take more storage than base64string as to my limited knowledge the javascript uses Int32.
I think it was only implemented in Parse Server and never included as a Parse Dashboard option. Currently youâd need to change the schema via api or send a first binary data using master key.
Great! Thanks for quick implementation! I will test it in the next days.
Do you know if the cloud codeâs JavaScript will handle Bytes type also? In the JS documentation I found only init of a file from an Array of bytes. Does that mean that I should handle that Bytes field in the cloud code as an array of bytes? If you would have any short example I would highly appreciate it!
Hey Corey, I finally tested to save ParseBytes. I had to remove my âdâ column in the dashboard and set the CLP so that a field can be added. The ParseObject now looks as following:
struct Inbox: ParseObject {
//Those are required for Parse Object
var objectId: String?
var createdAt: Date?
var updatedAt: Date?
var ACL: ParseACL?
/**
Recipient's objectId
*/
var rid: String?
/**
Data (encrypted InboxMessage)
*/
var d: ParseBytes!
/**
Salt string for key agreement
*/
var s: String?
}
After saving the file I can see in the Dashboard that the field âdâ was added, but it also show that is being saved as base64 string:
Is this how only the dashboard shows/interprets the field, or is it really saved as nested object JSON with base64 string data? If so, then there is really no advantage compare to saving base64 string directly.
EDIT:
I found in the source code a BytesCoder so I believe it is only Dashboard representation and the data are stored in MongoDB as Binary indeed:
The data are in that case just transferred over the network in base64 format, but with my limited knowledge that is a must and we cannot send binary data in the REST and other SDK APIs, is that correct?
Thank you for pointing that out, I did correct it. As everything with ParseBytes seems to work well for me, I can confirm that the feature was successfully implemented. Thank you!