IWriteStreamStorage.php 699 B

1234567891011121314151617181920212223242526272829
  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 resource $stream
  19. * @param ?int $size the size of the stream if known in advance
  20. * @return int the number of bytes written
  21. * @throws GenericFileException
  22. * @since 15.0.0
  23. */
  24. public function writeStream(string $path, $stream, ?int $size = null): int;
  25. }