meshoptimizer currently ships with index and vertex codecs with the API along these lines:
size_t encode(destination, destination_capacity, source, source_size)
void decode(destination, destination_size, source, source_size)
The next version of meshoptimizer needs to make backwards incompatible changes to the encoding format to allow for better compression.