IWriteStreamStorage.php 727 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Files\Storage;
  8. use OCP\Files\GenericFileException;
  9. /**
  10. * Interface that adds the ability to write a stream directly to file
  11. *
  12. * @since 15.0.0
  13. */
  14. interface IWriteStreamStorage extends IStorage {
  15. /**
  16. * Write the data from a stream to a file
  17. *
  18. * @param string $path
  19. * @param resource $stream
  20. * @param int|null $size the size of the stream if known in advance
  21. * @return int the number of bytes written
  22. * @throws GenericFileException
  23. * @since 15.0.0
  24. */
  25. public function writeStream(string $path, $stream, ?int $size = null): int;
  26. }