ddbitemsizer
Version:
Get the byte size of your DynamoDB input.
16 lines (15 loc) • 396 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.bytes = void 0;
/**
* @description Returns the number of UTF-8 bytes of a string.
* @example
* ```
* const size = bytes('Hi!');
* console.log('The size of the string was:', size); // 'The size of the string was: 3'
* ```
*/
function bytes(str) {
return new Blob([str]).size;
}
exports.bytes = bytes;