  Binary neutron stars (BNSs) will spend $\simeq 10$ -- 15 minutes in the band
of Advanced LIGO and Virgo detectors at design sensitivity. Matched-filtering
of gravitational-wave (GW) data could in principle accumulate enough
signal-to-noise ratio (SNR) to identify a forthcoming event tens of seconds
before the companions collide and merge. Here we report on the design and
testing of an early warning gravitational-wave detection pipeline. Early
warning alerts can be produced for sources that are at low enough redshift so
that a large enough SNR accumulates $\sim 10 - 60\,\rm s$ before merger. We
find that about 7% (respectively, 49%) of the total detectable BNS mergers will
be detected $60\, \rm s$ ($10\, \rm s$) before the merger. About 2% of the
total detectable BNS mergers will be detected before merger and localized to
within $100\, \rm \text{deg}^2$ (90% credible interval). Coordinated observing
by several wide-field telescopes could capture the event seconds before or
after the merger. LIGO-Virgo detectors at design sensitivity could facilitate
observing at least one event at the onset of merger.
