A freestanding NiSx porous film as a binder-free electrode for Mg-ion batteries.