Hi if i do a on a img i get this LOG: img: ����ICC_PROFILE

function updateAvatar(){

  var userAVATAR = {
    id: userProfileID_class,
    instanceName: ApiKeys.instanceName,
    className: "user_profile"

  var userAVATAR2 = {
    avatar: Syncano.file("kevin.jpg").then(function(content) {
            console.log("img: " + content);
        }, function(error) {

  DataObject.please().update(userAVATAR, userAVATAR2).then(function(callback) {
    debug_log("done upload " + callback.avatar);
  .catch(function(error) {
    debug_log("upload  " + error);


Any idea why that is? (ps kevin.jpg is in ~/.local/share/)

I’d assume it’s because you’re trying to print out the contents of a binary file. :slight_smile: What is your expected result?

Im trying to upload the file to Syncano but i dont think its reading it…

The printout definitely implies that the file (or at least part of it) is being read. (“ICC_PROFILE” implies an embedded color profile, typically found in a jpeg).

Could it be that the issue is elsewhere in the code (I’m assuming the above is just a reduced example), possibly in the Syncano integration?

Ok, I’ve checked up on it and it turns out that Storage only supports strings (utf8) and not binary yet. We’re working on a new version of Storage that supports this, but it isn’t finished yet. If you need it before then the only option is to implement it using Uno.

Edit: Originally said the new version was right around the corner, but this was just me misunderstanding some internal schedules.

hi Remi is there a example of how to do this…? i got this in uno so far : Stream avatar = Uno.IO.File.Open("Users/Kevin/Desktop/snap/v5/kevin.jpg", FileMode.Open);

but not sure what to do next

Since we don’t have support for bytearrays in fetch (this is added in a internal version and will be released soon), you need to upload on the Uno side. You can do this:

using Uno;
using Uno.UX;
using Fuse.Scripting;
using Fuse.Reactive;
using Uno.Threading;
using Uno.Net.Http;

public class Upload : NativeModule
    static readonly Upload _instance;

    public Upload()

        if(_instance != null) return;
            Resource.SetGlobalKey(_instance = this, "Upload");

        AddMember(new NativePromise<int, int>("sendByPath", (FutureFactory<int>)send, null));

    static Future<int> send(object[] args)
        var path = ((Fuse.Scripting.Object)args[0])["path"] as string;
        var uri = (string)args[1];

        var imageData = Uno.IO.File.ReadAllBytes(path);

        var client = new HttpMessageHandler();
        var request = client.CreateRequest("POST", uri);

        var promise = new Promise<int>();
        new ResultClosure(promise, request);

        return promise;

    class ResultClosure
        Promise<int> _promise;

        public ResultClosure(Promise<int> promise, HttpMessageHandlerRequest request)
            _promise = promise;

            request.Done += Done;
            request.Aborted += Aborted;
            request.Error += Error;
            request.Timeout += Timeout;

        void Done(HttpMessageHandlerRequest r) { _promise.Resolve(r.GetResponseStatus()); }

        void Error(HttpMessageHandlerRequest r, string message) { _promise.Reject(new Exception(message)); }

        void Aborted(HttpMessageHandlerRequest r) { _promise.Reject(new Exception("Aborted")); }

        void Timeout(HttpMessageHandlerRequest r) { _promise.Reject(new Exception("Timeout")); }