HISE Logo Forum
    • Categories
    • Register
    • Login

    File.loadAsBase64String() seem not to return valid a base64 string?

    Scheduled Pinned Locked Moved Scripting
    1 Posts 1 Posters 13 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      daniel_101
      last edited by

      Hi, I am newbie to HISE, and I want to implement a feature where a file (selected by a user) would be converted to a base64 string and sent as part of a JSON to a backend server using the Server.callWithPOST function.
      In my python backend, I try to validate that the base64 string is valid base64 but it never passes. Given that the length of the string never changes between HISE and the backend, I think suggests that the string doesn't get corrupted when converted to JSON.
      Also taking a look at the string returned from the loadAsBase64String, (In my case):

      var base64AudioData = f.loadAsBase64String();
      Console.print(base64AudioData); // 1048558.RkjQFY9+O.vUAYUQl0Fcf.A...P..H..DwJ...QrB..A..A.jEF...<CONTINUES>
      Console.print(base64AudioData.length); // 1398086
      

      I noticed that it doesn't quit have the characteristics of a base64 string (I think).

      1. The length of the string is not a multiple of four, even though it's always a multiple of two.
      2. It is always prefixed with a number. in this case 1048558 (The size of the file.)
      3. Makes use of multiple periods (.) which I do not expect in a base64 string.
        Is there a step I am missing before loading the file as a base64 string or is there a way to convert it into one in the backend, probably using zstd or does loadAsBase64String function not return a base64 string representation of the file?
      1 Reply Last reply Reply Quote 0
      • First post
        Last post

      35

      Online

      2.0k

      Users

      12.9k

      Topics

      111.8k

      Posts