Context. The infall of gas from outside natal cores has proven to feed protostars after the main accretion phase (Class 0). This changes our view of star formation to a picture that includes asymmetric accretion (streamers), and a larger role of the environment. However, the connection between streamers and the filaments that prevail in star-forming regions is unknown. Aims. We investigate the flow of material toward the filaments within Barnard 5 (B5) and the infall from the envelope to the protostellar disk of the embedded protostar B5-IRS1. Our goal is to follow the flow of material from the larger, dense core scale, to the protostellar disk scale. Methods. We present new HC3N line data from the NOEMA and 30 m telescopes covering the coherence zone of B5, together with ALMA H2CO and C18O maps toward the protostellar envelope. We fit multiple Gaussian components to the lines so as to decompose their individual physical components. We investigated the HC3N velocity gradients to determine the direction of chemically fresh gas flow. At envelope scales, we used a clustering algorithm to disentangle the different kinematic components within H2CO emission. Results. At dense core scales, HC3N traces the infall from the B5 region toward the filaments. HC3N velocity gradients are consistent with accretion toward the filament spines plus flow along them. We found a ~2800 au streamer in H2CO emission, which is blueshifted with respect to the protostar and deposits gas at outer disk scales. The strongest velocity gradients at large scales curve toward the position of the streamer at small scales, suggesting a connection between both flows. Conclusions. Our analysis suggests that the gas can flow from the dense core to the protostar. This implies that the mass available for a protostar is not limited to its envelope, and it can receive chemically unprocessed gas after the main accretion phase.