import 'dart:convert';
import 'dart:typed_data';
import 'dart:io';

Uint8List compressJson(Map<String, dynamic> data) {
  final jsonStr = jsonEncode(data);
  final utf8Bytes = utf8.encode(jsonStr);
  final gzipBytes = GZipCodec().encode(utf8Bytes);
  return Uint8List.fromList(gzipBytes);
}

Map<String, dynamic> decompressJson(Uint8List bytes) {
  final decoded = GZipCodec().decode(bytes);
  return jsonDecode(utf8.decode(decoded));
}
