diff --git a/README.md b/README.md index 17ba032aca..ed868c5e94 100644 --- a/README.md +++ b/README.md @@ -459,8 +459,18 @@ A set of data types are exposed directly from the IPFS instance under `ipfs.type - [`ipfs.types.PeerId`](https://github.com/libp2p/js-peer-id) - [`ipfs.types.PeerInfo`](https://github.com/libp2p/js-peer-info) - [`ipfs.types.multiaddr`](https://github.com/multiformats/js-multiaddr) +- [`ipfs.types.multibase`](https://github.com/multiformats/multibase) - [`ipfs.types.multihash`](https://github.com/multiformats/js-multihash) - [`ipfs.types.CID`](https://github.com/ipld/js-cid) +- [`ipfs.types.dagPB`](https://github.com/ipld/js-ipld-dag-pb) +- [`ipfs.types.dagCBOR`](https://github.com/ipld/js-ipld-dag-cbor) + +#### `Util` + +A set of utils are exposed directly from the IPFS instance under `ipfs.util`. That way you're not required to import/require the following: + +- [`ipfs.util.crypto`](https://github.com/libp2p/js-libp2p-crypto) +- [`ipfs.util.isIPFS`](https://github.com/ipfs-shipyard/is-ipfs) ## FAQ diff --git a/circle.yml b/circle.yml index 445e40b5e0..55886db205 100644 --- a/circle.yml +++ b/circle.yml @@ -1,7 +1,7 @@ # Warning: This file is automatically synced from https://github.com/ipfs/ci-sync so if you want to change it, please change it there and ask someone to sync all repositories. machine: node: - version: stable + version: 8 test: pre: diff --git a/examples/README.md b/examples/README.md index b4678c1fa2..e47ef446ec 100644 --- a/examples/README.md +++ b/examples/README.md @@ -22,6 +22,7 @@ Let us know if you find any issue or if you want to contribute and add a new tut - [js-ipfs in electron](./run-in-electron) - [Using streams to add a directory of files to ipfs](./browser-add-readable-stream) - [Customizing the ipfs repository](./custom-ipfs-repo) +- - [Streaming video from ipfs to the browser using `ReadableStream`s](./browser-readablestream) ## Understanding the IPFS Stack diff --git a/examples/browser-readablestream/README.md b/examples/browser-readablestream/README.md new file mode 100644 index 0000000000..6fe75111f8 --- /dev/null +++ b/examples/browser-readablestream/README.md @@ -0,0 +1,16 @@ +# Streaming video from IPFS using ReadableStreams + +We can use the execllent [`videostream`](https://www.npmjs.com/package/videostream) to stream video from IPFS to the browser. All we need to do is return a [`ReadableStream`](https://developer.mozilla.org/en-US/docs/Web/API/ReadableStream)-like object that contains the requested byte ranges. + +Take a look at [`index.js`](./index.js) to see a working example. + +## Running the demo + +In this directory: + +``` +$ npm install +$ npm start +``` + +Then open [http://localhost:8888](http://localhost:8888) in your browser. diff --git a/examples/browser-readablestream/index.html b/examples/browser-readablestream/index.html new file mode 100644 index 0000000000..61ded58b13 --- /dev/null +++ b/examples/browser-readablestream/index.html @@ -0,0 +1,66 @@ + + + + + <%= htmlWebpackPlugin.options.title %> + + + +
+
+
+ + +
+ +
+

+    
+ + diff --git a/examples/browser-readablestream/index.js b/examples/browser-readablestream/index.js new file mode 100644 index 0000000000..7a2a969fa1 --- /dev/null +++ b/examples/browser-readablestream/index.js @@ -0,0 +1,75 @@ +'use strict' + +/* eslint-env browser */ + +const Ipfs = require('../../') +const videoStream = require('videostream') +const ipfs = new Ipfs({ repo: 'ipfs-' + Math.random() }) +const { + dragDrop, + statusMessages, + createVideoElement, + log +} = require('./utils') + +log('IPFS: Initialising') + +ipfs.on('ready', () => { + // Set up event listeners on the