Skip to content
This repository has been archived by the owner on Aug 1, 2022. It is now read-only.

api util.codec

Ivan Volkov edited this page Jun 18, 2021 · 4 revisions

$.util.codec API

Represents the codec namespace with its fields.

Reference

  • SAP Help

https://help.sap.com/doc/3de842783af24336b6305a3c0223a369/2.0.03/en-US/$.util.codec.html

  • Module

https://github.com/SAP/xsk/blob/main/modules/api/api-xsjs/src/main/resources/xsk/util/codec/codec.js

  • Sample usage:
var codec = $.util.codec;
var util = $.util;

// encode the string value to  hex data
var encodedHex = codec.encodeHex("dirigible as hex");

//returns ArrayBuffer 
var decodedHex = codec.decodeHex(encodedHex);
//Converts an ArrayBuffer containing UTF-8 encoded string to a JavaScript String object 
var valueFromHex = util.stringify(decodedHex);

// encode the string value  base64 data
var encodedToBase64 = codec.encodeBase64("dirigible as base64");
//returns ArrayBuffer
var decodedBase64 = codec.decodeBase64(encodedToBase64);
//Converts an ArrayBuffer containing UTF-8 encoded string to a JavaScript String object 
var valueFromBase64 = util.stringify(decodedBase64);
  • Methods
Members Description Type
decodeBase64(base64Data) Decodes Base64 data ArrayBuffer
decodeHex(hexData) Decodes hexadecimal data. ArrayBuffer
encodeBase64(data) Encodes data into Base64. String
encodeHex(data) Encodes data into hexadecimal format. String
  • Issues

https://github.com/SAP/xsk/issues/21

  • Unit Tests

https://github.com/SAP/xsk/blob/main/modules/engines/engine-xsjs/src/test/resources/test/xsk/util/codec/codec.xsjs

  • Integration Tests ❌

Wiki icons legend

✅ - Feature implemented and working as supposed.
⚠️ - Feature partially implemented and needs to be finished.
❌ - Feature not implemented yet.

Project

Architecture

Tips & Tricks

Infrastructure

Troubleshooting guide

Clone this wiki locally