src/Normalizer/FileEntityNormalizer.php
public function denormalize($data, $class, $format = NULL, array $context = []) {

    $file_data = (string) $this->httpClient->get($data['uri'][0]['value'])->getBody();

    $path = 'temporary://' . $this->fileSystem->basename($data['uri'][0]['value']);
    $data['uri'] = file_unmanaged_save_data($file_data, $path);

    return $this->entityManager->getStorage('file')->create($data);
  }
public function denormalize($data, $class, $format = NULL, array $context = []) {

    $file_data = (string) $this->httpClient->get($data['uri'][0]['value'])->getBody();

    $path = 'temporary://' . $this->fileSystem->basename($data['uri'][0]['value']);
    $data['uri'] = file_unmanaged_save_data($file_data, $path);

    return $this->entityManager->getStorage('file')->create($data);
  }
{@inheritdoc}