Making a file downloading system with valid input in a custom drupal 8 form
you can do this with the $form_state->response($response)

  $response = new BinaryFileResponse($file-&gt;getFileUri();
  $form_state-&gt;setResponse($response);