  We propose a universal and nontrivial scheme to transmit and generate an
arbitrary W state for multiple cavities via an optomechanical interface. In
transmission and generation processes, high fidelity can be obtained by
optimizing the time-dependent coupling strengths between the cavities and the
mechanical resonator. With a group of optimal couplings, an arbitrary entangled
W state in the multipartite system can be mapped to the pulse shape of a single
photon and transmitted out of the system. In the time reversal process, an
arbitrary W state can be generated with an incident single photon with certain
pulse shape. The functions of the optimal couplings, which are used for both
transmission and generation processes, only depend on the parameters of the
system, which does not change with the arbitrary entangled W states and the
pulse shape of the single photons.
