aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/Files/Storage/IWriteStreamStorage.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/Files/Storage/IWriteStreamStorage.php')
-rw-r--r--lib/public/Files/Storage/IWriteStreamStorage.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/lib/public/Files/Storage/IWriteStreamStorage.php b/lib/public/Files/Storage/IWriteStreamStorage.php
new file mode 100644
index 00000000000..b03f46ef2bc
--- /dev/null
+++ b/lib/public/Files/Storage/IWriteStreamStorage.php
@@ -0,0 +1,29 @@
+<?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 resource $stream
+ * @param ?int $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;
+}