Poor man guide for DynamoDB.
Since DynamoDB has some limitation on space and I want to use a basic data structure and keeps everything in a single document. I'm just a lazy guy, that's it.
So, the best option for me is compress by use lzutf8 on some data that I don't use for search.
compress
compressedByteArray = lzutf8.compress(JSON.stringify(data), {
outputEncoding: 'ByteArray',
}).toString()
decompress
compressedByteArray = new Uint8Array(
compressedStringFromDB.split(',').map(i => parseInt(i)),
{
inputEncoding: 'ByteArray',
outputEncoding: 'String',
})
How many space I saved? You can try it on your own here.
See ya.
Top comments (0)