Use File/Blob Javascript API in 8.1

  • Dominik Lipp
        11 months ago #42411

        Hello,

        I was experimenting with ECMAScript Support in serverside BOs and stumbled upon a JS feature which resulted in an error.

        I tried to create a Blob / File with the following example code:

        let blob = new Blob([‘hello’, ‘ ‘, ‘world’], {type: ‘text/plain’});

        Error:

        Unexpected Runtime exception: ReferenceError: Blob is not defined

        For compatibility informations, see the mozilla documentation: https://developer.mozilla.org/en-US/docs/Web/API/Blob

        As far as I read, it should be supported, because it is standard JS API and is also supported in server implementations like NodeJS.

        Do I have a misunderstanding of the JS support in GraalVM?

        Benjamin Wiese
            Has successfully completed the online course Introduction
            Has successfully completed the online course Basics (100)
          11 months ago #42432
          Up
          0
          Down
          ::

          Hello Dominik, can you describe your use case and why you need to create a Blob?

          Generally yes, Simplifier supports ECMA. However file access is intentionally restricted.

          Dominik Lipp
              11 months ago #42464
              Up
              0
              Down
              ::

              In our use case, we would want to create files or blobs based on some data in the backend and send the file/blob to the user via the bo. We explicitely do not want to send B64 Strings.

              We do not need access to files on the filesystem and do not want to write files permanently to the filesystem.

              Benjamin Wiese
                  Has successfully completed the online course Introduction
                  Has successfully completed the online course Basics (100)
                11 months ago #42526
                Up
                0
                Down
                ::

                Since the File / Blob API is not part of ECMAScript, it is currently not supported by Simplifier. This means unfortunately that B64 is the only way at this point. You can however create a Feature Request in our Portal for adding support for the Blob API: https://ideas.simplifier.io/

              Viewing 4 posts - 1 through 4 (of 4 total)

              You must be logged in to reply to this topic.