@aws-lambda-powertools/kafka
Version:
Utility to easily handle message deserialization and parsing of Kafka events in AWS Lambda functions
17 lines (16 loc) • 596 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.deserialize = void 0;
const base64_1 = require("@aws-lambda-powertools/commons/utils/base64");
const decoder = new TextDecoder('utf-8');
/**
* Deserialize a base64-encoded primitive value (string).
*
* When customers don't provide a schema configuration, we assume the value is a base64-encoded string.
*
* @param data - The base64-encoded string to deserialize.
*/
const deserialize = (data) => {
return decoder.decode((0, base64_1.fromBase64)(data, 'base64'));
};
exports.deserialize = deserialize;