Downsampling operation, with an integer factor M, involves two steps: first a lowpass filtering is applied to bandlimit the input so as to avoid any possible aliasing, then a compressor (decimator) throws out all but every M-th sample,
producing the output.
The ideal lowpass filter used in this process is also known as a sinc filter, since its impulse response is indeed a sinc function; hence the name.
An LTI filtering operation can be performed either in time-domain using a convolution, or equivalently in frequency-domain using multiplication of associated discrete-Fourier transforms (DFT) of the input and the filter.
However, eventhough the discrete-time Fourier transform (DTFT) of an ideal sinc filter is an exact rectangular pulse in the frequency domain, the discrete-Fourier transform (DFT) of an ideal sinc filter (which extends to +- infinity) does not exist: because only finite length signals do have DFT reprsentations.
In practice, therefore, a finite length truncated sinc filter must be used, and the resulting errors must be tolerated. A raw truncation, however, exhibits heavy untolerable Gibbs phenomenon (ripples on pulse edges) on the resulting DTFT and DFT of the sinc filter. To avoid these excessive ripples, a tapering window is applied to the truncated impulse response. The result is that, DFT/DTFT of the windowed-truncated sinc function avoids excessive ripples, whereas the transition bandwidth of the lowpass filter is widened.
Eventually, the DTFT/DFT of the windowed truncated sinc filter approaches that of the rectangular pulse in the frequency-domain. This implies that a rectangular mask in the frequency-domain can perform close to (but not exact to) an windowed truncated sinc filter in the time-domain. This is the reason, why sometimes lowpass filtering can be applied in the frequency-domain using an exact rectangular mask applied to the DFT of the input signal. Applying a mask, instead of a multipication of the true DFT of the windowed- truncated sinc filter, is the cheapest way to filter a signal at the cost of some aliasing (or truncation) errors with respect to an (unimplementable) ideal sinc filter or a practical windowed truncated sinc filter; yet it may perform satisfactorily depending on the application.
This rectanguar mask can be aplied at the center of the frequency spectrum if the spectrum is represented using a symmetric $[-\pi,\pi]$ interval, instead of the typical $[0,2\pi]$ implied by DTFT/DFT definitions. Nevertheless, they are equivalent, and can be converted to each other using an FFT shift operator available on most platforms.
Note that you can totally ignore the lowpass filtering stage if the original sigal is already at least M times oversampled (in case of downsampling by integer M), and just compress the input samples to produce the output samples.