aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/Files/Storage/IWriteStreamStorage.php
blob: 6da34563848f87aabb51fc9ceae0276a018e92ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php

declare(strict_types=1);

/**
 * SPDX-FileCopyrightText: 2018 Nextcloud GmbH and Nextcloud contributors
 * SPDX-License-Identifier: AGPL-3.0-or-later
 */
namespace OCP\Files\Storage;

use OCP\Files\GenericFileException;

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