With file_save_data being removed from Drupal 10, this is how I now save a file upload to my file field type. $docs is the array that my decoupled Formik form provides on form submit and I had to extract the data from the array and decode. I then get the file id to put into the file field on the node. Probably a better way, but I made this work.
/**
* @param $docs
* Save all doc attachments to the private directory.
*
* @throws \Drupal\Core\Entity\EntityStorageException
*/
public function saveDocuments($docs): void {
foreach ($docs as $key => $dataIn) {
// Save the plate with the filename for audit trail.
$this->fileName = $this->license . '-' . $dataIn['filename'];
$data = $dataIn['file_data'];
[$type, $data] = explode(';', $data);
[, $data] = explode(',', $data);
$data = base64_decode($data);
/** @var \Drupal\file\FileRepositoryInterface $fileRepository */
$fileRepository = \Drupal::service('file.repository');
$uri = "private://" . $this->fileName;
$fileEntity = $fileRepository->writeData($data, $uri, FileSystemInterface::EXISTS_REPLACE);
$this->documents[] = $fileEntity->id();
}
}