summaryrefslogtreecommitdiffstats
path: root/ipfs-api/src/client/internal.rs
diff options
context:
space:
mode:
authorJulius Michaelis <gitter@liftm.de>2020-07-09 15:19:58 +0900
committerJulius Michaelis <gitter@liftm.de>2020-07-09 16:01:56 +0900
commit0bb7f70f91c422705804ba1fd14411b8c07e6136 (patch)
treef8ae1643fb2b7267e3f1a8cde7c5795eead42ad6 /ipfs-api/src/client/internal.rs
parent208a23371318ef9f61a27301093ea6667996102e (diff)
ipfs files read/write: add offset, count, parents
Diffstat (limited to 'ipfs-api/src/client/internal.rs')
-rw-r--r--ipfs-api/src/client/internal.rs18
1 files changed, 14 insertions, 4 deletions
diff --git a/ipfs-api/src/client/internal.rs b/ipfs-api/src/client/internal.rs
index 2c0d2af..ef4e9f2 100644
--- a/ipfs-api/src/client/internal.rs
+++ b/ipfs-api/src/client/internal.rs
@@ -1166,13 +1166,15 @@ impl IpfsClient {
/// use ipfs_api::IpfsClient;
///
/// let client = IpfsClient::default();
- /// let res = client.files_read("/test/file.json");
+ /// let res = client.files_read("/test/file.json", 0, None);
/// ```
///
+ /// Not specifying a byte `count` reads to the end of the file.
+ ///
#[inline]
- pub fn files_read(&self, path: &str) -> impl Stream<Item = Result<Bytes, Error>> {
+ pub fn files_read(&self, path: &str, offset: i64, count: Option<i64>) -> impl Stream<Item = Result<Bytes, Error>> {
impl_stream_api_response! {
- (self, request::FilesRead { path }, None) => request_stream_bytes
+ (self, request::FilesRead { path, offset, count }, None) => request_stream_bytes
}
}
@@ -1218,15 +1220,20 @@ impl IpfsClient {
///
/// let client = IpfsClient::default();
/// let file = File::open("test.json").unwrap();
- /// let res = client.files_write("/test/file.json", true, true, file);
+ /// let res = client.files_write("/test/file.json", true, true, true, 0, None, file);
/// ```
///
+ /// Not specifying a byte `count` writes the entire input.
+ ///
#[inline]
pub async fn files_write<R>(
&self,
path: &str,
create: bool,
truncate: bool,
+ parents: bool,
+ offset: i64,
+ count: Option<i64>,
data: R,
) -> Result<response::FilesWriteResponse, Error>
where
@@ -1241,6 +1248,9 @@ impl IpfsClient {
path,
create,
truncate,
+ parents,
+ offset,
+ count,
},
Some(form),
)