We study nanowire silicon pin and pn-junctions at room and low temperature. Photovoltaic effects are observed for both devices at room temperature. At low temperature, nanowire pn-junction devices show their ability to detect single photon. This ability was not been observed for pin devices. Phosphorus-boron dopant cluster in the depletion region is considered to have the main role for single-photon detection capability. Fundamental mechanism of dopant-based single-photon detection in nanowire pn-junction is described in details.