2019-12-03 13:57:53 -05:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2018-10-26 13:15:23 -04:00
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
2018-10-26 13:15:23 -04:00
|
|
|
*/
|
|
|
|
|
namespace OCP\Files\Storage;
|
|
|
|
|
|
2020-09-09 03:51:38 -04:00
|
|
|
use OCP\Files\GenericFileException;
|
|
|
|
|
|
2018-10-26 13:15:23 -04:00
|
|
|
/**
|
|
|
|
|
* Interface that adds the ability to write a stream directly to file
|
|
|
|
|
*
|
|
|
|
|
* @since 15.0.0
|
|
|
|
|
*/
|
|
|
|
|
interface IWriteStreamStorage extends IStorage {
|
|
|
|
|
/**
|
|
|
|
|
* Write the data from a stream to a file
|
|
|
|
|
*
|
|
|
|
|
* @param resource $stream
|
2024-10-01 10:12:30 -04:00
|
|
|
* @param ?int $size the size of the stream if known in advance
|
2018-10-26 13:15:23 -04:00
|
|
|
* @return int the number of bytes written
|
2020-09-09 03:51:38 -04:00
|
|
|
* @throws GenericFileException
|
2018-10-26 13:15:23 -04:00
|
|
|
* @since 15.0.0
|
|
|
|
|
*/
|
2024-03-28 11:13:19 -04:00
|
|
|
public function writeStream(string $path, $stream, ?int $size = null): int;
|
2018-10-26 13:15:23 -04:00
|
|
|
}
|