MgO/carboxymethyl chitosan nanocomposite improves thermal stability, waterproof and antibacterial performance for food packaging.