summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFerris Tseng <ferristseng@fastmail.fm>2018-06-27 18:12:36 -0400
committerFerris Tseng <ferristseng@fastmail.fm>2018-06-27 18:12:36 -0400
commitfedf875de04c8577a439bff9f62f1cb7d079459a (patch)
tree82b60aa1968a3e685b08e685efaa24ecaa99f768
parent3c25abc18d7f01bd329d3368c8af064c589df2ee (diff)
updating version number in docs and README
-rw-r--r--README.md39
-rw-r--r--ipfs-api/src/lib.rs2
2 files changed, 24 insertions, 17 deletions
diff --git a/README.md b/README.md
index 3218b82..d5020ac 100644
--- a/README.md
+++ b/README.md
@@ -10,7 +10,7 @@ Rust library for connecting to the IPFS HTTP API using tokio.
```toml
[dependencies]
-ipfs-api = "0.4.0-alpha.3"
+ipfs-api = "0.5.0-alpha1"
```
### Examples
@@ -19,38 +19,45 @@ Write a file to IPFS:
```rust
#
+use hyper::rt::Future;
use ipfs_api::IpfsClient;
use std::io::Cursor;
-use tokio_core::reactor::Core;
-let mut core = Core::new().unwrap();
-let client = IpfsClient::default(&core.handle());
+let client = IpfsClient::default();
let data = Cursor::new("Hello World!");
-let req = client.add(data);
-let res = core.run(req).unwrap();
+let req = client
+ .add(data)
+ .map(|res| {
+ println!("{}", res.hash);
+ })
+ .map_err(|e| eprintln!("{}", e));
-println!("{}", res.hash);
+hyper::rt::run(req);
```
Read a file from IPFS:
```rust
#
-use futures::stream::Stream;
+use futures::{Future, Stream};
use ipfs_api::IpfsClient;
use std::io::{self, Write};
-use tokio_core::reactor::Core;
-let mut core = Core::new().unwrap();
-let client = IpfsClient::default(&core.handle());
+let client = IpfsClient::default();
-let req = client.get("/test/file.json").concat2();
-let res = core.run(req).unwrap();
-let out = io::stdout();
-let mut out = out.lock();
+let req = client
+ .get("/test/file.json")
+ .concat2()
+ .map(|res| {
+ let out = io::stdout();
+ let mut out = out.lock();
-out.write_all(&res).unwrap();
+ out.write_all(&res).unwrap();
+ })
+ .map_err(|e| eprintln!("{}", e));
+
+hyper::rt::run(req);
```
There are also a bunch of examples included in the project, which
diff --git a/ipfs-api/src/lib.rs b/ipfs-api/src/lib.rs
index 284350f..05fe0fa 100644
--- a/ipfs-api/src/lib.rs
+++ b/ipfs-api/src/lib.rs
@@ -14,7 +14,7 @@
//!
//! ```toml
//! [dependencies]
-//! ipfs-api = "0.4.0-alpha.3"
+//! ipfs-api = "0.5.0-alpha1"
//! ```
//!
//! ## Examples