ABSTRACT We analyse the internal structure and dynamics of cosmic-web filaments connecting massive high-z haloes. Our analysis is based on a high-resolution arepo cosmological simulation zooming-in on three Mpc-scale filaments feeding three massive haloes of $\sim 10^{12}\, \text{M}_\odot$ at z ∼ 4, embedded in a large-scale sheet. Each filament is surrounded by a cylindrical accretion shock of radius $r_{\rm shock} \sim 50 \, {\rm kpc}$. The post-shock gas is in virial equilibrium within the potential well set by an isothermal dark-matter filament. The filament line-mass is $\sim 9\times 10^8\, \text{M}_\odot \, {\rm kpc}^{-1}$, the gas fraction within rshock is the universal baryon fraction, and the virial temperature is ∼7 × 105 K. These all match expectations from analytical models for filament properties as a function of halo mass and redshift. The filament cross-section has three radial zones. In the outer ‘thermal’ (T) zone, $r \ge 0.65 \, r_{\rm shock}$, inward gravity, and ram-pressure forces are overbalanced by outward thermal pressure forces, decelerating the inflowing gas and expanding the shock outwards. In the intermediate ‘vortex’ (V) zone, 0.25 ≤ r/rshock ≤ 0.65, the velocity field is dominated by a quadrupolar vortex structure due to offset inflow along the sheet through the post-shock gas. The outward force is dominated by centrifugal forces associated with these vortices, with additional contributions from global rotation and thermal pressure. Shear and turbulent forces associated with the vortices act inwards. The inner ‘stream’ (S) zone, $r \lt 0.25 \, r_{\rm shock}$, is a dense isothermal core, $T\sim 3 \times 10^4 \, {\rm K}$ and $n_{\rm H}\sim 0.01 \, {\rm cm^{-3}}$, defining the cold streams that feed galaxies. The core is formed by an isobaric cooling flow and is associated with a decrease in outward forces, though exhibiting both inflows and outflows.