├── LICENSE ├── Makefile ├── README.md ├── bootstrap.css ├── img ├── file.png └── folder.png ├── index.html ├── index.jsx ├── ipbox.comp.js ├── ipfsapi.min.js ├── layout.css └── package.json /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2016 Protocol Labs Inc. 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | all: 2 | browserify -t reactify index.jsx > ipbox.comp.js 3 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ## This repository has been archived! 2 | *This IPFS-related repository has been archived, and all issues are therefore frozen.* If you want to ask a question or open/continue a discussion related to this repo, please visit the [official IPFS forums](https://discuss.ipfs.io). 3 | 4 | We archive repos for one or more of the following reasons: 5 | - Code or content is unmaintained, and therefore might be broken 6 | - Content is outdated, and therefore may mislead readers 7 | - Code or content evolved into something else and/or has lived on in a different place 8 | - The repository or project is not active in general 9 | 10 | Please note that in order to keep the primary IPFS GitHub org tidy, most archived repos are moved into the [ipfs-inactive](https://github.com/ipfs-inactive) org. 11 | 12 | If you feel this repo should **not** be archived (or portions of it should be moved to a non-archived repo), please [reach out](https://ipfs.io/help) and let us know. Archiving can always be reversed if needed. 13 | 14 | # File Browser Thing 15 | 16 | [![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io) 17 | [![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/) 18 | [![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs) 19 | [![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme) 20 | 21 | > generic-ipfs-file-browser-ui-thing 22 | 23 | This is the beginning of a file browser UI for ipfs. 24 | 25 | ## Table of Contents 26 | 27 | - [Install](#install) 28 | - [Usage](#usage) 29 | - [Contribute](#contribute) 30 | - [Want to hack on IPFS?](#want-to-hack-on-ipfs) 31 | - [License](#license) 32 | 33 | ## Install 34 | 35 | Right now it depends on changes to [go-ipfs](https://github.com/ipfs/go-ipfs), [js-ipfs-api](https://github.com/ipfs/js-ipfs-api), and feross's [drag-drop](https://github.com/feross/drag-drop) that have not merged. If you want to try this out, there is a bit of pre-setup work you'll need to do: 36 | 37 | - Run the daemon in a way that allows different origins 38 | - Use the version of feross/drag-drop from this PR: https://github.com/feross/drag-drop/pull/5 39 | 40 | ## Usage 41 | 42 | Run this in your browser. 43 | 44 | ## Contribute 45 | 46 | Feel free to join in. All welcome. Open an [issue](https://github.com/ipfs/file-browser/issues). 47 | 48 | This repository falls under the IPFS [Code of Conduct](https://github.com/ipfs/community/blob/master/code-of-conduct.md). 49 | 50 | ### Want to hack on IPFS? 51 | 52 | [![](https://cdn.rawgit.com/jbenet/contribute-ipfs-gif/master/img/contribute.gif)](https://github.com/ipfs/community/blob/master/contributing.md) 53 | 54 | ## License 55 | 56 | [MIT](LICENSE) © Protocol Labs Inc. 57 | -------------------------------------------------------------------------------- /img/file.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipfs-inactive/file-browser/3fa1964a9ac0faafc723058661b0613e1e86c0af/img/file.png -------------------------------------------------------------------------------- /img/folder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ipfs-inactive/file-browser/3fa1964a9ac0faafc723058661b0613e1e86c0af/img/folder.png -------------------------------------------------------------------------------- /index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 |
8 |
9 | 10 | 11 | 12 | -------------------------------------------------------------------------------- /index.jsx: -------------------------------------------------------------------------------- 1 | var React = require('react') 2 | var ipfs = require('ipfs-api')('localhost', '5001') 3 | var dragDrop = require('drag-drop') 4 | 5 | var fs = 'testfs' 6 | 7 | var dispatch = (function () { 8 | var events = {} 9 | return { 10 | fire: function (event, context) { 11 | events[event].forEach(function (fn) { 12 | fn(context) 13 | }) 14 | }, 15 | listen: function (event, fn) { 16 | if (!fn) return false 17 | if (!events[event]) { 18 | events[event] = [] 19 | } 20 | 21 | events[event].push(fn) 22 | return true 23 | }, 24 | remove: function (event, fn) { 25 | if (!events[event]) return false 26 | 27 | var index = events[event].indexOf(fn) 28 | if (index > -1) { 29 | events[event].splice(index, 1) 30 | } 31 | 32 | return true 33 | } 34 | } 35 | })() 36 | 37 | var DirEntry = React.createClass({ 38 | getInitialState: function () { 39 | return { 40 | name: this.props.name, 41 | } 42 | }, 43 | contextMenu: function (e) { 44 | e.preventDefault() 45 | console.log('right click on an item!') 46 | }, 47 | render: function () { 48 | baseclass = 'item' 49 | if (this.props.item.highlight) { 50 | baseclass = baseclass + ' selected' 51 | } 52 | if (this.props.item.Type == 1) { 53 | return ( 54 |
59 | 60 |

61 | {this.props.item.Name} 62 |

63 |
64 | ) 65 | } else { 66 | return ( 67 |
71 | 72 |

73 | {this.props.item.Name} 74 |

75 |
76 | ) 77 | } 78 | } 79 | 80 | }) 81 | 82 | var InfoBar = React.createClass({ 83 | render: function () { 84 | return ( 85 |
86 |

{this.props.item.Name}

87 |

88 | Size: {this.props.item.Size} 89 |

90 |

91 | Hash: {this.props.item.Hash} 92 |

93 |

94 | (show providers here on button click) 95 |

96 |
) 97 | } 98 | }) 99 | 100 | var loaddirs = (function () { 101 | dispatch.listen('act-chdir', function (ctx) { 102 | var fs = ctx.fs 103 | var path = '/' + ctx.path.join('/') 104 | if (ctx.path.length == 0) { 105 | path = '/' 106 | } 107 | ipfs.files.ls(path, function (err, res) { 108 | if (err || !res) return console.error(err) 109 | 110 | dispatch.fire('resp-chdir', { 111 | entries: res.Entries, 112 | path: ctx.path, 113 | }) 114 | }) 115 | }) 116 | })() 117 | 118 | var Explorer = React.createClass({ 119 | getInitialState: function () { 120 | this.path = [] 121 | return ({ 122 | entries: [], 123 | loading: true, 124 | }) 125 | }, 126 | dragDropHandler: function (files) { 127 | console.log('got some files: ', files) 128 | console.log('path = ', this.path) 129 | var curpath = this.path 130 | files.forEach(function (f, i) { 131 | console.log('got file: ', f.name) 132 | console.log(f) 133 | 134 | var reader = new FileReader() 135 | reader.addEventListener('load', function (e) { 136 | var arr = new Uint8Array(e.target.result) 137 | var buffer = new Buffer(arr) 138 | 139 | ipfs.add(buffer, function (err, res) { 140 | if (err || !res) return console.error(err) 141 | 142 | var filehash = res.Hash 143 | 144 | // ensure parent dirs are made 145 | var parentDir = f.fullPath.split('/').slice(0, -1) 146 | if (parentDir[0] == '') { 147 | parentDir = parentDir.slice(1) 148 | } 149 | var relpath = curpath.concat(parentDir) 150 | 151 | var fpath = relpath.slice() 152 | fpath.push(f.name) 153 | console.log(res, fpath) 154 | 155 | doPut = function () { 156 | ipfs.files.cp(['/ipfs/'+filehash, '/'+fpath.join('/')], function (err, res) { 157 | if (err) return console.error(err) 158 | 159 | dispatch.fire('act-chdir', { 160 | fs: fs, 161 | path: curpath, 162 | }) 163 | }) 164 | } 165 | 166 | if (relpath.length > 0) { 167 | ipfs.files.mkdir(relpath.join('/'), {"p":true}, function (err, res) { 168 | if (err) return console.error(err) 169 | 170 | doPut() 171 | }) 172 | } else { 173 | doPut() 174 | } 175 | }) 176 | }) 177 | reader.addEventListener('error', function (err) { 178 | console.error('FileReader error' + err) 179 | }) 180 | reader.readAsArrayBuffer(f) 181 | }) 182 | }, 183 | 184 | componentDidMount: function () { 185 | var self = this 186 | 187 | dragDrop('#explorer', this.dragDropHandler) 188 | 189 | dispatch.listen('resp-chdir', function (context) { 190 | self.path = context.path 191 | self.setState({ 192 | loading: false, 193 | entries: context.entries, 194 | }) 195 | }) 196 | 197 | dispatch.listen('no-file', function () { 198 | self.setState({ 199 | error: 'No such file or directory', 200 | loading: false 201 | }) 202 | }) 203 | 204 | dispatch.fire('act-chdir', { 205 | fs: fs, 206 | path: [], 207 | }) 208 | }, 209 | chdir: function (item) { 210 | this.setState({ 211 | loading: true 212 | }) 213 | npath = this.path.slice() 214 | npath.push(item.Name) 215 | console.log('this path: ', this.path) 216 | 217 | console.log('changing to: ', npath) 218 | dispatch.fire('act-chdir', { 219 | fs: fs, 220 | path: npath, 221 | }) 222 | }, 223 | up: function () { 224 | this.setState({loading: true}) 225 | npath = this.path.slice() 226 | npath.pop() 227 | dispatch.fire('act-chdir', { 228 | fs: fs, 229 | path: npath, 230 | }) 231 | }, 232 | selectEntry: function (e) { 233 | console.log('entry selected', e) 234 | s = this.state 235 | if (s.selected) { 236 | s.selected.highlight = false 237 | } 238 | s.selected = e 239 | s.selected.highlight = true 240 | this.setState(s) 241 | }, 242 | render: function () { 243 | if (this.state.entries) { 244 | var entries = this.state.entries.map(function iterator (item) { 245 | return () 249 | }, this) 250 | } 251 | 252 | upBox = { 253 | Name: '..', 254 | Type: 1, 255 | } 256 | 257 | return ( 258 |
259 | {this.state.loading ? 260 |
261 | LOADING!!! 262 |
: undefined} 263 |
264 | {'/' + this.path.join('/')} 265 |
266 | {this.state.selected ? 267 | : undefined} 268 |
269 | {this.path.length > 0 ? 270 | : undefined} {entries} 274 |
275 |
276 | ) 277 | } 278 | }) 279 | 280 | React.render(, document.getElementById('container')) 281 | -------------------------------------------------------------------------------- /ipfsapi.min.js: -------------------------------------------------------------------------------- 1 | (function(e){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=e()}else if(typeof define==="function"&&define.amd){define([],e)}else{var t;if(typeof window!=="undefined"){t=window}else if(typeof global!=="undefined"){t=global}else if(typeof self!=="undefined"){t=self}else{t=this}t.ipfsAPI=e()}})(function(){var e,t,r;return function n(e,t,r){function i(o,s){if(!t[o]){if(!e[o]){var u=typeof require=="function"&&require;if(!s&&u)return u(o,!0);if(a)return a(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=t[o]={exports:{}};e[o][0].call(l.exports,function(t){var r=e[o][1][t];return i(r?r:t)},l,l.exports,n,e,t,r)}return t[o].exports}var a=typeof require=="function"&&require;for(var o=0;o=400||!e.statusCode){if(!t)t=new Error;return u(t,null)}return u(null,t)});e.on("error",function(e){return u(e,null)})});if(p){p.pipe(g)}else{g.end()}return g}function v(e){if(!e)return null;if(!Array.isArray(e))e=[e];var t;for(var i=0;i0){a=s(u.curr,u.path)}else{a=u.curr}if(t.isDirectory())return;a.files.addPart({body:t.contents,headers:{"Content-Type":"application/octet-stream","Content-Disposition":'file; name="file"; filename="'+r+'"'}})}function f(e,t){var r;var n=Object.keys(e.folders);if(!t)t="";for(var i=0;i1)return new u(e,arguments[1]);return new u(e)}this.length=0;this.parent=undefined;if(typeof e==="number"){return f(this,e)}if(typeof e==="string"){return l(this,e,arguments.length>1?arguments[1]:"utf8")}return h(this,e)}function f(e,t){e=m(e,t<0?0:y(t)|0);if(!u.TYPED_ARRAY_SUPPORT){for(var r=0;r>>1;if(r)e.parent=o;return e}function y(e){if(e>=s()){throw new RangeError("Attempt to allocate Buffer larger than maximum "+"size: 0x"+s().toString(16)+" bytes")}return e|0}function b(e,t){if(!(this instanceof b))return new b(e,t);var r=new u(e,t);delete r.parent;return r}u.isBuffer=function $(e){return!!(e!=null&&e._isBuffer)};u.compare=function Q(e,t){if(!u.isBuffer(e)||!u.isBuffer(t)){throw new TypeError("Arguments must be Buffers")}if(e===t)return 0;var r=e.length;var n=t.length;var i=0;var a=Math.min(r,n);while(i>>1;case"base64":return G(e).length;default:if(n)return Z(e).length;t=(""+t).toLowerCase();n=true}}}u.byteLength=w;u.prototype.length=undefined;u.prototype.parent=undefined;function _(e,t,r){var n=false;t=t|0;r=r===undefined||r===Infinity?this.length:r|0;if(!e)e="utf8";if(t<0)t=0;if(r>this.length)r=this.length;if(r<=t)return"";while(true){switch(e){case"hex":return B(this,t,r);case"utf8":case"utf-8":return L(this,t,r);case"ascii":return R(this,t,r);case"binary":return k(this,t,r);case"base64":return C(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return O(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase();n=true}}}u.prototype.toString=function re(){var e=this.length|0;if(e===0)return"";if(arguments.length===0)return L(this,0,e);return _.apply(this,arguments)};u.prototype.equals=function ne(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(this===e)return true;return u.compare(this,e)===0};u.prototype.inspect=function ie(){var e="";var t=r.INSPECT_MAX_BYTES;if(this.length>0){e=this.toString("hex",0,t).match(/.{2}/g).join(" ");if(this.length>t)e+=" ... "}return""};u.prototype.compare=function ae(e){if(!u.isBuffer(e))throw new TypeError("Argument must be a Buffer");if(this===e)return 0;return u.compare(this,e)};u.prototype.indexOf=function oe(e,t){if(t>2147483647)t=2147483647;else if(t<-2147483648)t=-2147483648;t>>=0;if(this.length===0)return-1;if(t>=this.length)return-1;if(t<0)t=Math.max(this.length+t,0);if(typeof e==="string"){if(e.length===0)return-1;return String.prototype.indexOf.call(this,e,t)}if(u.isBuffer(e)){return r(this,e,t)}if(typeof e==="number"){if(u.TYPED_ARRAY_SUPPORT&&Uint8Array.prototype.indexOf==="function"){return Uint8Array.prototype.indexOf.call(this,e,t)}return r(this,[e],t)}function r(e,t,r){var n=-1;for(var i=0;r+ii){n=i}}var a=t.length;if(a%2!==0)throw new Error("Invalid hex string");if(n>a/2){n=a/2}for(var o=0;oa)r=a;if(e.length>0&&(r<0||t<0)||t>this.length){throw new RangeError("attempt to write outside buffer bounds")}if(!n)n="utf8";var o=false;for(;;){switch(n){case"hex":return E(this,e,t,r);case"utf8":case"utf-8":return I(this,e,t,r);case"ascii":return A(this,e,t,r);case"binary":return j(this,e,t,r);case"base64":return S(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return x(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase();o=true}}};u.prototype.toJSON=function le(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function C(e,t,r){if(t===0&&r===e.length){return n.fromByteArray(e)}else{return n.fromByteArray(e.slice(t,r))}}function L(e,t,r){var n="";var i="";r=Math.min(e.length,r);for(var a=t;an)r=n;var i="";for(var a=t;ar){e=r}if(t<0){t+=r;if(t<0)t=0}else if(t>r){t=r}if(tr)throw new RangeError("Trying to access beyond buffer length")}u.prototype.readUIntLE=function ce(e,t,r){e=e|0;t=t|0;if(!r)T(e,t,this.length);var n=this[e];var i=1;var a=0;while(++a0&&(i*=256)){n+=this[e+--t]*i}return n};u.prototype.readUInt8=function de(e,t){if(!t)T(e,1,this.length);return this[e]};u.prototype.readUInt16LE=function ge(e,t){if(!t)T(e,2,this.length);return this[e]|this[e+1]<<8};u.prototype.readUInt16BE=function ve(e,t){if(!t)T(e,2,this.length);return this[e]<<8|this[e+1]};u.prototype.readUInt32LE=function me(e,t){if(!t)T(e,4,this.length);return(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216};u.prototype.readUInt32BE=function ye(e,t){if(!t)T(e,4,this.length);return this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])};u.prototype.readIntLE=function be(e,t,r){e=e|0;t=t|0;if(!r)T(e,t,this.length);var n=this[e];var i=1;var a=0;while(++a=i)n-=Math.pow(2,8*t);return n};u.prototype.readIntBE=function we(e,t,r){e=e|0;t=t|0;if(!r)T(e,t,this.length);var n=t;var i=1;var a=this[e+--n];while(n>0&&(i*=256)){a+=this[e+--n]*i}i*=128;if(a>=i)a-=Math.pow(2,8*t);return a};u.prototype.readInt8=function _e(e,t){if(!t)T(e,1,this.length);if(!(this[e]&128))return this[e];return(255-this[e]+1)*-1};u.prototype.readInt16LE=function Ee(e,t){if(!t)T(e,2,this.length);var r=this[e]|this[e+1]<<8;return r&32768?r|4294901760:r};u.prototype.readInt16BE=function Ie(e,t){if(!t)T(e,2,this.length);var r=this[e+1]|this[e]<<8;return r&32768?r|4294901760:r};u.prototype.readInt32LE=function Ae(e,t){if(!t)T(e,4,this.length);return this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24};u.prototype.readInt32BE=function je(e,t){if(!t)T(e,4,this.length);return this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]};u.prototype.readFloatLE=function Se(e,t){if(!t)T(e,4,this.length);return i.read(this,e,true,23,4)};u.prototype.readFloatBE=function xe(e,t){if(!t)T(e,4,this.length);return i.read(this,e,false,23,4)};u.prototype.readDoubleLE=function Ce(e,t){if(!t)T(e,8,this.length);return i.read(this,e,true,52,8)};u.prototype.readDoubleBE=function Le(e,t){if(!t)T(e,8,this.length);return i.read(this,e,false,52,8)};function M(e,t,r,n,i,a){if(!u.isBuffer(e))throw new TypeError("buffer must be a Buffer instance");if(t>i||te.length)throw new RangeError("index out of range")}u.prototype.writeUIntLE=function Re(e,t,r,n){e=+e;t=t|0;r=r|0;if(!n)M(this,e,t,r,Math.pow(2,8*r),0);var i=1;var a=0;this[t]=e&255;while(++a=0&&(a*=256)){this[t+i]=e/a&255}return t+r};u.prototype.writeUInt8=function Be(e,t,r){e=+e;t=t|0;if(!r)M(this,e,t,1,255,0);if(!u.TYPED_ARRAY_SUPPORT)e=Math.floor(e);this[t]=e;return t+1};function P(e,t,r,n){if(t<0)t=65535+t+1;for(var i=0,a=Math.min(e.length-r,2);i>>(n?i:1-i)*8}}u.prototype.writeUInt16LE=function Oe(e,t,r){e=+e;t=t|0;if(!r)M(this,e,t,2,65535,0);if(u.TYPED_ARRAY_SUPPORT){this[t]=e;this[t+1]=e>>>8}else{P(this,e,t,true)}return t+2};u.prototype.writeUInt16BE=function Te(e,t,r){e=+e;t=t|0;if(!r)M(this,e,t,2,65535,0);if(u.TYPED_ARRAY_SUPPORT){this[t]=e>>>8;this[t+1]=e}else{P(this,e,t,false)}return t+2};function U(e,t,r,n){if(t<0)t=4294967295+t+1;for(var i=0,a=Math.min(e.length-r,4);i>>(n?i:3-i)*8&255}}u.prototype.writeUInt32LE=function Me(e,t,r){e=+e;t=t|0;if(!r)M(this,e,t,4,4294967295,0);if(u.TYPED_ARRAY_SUPPORT){this[t+3]=e>>>24;this[t+2]=e>>>16;this[t+1]=e>>>8;this[t]=e}else{U(this,e,t,true)}return t+4};u.prototype.writeUInt32BE=function Pe(e,t,r){e=+e;t=t|0;if(!r)M(this,e,t,4,4294967295,0);if(u.TYPED_ARRAY_SUPPORT){this[t]=e>>>24;this[t+1]=e>>>16;this[t+2]=e>>>8;this[t+3]=e}else{U(this,e,t,false)}return t+4};u.prototype.writeIntLE=function Ue(e,t,r,n){e=+e;t=t|0;if(!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var a=0;var o=1;var s=e<0?1:0;this[t]=e&255;while(++a>0)-s&255}return t+r};u.prototype.writeIntBE=function Ne(e,t,r,n){e=+e;t=t|0;if(!n){var i=Math.pow(2,8*r-1);M(this,e,t,r,i-1,-i)}var a=r-1;var o=1;var s=e<0?1:0;this[t+a]=e&255;while(--a>=0&&(o*=256)){this[t+a]=(e/o>>0)-s&255}return t+r};u.prototype.writeInt8=function De(e,t,r){e=+e;t=t|0;if(!r)M(this,e,t,1,127,-128);if(!u.TYPED_ARRAY_SUPPORT)e=Math.floor(e);if(e<0)e=255+e+1;this[t]=e;return t+1};u.prototype.writeInt16LE=function qe(e,t,r){e=+e;t=t|0;if(!r)M(this,e,t,2,32767,-32768);if(u.TYPED_ARRAY_SUPPORT){this[t]=e;this[t+1]=e>>>8}else{P(this,e,t,true)}return t+2};u.prototype.writeInt16BE=function We(e,t,r){e=+e;t=t|0;if(!r)M(this,e,t,2,32767,-32768);if(u.TYPED_ARRAY_SUPPORT){this[t]=e>>>8;this[t+1]=e}else{P(this,e,t,false)}return t+2};u.prototype.writeInt32LE=function Ye(e,t,r){e=+e;t=t|0;if(!r)M(this,e,t,4,2147483647,-2147483648);if(u.TYPED_ARRAY_SUPPORT){this[t]=e;this[t+1]=e>>>8;this[t+2]=e>>>16;this[t+3]=e>>>24}else{U(this,e,t,true)}return t+4};u.prototype.writeInt32BE=function He(e,t,r){e=+e;t=t|0;if(!r)M(this,e,t,4,2147483647,-2147483648);if(e<0)e=4294967295+e+1;if(u.TYPED_ARRAY_SUPPORT){this[t]=e>>>24;this[t+1]=e>>>16;this[t+2]=e>>>8;this[t+3]=e}else{U(this,e,t,false)}return t+4};function N(e,t,r,n,i,a){if(t>i||te.length)throw new RangeError("index out of range");if(r<0)throw new RangeError("index out of range")}function D(e,t,r,n,a){if(!a){N(e,t,r,4,3.4028234663852886e38,-3.4028234663852886e38)}i.write(e,t,r,n,23,4);return r+4}u.prototype.writeFloatLE=function Fe(e,t,r){return D(this,e,t,true,r)};u.prototype.writeFloatBE=function ze(e,t,r){return D(this,e,t,false,r)};function q(e,t,r,n,a){if(!a){N(e,t,r,8,1.7976931348623157e308,-1.7976931348623157e308)}i.write(e,t,r,n,52,8);return r+8}u.prototype.writeDoubleLE=function Ze(e,t,r){return q(this,e,t,true,r)};u.prototype.writeDoubleBE=function Xe(e,t,r){return q(this,e,t,false,r)};u.prototype.copy=function Je(e,t,r,n){if(!r)r=0;if(!n&&n!==0)n=this.length;if(t>=e.length)t=e.length;if(!t)t=0;if(n>0&&n=this.length)throw new RangeError("sourceStart out of bounds");if(n<0)throw new RangeError("sourceEnd out of bounds");if(n>this.length)n=this.length;if(e.length-t=this.length)throw new RangeError("start out of bounds");if(r<0||r>this.length)throw new RangeError("end out of bounds");var n;if(typeof e==="number"){for(n=t;n55295&&r<57344){if(i){if(r<56320){if((t-=3)>-1)a.push(239,191,189);i=r;continue}else{r=i-55296<<10|r-56320|65536;i=null}}else{if(r>56319){if((t-=3)>-1)a.push(239,191,189);continue}else if(o+1===n){if((t-=3)>-1)a.push(239,191,189);continue}else{i=r;continue}}}else if(i){if((t-=3)>-1)a.push(239,191,189);i=null}if(r<128){if((t-=1)<0)break;a.push(r)}else if(r<2048){if((t-=2)<0)break;a.push(r>>6|192,r&63|128)}else if(r<65536){if((t-=3)<0)break;a.push(r>>12|224,r>>6&63|128,r&63|128)}else if(r<2097152){if((t-=4)<0)break;a.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128)}else{throw new Error("Invalid code point")}}return a}function X(e){var t=[];for(var r=0;r>8;i=r%256;a.push(i);a.push(n)}return a}function G(e){return n.toByteArray(H(e))}function V(e,t,r,n){for(var i=0;i=t.length||i>=e.length)break;t[i+r]=e[i]}return i}function K(e){try{return decodeURIComponent(e)}catch(t){return String.fromCharCode(65533)}}},{"base64-js":6,ieee754:7,"is-array":8}],6:[function(e,t,r){var n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";(function(e){"use strict";var t=typeof Uint8Array!=="undefined"?Uint8Array:Array;var r="+".charCodeAt(0);var i="/".charCodeAt(0);var a="0".charCodeAt(0);var o="a".charCodeAt(0);var s="A".charCodeAt(0);var u="-".charCodeAt(0);var f="_".charCodeAt(0);function l(e){var t=e.charCodeAt(0);if(t===r||t===u)return 62;if(t===i||t===f)return 63;if(t0){throw new Error("Invalid string. Length must be a multiple of 4")}var u=e.length;o="="===e.charAt(u-2)?2:"="===e.charAt(u-1)?1:0;s=new t(e.length*3/4-o);i=o>0?e.length-4:e.length;var f=0;function h(e){s[f++]=e}for(r=0,n=0;r>16);h((a&65280)>>8);h(a&255)}if(o===2){a=l(e.charAt(r))<<2|l(e.charAt(r+1))>>4;h(a&255)}else if(o===1){a=l(e.charAt(r))<<10|l(e.charAt(r+1))<<4|l(e.charAt(r+2))>>2;h(a>>8&255);h(a&255)}return s}function c(e){var t,r=e.length%3,i="",a,o;function s(e){return n.charAt(e)}function u(e){return s(e>>18&63)+s(e>>12&63)+s(e>>6&63)+s(e&63)}for(t=0,o=e.length-r;t>2);i+=s(a<<4&63);i+="==";break;case 2:a=(e[e.length-2]<<8)+e[e.length-1];i+=s(a>>10);i+=s(a>>4&63);i+=s(a<<2&63);i+="=";break}return i}e.toByteArray=h;e.fromByteArray=c})(typeof r==="undefined"?this.base64js={}:r)},{}],7:[function(e,t,r){r.read=function(e,t,r,n,i){var a,o;var s=i*8-n-1;var u=(1<>1;var l=-7;var h=r?i-1:0;var c=r?-1:1;var p=e[t+h];h+=c;a=p&(1<<-l)-1;p>>=-l;l+=s;for(;l>0;a=a*256+e[t+h],h+=c,l-=8){}o=a&(1<<-l)-1;a>>=-l;l+=n;for(;l>0;o=o*256+e[t+h],h+=c,l-=8){}if(a===0){a=1-f}else if(a===u){return o?NaN:(p?-1:1)*Infinity}else{o=o+Math.pow(2,n);a=a-f}return(p?-1:1)*o*Math.pow(2,a-n)};r.write=function(e,t,r,n,i,a){var o,s,u;var f=a*8-i-1;var l=(1<>1;var c=i===23?Math.pow(2,-24)-Math.pow(2,-77):0;var p=n?0:a-1;var d=n?1:-1;var g=t<0||t===0&&1/t<0?1:0;t=Math.abs(t);if(isNaN(t)||t===Infinity){s=isNaN(t)?1:0;o=l}else{o=Math.floor(Math.log(t)/Math.LN2);if(t*(u=Math.pow(2,-o))<1){o--;u*=2}if(o+h>=1){t+=c/u}else{t+=c*Math.pow(2,1-h)}if(t*u>=2){o++;u/=2}if(o+h>=l){s=0;o=l}else if(o+h>=1){s=(t*u-1)*Math.pow(2,i);o=o+h}else{s=t*Math.pow(2,h-1)*Math.pow(2,i);o=0}}for(;i>=8;e[r+p]=s&255,p+=d,s/=256,i-=8){}o=o<0;e[r+p]=o&255,p+=d,o/=256,f-=8){}e[r+p-d]|=g*128}},{}],8:[function(e,t,r){var n=Array.isArray;var i=Object.prototype.toString;t.exports=n||function(e){return!!e&&"[object Array]"==i.call(e)}},{}],9:[function(e,t,r){function n(){this._events=this._events||{};this._maxListeners=this._maxListeners||undefined}t.exports=n;n.EventEmitter=n;n.prototype._events=undefined;n.prototype._maxListeners=undefined;n.defaultMaxListeners=10;n.prototype.setMaxListeners=function(e){if(!a(e)||e<0||isNaN(e))throw TypeError("n must be a positive number");this._maxListeners=e;return this};n.prototype.emit=function(e){var t,r,n,a,u,f;if(!this._events)this._events={};if(e==="error"){if(!this._events.error||o(this._events.error)&&!this._events.error.length){t=arguments[1];if(t instanceof Error){throw t}throw TypeError('Uncaught, unspecified "error" event.')}}r=this._events[e];if(s(r))return false;if(i(r)){switch(arguments.length){case 1:r.call(this);break;case 2:r.call(this,arguments[1]);break;case 3:r.call(this,arguments[1],arguments[2]);break;default:n=arguments.length;a=new Array(n-1);for(u=1;u0&&this._events[e].length>r){this._events[e].warned=true;console.error("(node) warning: possible EventEmitter memory "+"leak detected. %d listeners added. "+"Use emitter.setMaxListeners() to increase limit.",this._events[e].length);if(typeof console.trace==="function"){console.trace()}}}return this};n.prototype.on=n.prototype.addListener;n.prototype.once=function(e,t){if(!i(t))throw TypeError("listener must be a function");var r=false;function n(){this.removeListener(e,n);if(!r){r=true;t.apply(this,arguments)}}n.listener=t;this.on(e,n);return this};n.prototype.removeListener=function(e,t){var r,n,a,s;if(!i(t))throw TypeError("listener must be a function");if(!this._events||!this._events[e])return this;r=this._events[e];a=r.length;n=-1;if(r===t||i(r.listener)&&r.listener===t){ 2 | delete this._events[e];if(this._events.removeListener)this.emit("removeListener",e,t)}else if(o(r)){for(s=a;s-->0;){if(r[s]===t||r[s].listener&&r[s].listener===t){n=s;break}}if(n<0)return this;if(r.length===1){r.length=0;delete this._events[e]}else{r.splice(n,1)}if(this._events.removeListener)this.emit("removeListener",e,t)}return this};n.prototype.removeAllListeners=function(e){var t,r;if(!this._events)return this;if(!this._events.removeListener){if(arguments.length===0)this._events={};else if(this._events[e])delete this._events[e];return this}if(arguments.length===0){for(t in this._events){if(t==="removeListener")continue;this.removeAllListeners(t)}this.removeAllListeners("removeListener");this._events={};return this}r=this._events[e];if(i(r)){this.removeListener(e,r)}else{while(r.length)this.removeListener(e,r[r.length-1])}delete this._events[e];return this};n.prototype.listeners=function(e){var t;if(!this._events||!this._events[e])t=[];else if(i(this._events[e]))t=[this._events[e]];else t=this._events[e].slice();return t};n.listenerCount=function(e,t){var r;if(!e._events||!e._events[t])r=0;else if(i(e._events[t]))r=1;else r=e._events[t].length;return r};function i(e){return typeof e==="function"}function a(e){return typeof e==="number"}function o(e){return typeof e==="object"&&e!==null}function s(e){return e===void 0}},{}],10:[function(e,t,r){if(typeof Object.create==="function"){t.exports=function n(e,t){e.super_=t;e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:false,writable:true,configurable:true}})}}else{t.exports=function i(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype;e.prototype=new r;e.prototype.constructor=e}}},{}],11:[function(e,t,r){t.exports=Array.isArray||function(e){return Object.prototype.toString.call(e)=="[object Array]"}},{}],12:[function(e,t,r){r.endianness=function(){return"LE"};r.hostname=function(){if(typeof location!=="undefined"){return location.hostname}else return""};r.loadavg=function(){return[]};r.uptime=function(){return 0};r.freemem=function(){return Number.MAX_VALUE};r.totalmem=function(){return Number.MAX_VALUE};r.cpus=function(){return[]};r.type=function(){return"Browser"};r.release=function(){if(typeof navigator!=="undefined"){return navigator.appVersion}return""};r.networkInterfaces=r.getNetworkInterfaces=function(){return{}};r.arch=function(){return"javascript"};r.platform=function(){return"browser"};r.tmpdir=r.tmpDir=function(){return"/tmp"};r.EOL="\n"},{}],13:[function(e,t,r){(function(e){function t(e,t){var r=0;for(var n=e.length-1;n>=0;n--){var i=e[n];if(i==="."){e.splice(n,1)}else if(i===".."){e.splice(n,1);r++}else if(r){e.splice(n,1);r--}}if(t){for(;r--;r){e.unshift("..")}}return e}var n=/^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/;var i=function(e){return n.exec(e).slice(1)};r.resolve=function(){var r="",n=false;for(var i=arguments.length-1;i>=-1&&!n;i--){var o=i>=0?arguments[i]:e.cwd();if(typeof o!=="string"){throw new TypeError("Arguments to path.resolve must be strings")}else if(!o){continue}r=o+"/"+r;n=o.charAt(0)==="/"}r=t(a(r.split("/"),function(e){return!!e}),!n).join("/");return(n?"/":"")+r||"."};r.normalize=function(e){var n=r.isAbsolute(e),i=o(e,-1)==="/";e=t(a(e.split("/"),function(e){return!!e}),!n).join("/");if(!e&&!n){e="."}if(e&&i){e+="/"}return(n?"/":"")+e};r.isAbsolute=function(e){return e.charAt(0)==="/"};r.join=function(){var e=Array.prototype.slice.call(arguments,0);return r.normalize(a(e,function(e,t){if(typeof e!=="string"){throw new TypeError("Arguments to path.join must be strings")}return e}).join("/"))};r.relative=function(e,t){e=r.resolve(e).substr(1);t=r.resolve(t).substr(1);function n(e){var t=0;for(;t=0;r--){if(e[r]!=="")break}if(t>r)return[];return e.slice(t,r-t+1)}var i=n(e.split("/"));var a=n(t.split("/"));var o=Math.min(i.length,a.length);var s=o;for(var u=0;u1){for(var r=1;r= 0x80 (not a basic code point)","invalid-input":"Invalid input"},E=l-h,I=Math.floor,A=String.fromCharCode,j;function S(e){throw RangeError(_[e])}function x(e,t){var r=e.length;var n=[];while(r--){n[r]=t(e[r])}return n}function C(e,t){var r=e.split("@");var n="";if(r.length>1){n=r[0]+"@";e=r[1]}e=e.replace(w,".");var i=e.split(".");var a=x(i,t).join(".");return n+a}function L(e){var t=[],r=0,n=e.length,i,a;while(r=55296&&i<=56319&&r65535){e-=65536;t+=A(e>>>10&1023|55296);e=56320|e&1023}t+=A(e);return t}).join("")}function k(e){if(e-48<10){return e-22}if(e-65<26){return e-65}if(e-97<26){return e-97}return l}function B(e,t){return e+22+75*(e<26)-((t!=0)<<5)}function O(e,t,r){var n=0;e=r?I(e/d):e>>1;e+=I(e/t);for(;e>E*c>>1;n+=l){e=I(e/E)}return I(n+(E+1)*e/(e+p))}function T(e){var t=[],r=e.length,n,i=0,a=v,o=g,s,u,p,d,y,b,w,_,E;s=e.lastIndexOf(m);if(s<0){s=0}for(u=0;u=128){S("not-basic")}t.push(e.charCodeAt(u))}for(p=s>0?s+1:0;p=r){S("invalid-input")}w=k(e.charCodeAt(p++));if(w>=l||w>I((f-i)/y)){S("overflow")}i+=w*y;_=b<=o?h:b>=o+c?c:b-o;if(w<_){break}E=l-_;if(y>I(f/E)){S("overflow")}y*=E}n=t.length+1;o=O(i-d,n,d==0);if(I(i/n)>f-a){S("overflow")}a+=I(i/n);i%=n;t.splice(i++,0,a)}return R(t)}function M(e){var t,r,n,i,a,o,s,u,p,d,y,b=[],w,_,E,j;e=L(e);w=e.length;t=v;r=0;a=g;for(o=0;o=t&&yI((f-r)/_)){S("overflow")}r+=(s-t)*_;t=s;for(o=0;of){S("overflow")}if(y==t){for(u=r,p=l;;p+=l){d=p<=a?h:p>=a+c?c:p-a;if(u0&&f>u){f=u}for(var l=0;l=0){p=h.substr(0,c);d=h.substr(c+1)}else{p=h;d=""}g=decodeURIComponent(p);v=decodeURIComponent(d);if(!n(o,g)){o[g]=v}else if(i(o[g])){o[g].push(v)}else{o[g]=[o[g],v]}}return o};var i=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"}},{}],17:[function(e,t,r){"use strict";var n=function(e){switch(typeof e){case"string":return e;case"boolean":return e?"true":"false";case"number":return isFinite(e)?e:"";default:return""}};t.exports=function(e,t,r,s){t=t||"&";r=r||"=";if(e===null){e=undefined}if(typeof e==="object"){return a(o(e),function(o){var s=encodeURIComponent(n(o))+r;if(i(e[o])){return a(e[o],function(e){return s+encodeURIComponent(n(e))}).join(t)}else{return s+encodeURIComponent(n(e[o]))}}).join(t)}if(!s)return"";return encodeURIComponent(n(s))+r+encodeURIComponent(n(e))};var i=Array.isArray||function(e){return Object.prototype.toString.call(e)==="[object Array]"};function a(e,t){if(e.map)return e.map(t);var r=[];for(var n=0;n0){if(t.ended&&!i){var o=new Error("stream.push() after EOF");e.emit("error",o)}else if(t.endEmitted&&i){var o=new Error("stream.unshift() after end event");e.emit("error",o)}else{if(t.decoder&&!i&&!n)r=t.decoder.write(r);if(!i)t.reading=false;if(t.flowing&&t.length===0&&!t.sync){e.emit("data",r);e.read(0)}else{t.length+=t.objectMode?1:r.length;if(i)t.buffer.unshift(r);else t.buffer.push(r);if(t.needReadable)w(e)}E(e,t)}}else if(!i){t.reading=false}return d(t)}function d(e){return!e.ended&&(e.needReadable||e.length=g){e=g}else{e--;for(var t=1;t<32;t<<=1)e|=e>>t;e++}return e}function m(e,t){if(t.length===0&&t.ended)return 0;if(t.objectMode)return e===0?0:1;if(e===null||isNaN(e)){if(t.flowing&&t.buffer.length)return t.buffer[0].length;else return t.length}if(e<=0)return 0;if(e>t.highWaterMark)t.highWaterMark=v(e);if(e>t.length){if(!t.ended){t.needReadable=true;return 0}else{return t.length}}return e}c.prototype.read=function(e){f("read",e);var t=this._readableState;var r=e;if(typeof e!=="number"||e>0)t.emittedReadable=false;if(e===0&&t.needReadable&&(t.length>=t.highWaterMark||t.ended)){f("read: emitReadable",t.length,t.ended);if(t.length===0&&t.ended)R(this);else w(this);return null}e=m(e,t);if(e===0&&t.ended){if(t.length===0)R(this);return null}var n=t.needReadable;f("need readable",n);if(t.length===0||t.length-e0)i=L(e,t);else i=null;if(i===null){t.needReadable=true;e=0}t.length-=e;if(t.length===0&&!t.ended)t.needReadable=true;if(r!==e&&t.ended&&t.length===0)R(this);if(i!==null)this.emit("data",i);return i};function y(e,t){var r=null;if(!a.isBuffer(t)&&typeof t!=="string"&&t!==null&&t!==undefined&&!e.objectMode){r=new TypeError("Invalid non-string/buffer chunk")}return r}function b(e,t){if(t.ended)return;if(t.decoder){var r=t.decoder.end();if(r&&r.length){t.buffer.push(r);t.length+=t.objectMode?1:r.length}}t.ended=true;w(e)}function w(e){var t=e._readableState;t.needReadable=false;if(!t.emittedReadable){f("emitReadable",t.flowing);t.emittedReadable=true;if(t.sync)n(_,e);else _(e)}}function _(e){f("emit readable");e.emit("readable");C(e)}function E(e,t){if(!t.readingMore){t.readingMore=true;n(I,e,t)}}function I(e,t){var r=t.length;while(!t.reading&&!t.flowing&&!t.ended&&t.length=n){if(i)s=r.join("");else s=a.concat(r,n);r.length=0}else{if(e0)throw new Error("endReadable called on non-empty stream");if(!t.endEmitted){t.ended=true;n(k,t,e)}}function k(e,t){if(!e.endEmitted&&e.length===0){e.endEmitted=true;t.readable=false;t.emit("end")}}function B(e,t){for(var r=0,n=e.length;r-1))throw new TypeError("Unknown encoding: "+e);this._writableState.defaultEncoding=e};function p(e,t,r){if(!e.objectMode&&e.decodeStrings!==false&&typeof t==="string"){t=new i(t,r)}return t}function d(e,t,r,n,a){r=p(t,r,n);if(i.isBuffer(r))n="buffer";var o=t.objectMode?1:r.length;t.length+=o;var s=t.lengthe._pos){var a=r.substr(e._pos);if(e._charset==="x-user-defined"){var o=new n(a.length);for(var s=0;se._pos){e.push(new n(new Uint8Array(f.result.slice(e._pos))));e._pos=f.result.byteLength}};f.onload=function(){e.push(null)};f.readAsArrayBuffer(r);break}if(e._xhr.readyState===u.DONE&&e._mode!=="ms-stream"){e.push(null)}}}).call(this,e("_process"),e("buffer").Buffer)},{"./capability":34,_process:14,buffer:5,foreach:38,inherits:10,stream:32}],37:[function(e,t,r){t.exports={100:"Continue",101:"Switching Protocols",102:"Processing",200:"OK",201:"Created",202:"Accepted",203:"Non-Authoritative Information",204:"No Content",205:"Reset Content",206:"Partial Content",207:"Multi-Status",300:"Multiple Choices",301:"Moved Permanently",302:"Moved Temporarily",303:"See Other",304:"Not Modified",305:"Use Proxy",307:"Temporary Redirect",308:"Permanent Redirect",400:"Bad Request",401:"Unauthorized",402:"Payment Required",403:"Forbidden",404:"Not Found",405:"Method Not Allowed",406:"Not Acceptable",407:"Proxy Authentication Required",408:"Request Time-out",409:"Conflict",410:"Gone",411:"Length Required",412:"Precondition Failed",413:"Request Entity Too Large",414:"Request-URI Too Large",415:"Unsupported Media Type",416:"Requested Range Not Satisfiable",417:"Expectation Failed",418:"I'm a teapot",422:"Unprocessable Entity",423:"Locked",424:"Failed Dependency",425:"Unordered Collection",426:"Upgrade Required",428:"Precondition Required",429:"Too Many Requests",431:"Request Header Fields Too Large",500:"Internal Server Error",501:"Not Implemented",502:"Bad Gateway",503:"Service Unavailable",504:"Gateway Time-out",505:"HTTP Version Not Supported",506:"Variant Also Negotiates",507:"Insufficient Storage",509:"Bandwidth Limit Exceeded",510:"Not Extended",511:"Network Authentication Required"}},{}],38:[function(e,t,r){var n=Object.prototype.hasOwnProperty;var i=Object.prototype.toString;t.exports=function a(e,t,r){if(i.call(t)!=="[object Function]"){throw new TypeError("iterator must be a function")}var a=e.length;if(a===+a){for(var o=0;o0&&!n.call(e,0)){for(var p=0;p0){for(var d=0;d=0&&n.call(e.callee)==="[object Function]"}return r}},{}],42:[function(e,t,r){var n=e("buffer").Buffer;var i=n.isEncoding||function(e){switch(e&&e.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return true;default:return false}};function a(e){if(e&&!i(e)){throw new Error("Unknown encoding: "+e)}}var o=r.StringDecoder=function(e){this.encoding=(e||"utf8").toLowerCase().replace(/[-_]/,"");a(e);switch(this.encoding){case"utf8":this.surrogateSize=3;break;case"ucs2":case"utf16le":this.surrogateSize=2;this.detectIncompleteChar=u;break;case"base64":this.surrogateSize=3;this.detectIncompleteChar=f;break;default:this.write=s;return}this.charBuffer=new n(6);this.charReceived=0;this.charLength=0};o.prototype.write=function(e){var t="";while(this.charLength){var r=e.length>=this.charLength-this.charReceived?this.charLength-this.charReceived:e.length;e.copy(this.charBuffer,this.charReceived,0,r);this.charReceived+=r;if(this.charReceived=55296&&n<=56319){this.charLength+=this.surrogateSize;t="";continue}this.charReceived=this.charLength=0;if(e.length===0){return t}break}this.detectIncompleteChar(e);var i=e.length;if(this.charLength){e.copy(this.charBuffer,0,e.length-this.charReceived,i);i-=this.charReceived}t+=e.toString(this.encoding,0,i);var i=t.length-1;var n=t.charCodeAt(i);if(n>=55296&&n<=56319){var a=this.surrogateSize;this.charLength+=a;this.charReceived+=a;this.charBuffer.copy(this.charBuffer,a,0,a);e.copy(this.charBuffer,0,0,a);return t.substring(0,i)}return t};o.prototype.detectIncompleteChar=function(e){var t=e.length>=3?3:e.length;for(;t>0;t--){var r=e[e.length-t];if(t==1&&r>>5==6){this.charLength=2;break}if(t<=2&&r>>4==14){this.charLength=3;break}if(t<=3&&r>>3==30){this.charLength=4;break}}this.charReceived=t};o.prototype.end=function(e){var t="";if(e&&e.length)t=this.write(e);if(this.charReceived){var r=this.charReceived;var n=this.charBuffer;var i=this.encoding;t+=n.slice(0,r).toString(i)}return t};function s(e){return e.toString(this.encoding)}function u(e){this.charReceived=e.length%2;this.charLength=this.charReceived?2:0}function f(e){this.charReceived=e.length%3;this.charLength=this.charReceived?3:0}},{buffer:5}],43:[function(e,t,r){var n=e("punycode");r.parse=b;r.resolve=_;r.resolveObject=E;r.format=w;r.Url=i;function i(){this.protocol=null;this.slashes=null;this.auth=null;this.host=null;this.port=null;this.hostname=null;this.hash=null;this.search=null;this.query=null;this.pathname=null;this.path=null;this.href=null}var a=/^([a-z0-9.+-]+:)/i,o=/:[0-9]*$/,s=["<",">",'"',"`"," ","\r","\n"," "],u=["{","}","|","\\","^","`"].concat(s),f=["'"].concat(u),l=["%","/","?",";","#"].concat(f),h=["/","?","#"],c=255,p=/^[a-z0-9A-Z_-]{0,63}$/,d=/^([a-z0-9A-Z_-]{0,63})(.*)$/,g={javascript:true,"javascript:":true},v={javascript:true,"javascript:":true},m={http:true,https:true,ftp:true,gopher:true,file:true,"http:":true,"https:":true,"ftp:":true,"gopher:":true,"file:":true},y=e("querystring");function b(e,t,r){if(e&&A(e)&&e instanceof i)return e;var n=new i;n.parse(e,t,r);return n}i.prototype.parse=function(e,t,r){if(!I(e)){throw new TypeError("Parameter 'url' must be a string, not "+typeof e)}var i=e;i=i.trim();var o=a.exec(i);if(o){o=o[0];var s=o.toLowerCase();this.protocol=s;i=i.substr(o.length)}if(r||o||i.match(/^\/\/[^@\/]+@[^@\/]+/)){var u=i.substr(0,2)==="//";if(u&&!(o&&v[o])){i=i.substr(2);this.slashes=true}}if(!v[o]&&(u||o&&!m[o])){var b=-1;for(var w=0;w127){L+="x"}else{L+=C[R]}}if(!L.match(p)){var B=S.slice(0,w);var O=S.slice(w+1);var T=C.match(d);if(T){B.push(T[1]);O.unshift(T[2])}if(O.length){i="/"+O.join(".")+i}this.hostname=B.join(".");break}}}}if(this.hostname.length>c){this.hostname=""}else{this.hostname=this.hostname.toLowerCase()}if(!j){var M=this.hostname.split(".");var P=[];for(var w=0;w0?r.host.split("@"):false;if(p){r.auth=p.shift();r.host=r.hostname=p.shift()}}r.search=e.search;r.query=e.query;if(!j(r.pathname)||!j(r.search)){r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")}r.href=r.format();return r}if(!h.length){r.pathname=null;if(r.search){r.path="/"+r.search}else{r.path=null}r.href=r.format();return r}var d=h.slice(-1)[0];var g=(r.host||e.host)&&(d==="."||d==="..")||d==="";var y=0;for(var b=h.length;b>=0;b--){d=h[b];if(d=="."){h.splice(b,1)}else if(d===".."){h.splice(b,1);y++}else if(y){h.splice(b,1);y--}}if(!f&&!l){for(;y--;y){h.unshift("..")}}if(f&&h[0]!==""&&(!h[0]||h[0].charAt(0)!=="/")){h.unshift("")}if(g&&h.join("/").substr(-1)!=="/"){h.push("")}var w=h[0]===""||h[0]&&h[0].charAt(0)==="/";if(c){r.hostname=r.host=w?"":h.length?h.shift():"";var p=r.host&&r.host.indexOf("@")>0?r.host.split("@"):false;if(p){r.auth=p.shift();r.host=r.hostname=p.shift()}}f=f||r.host&&h.length;if(f&&!w){h.unshift("")}if(!h.length){r.pathname=null;r.path=null}else{r.pathname=h.join("/")}if(!j(r.pathname)||!j(r.search)){r.path=(r.pathname?r.pathname:"")+(r.search?r.search:"")}r.auth=e.auth||r.auth;r.slashes=r.slashes||e.slashes;r.href=r.format();return r};i.prototype.parseHost=function(){var e=this.host;var t=o.exec(e);if(t){t=t[0];if(t!==":"){this.port=t.substr(1)}e=e.substr(0,e.length-t.length)}if(e)this.hostname=e};function I(e){return typeof e==="string"}function A(e){return typeof e==="object"&&e!==null}function j(e){return e===null}function S(e){return e==null}},{punycode:15,querystring:18}],44:[function(e,t,r){t.exports=n;function n(){var e={};for(var t=0;t=r.length)throw E("invalid address: "+e);t.push([i,r[n]])}return t}function l(e){var t=[];n(e,function(e){var r=I(e);t.push(r.name);if(e.length>1)t.push(e[1])});return"/"+t.join("/")}function h(e){return n(e,function(e){var t=I(e);if(e.length>1)return[t.code,o.toBuffer(t.code,e[1])];return[t.code]})}function c(e){return n(e,function(e){var t=I(e);if(e.length>1)return[t.code,o.toString(t.code,e[1])];return[t.code]})}function p(e){return y(r.concat(n(e,function(e){var t=I(e);var n=new r([t.code]);if(e.length>1)n=r.concat([n,e[1]]);return n})))}function d(e){var t=[];for(var r=0;re.length)throw E("Invalid address buffer: "+e.toString("hex"));t.push([n,o])}return t}function g(e){var t=d(e);var r=c(t);return l(r)}function v(e){e=_(e);var t=f(e);var r=h(t);return p(r)}function m(e){return v(e)}function y(e){var t=b(e);if(t)throw t;return new r(e)}function b(e){d(e)}function w(e){try{b(e);return true}catch(t){return false}}function _(e){return"/"+i(e.trim().split("/")).join("/")}function E(e){return new Error("Error parsing address: "+e)}function I(e){var t=s(e[0]);if(e.length>1&&t.size==0)throw E("tuple has address but protocol size is 0");return t}}).call(this,e("buffer").Buffer)},{"./convert":46,"./protocols":179,buffer:5,"lodash.filter":50,"lodash.map":114}],46:[function(e,t,r){(function(r){var n=e("ip");var i=e("./protocols");t.exports=a;function a(e,t){if(t instanceof r)return a.toString(e,t);else return a.toBuffer(e,t)}a.toString=function u(e,t){e=i(e);switch(e.code){case 4:case 41:return n.toString(t);case 6:case 17:case 33:case 132:return s(t)}return t.toString("hex")};a.toBuffer=function f(e,t){e=i(e);switch(e.code){case 4:case 41:return n.toBuffer(t);case 6:case 17:case 33:case 132:return o(parseInt(t,10))}return new r(t,"hex")};function o(e){var t=new r(2);t.writeUInt16BE(e,0);return t}function s(e){return e.readUInt16BE(0)}}).call(this,e("buffer").Buffer)},{"./protocols":179,buffer:5,ip:49}],47:[function(e,t,r){(function(r){var n=e("lodash.map");var i=e("xtend");var a=e("./codec");var o=e("buffer-equal");var s=e("./protocols");var u=new Error("Sorry, Not Implemented Yet.");t.exports=f;function f(e){if(!(this instanceof f))return new f(e);if(!e)e="";if(e instanceof r)this.buffer=a.fromBuffer(e);else if(typeof e=="string"||e instanceof String)this.buffer=a.fromString(e);else if(e.buffer&&e.protos&&e.protoCodes)this.buffer=a.fromBuffer(e.buffer);else throw new Error("addr must be a string, Buffer, or Multiaddr")}f.prototype.toString=function l(){return a.bufferToString(this.buffer)};f.prototype.inspect=function h(){return""};f.prototype.protos=function c(){return n(this.protoCodes(),function(e){return i(s(e))})};f.prototype.protos=function p(){return n(this.protoCodes(),function(e){return i(s(e))})};f.prototype.protoCodes=function d(){var e=[];for(var t=0;t>8&255;n[r++]=e&255})}else{throw Error("Invalid ip address: "+e)}return n};n.toString=function u(e,t,r){t=~~t;r=r||e.length-t;var n=[];if(r===4){for(var i=0;i32){t="ipv6"}else{t=o(t)}var r=4;if(t==="ipv6"){r=16}var a=new i(r);for(var s=0,u=a.length;s>f)}return n.toString(a)};n.mask=function l(e,l){e=n.toBuffer(e);l=n.toBuffer(l);var t=new i(Math.max(e.length,l.length));if(e.length===l.length){for(var r=0;re.length){i=t;a=e}var o=i.length-a.length;for(var r=o;r>>0};n.fromLong=function I(e){return(e>>>24)+"."+(e>>16&255)+"."+(e>>8&255)+"."+(e&255)};function o(e){return e?e.toLowerCase():"ipv4"}},{buffer:5,os:12}],50:[function(e,t,r){var n=e("lodash.createcallback"),i=e("lodash.forown");function a(e,t,r){var a=[];t=n(t,r,3);var o=-1,s=e?e.length:0;if(typeof s=="number"){while(++o2?n(e,17,i(arguments,2),null,t):n(e,1,null,null,t)}t.exports=a},{"lodash._createwrapper":57,"lodash._slice":67}],57:[function(e,t,r){var n=e("lodash._basebind"),i=e("lodash._basecreatewrapper"),a=e("lodash.isfunction"),o=e("lodash._slice");var s=[];var u=s.push,f=s.unshift;function l(e,t,r,s,h,c){var p=t&1,d=t&2,g=t&4,v=t&8,m=t&16,y=t&32;if(!d&&!a(e)){throw new TypeError}if(m&&!r.length){t&=~16;m=r=false}if(y&&!s.length){t&=~32;y=s=false}var b=e&&e.__bindData__;if(b&&b!==true){b=o(b);if(b[2]){b[2]=o(b[2])}if(b[3]){b[3]=o(b[3])}if(p&&!(b[1]&1)){b[4]=h}if(!p&&b[1]&1){t|=8}if(g&&!(b[1]&4)){b[5]=c}if(m){u.apply(b[2]||(b[2]=[]),r)}if(y){f.apply(b[3]||(b[3]=[]),s)}b[1]|=t;return l.apply(null,b)}var w=t==1||t===17?n:i;return w([e,t,r,s,h,c])}t.exports=l},{"lodash._basebind":58,"lodash._basecreatewrapper":62,"lodash._slice":67,"lodash.isfunction":66}],58:[function(e,t,r){var n=e("lodash._basecreate"),i=e("lodash.isobject"),a=e("lodash._setbinddata"),o=e("lodash._slice");var s=[];var u=s.push;function f(e){var t=e[0],r=e[2],s=e[4];function f(){if(r){var e=o(r);u.apply(e,arguments)}if(this instanceof f){var a=n(t.prototype),l=t.apply(a,e||arguments);return i(l)?l:a}return t.apply(s,e||arguments)}a(f,e);return f}t.exports=f},{"lodash._basecreate":59,"lodash._setbinddata":53,"lodash._slice":67,"lodash.isobject":80}],59:[function(e,t,r){(function(r){var n=e("lodash._isnative"),i=e("lodash.isobject"),a=e("lodash.noop");var o=n(o=Object.create)&&o;function s(e,t){return i(e)?o(e):{}}if(!o){s=function(){function e(){}return function(t){if(i(t)){e.prototype=t;var n=new e;e.prototype=null}return n||r.Object()}}()}t.exports=s}).call(this,typeof global!=="undefined"?global:typeof self!=="undefined"?self:typeof window!=="undefined"?window:{})},{"lodash._isnative":60,"lodash.isobject":80,"lodash.noop":61}],60:[function(e,t,r){arguments[4][54][0].apply(r,arguments)},{dup:54}],61:[function(e,t,r){arguments[4][55][0].apply(r,arguments)},{dup:55}],62:[function(e,t,r){var n=e("lodash._basecreate"),i=e("lodash.isobject"),a=e("lodash._setbinddata"),o=e("lodash._slice");var s=[];var u=s.push;function f(e){var t=e[0],r=e[1],s=e[2],l=e[3],h=e[4],c=e[5];var p=r&1,d=r&2,g=r&4,v=r&8,m=t;function y(){var e=p?h:this;if(s){var a=o(s);u.apply(a,arguments)}if(l||g){a||(a=o(arguments));if(l){u.apply(a,l)}if(g&&a.length-1}})}}w.pop();_.pop();if(B){s(w);s(_)}return E}t.exports=b},{"lodash._getarray":72,"lodash._objecttypes":74,"lodash._releasearray":75,"lodash.forin":78,"lodash.isfunction":79}],72:[function(e,t,r){var n=e("lodash._arraypool");function i(){return n.pop()||[]}t.exports=i},{"lodash._arraypool":73}],73:[function(e,t,r){var n=[];t.exports=n},{}],74:[function(e,t,r){var n={"boolean":false,"function":true,object:true,number:false,string:false,undefined:false};t.exports=n},{}],75:[function(e,t,r){var n=e("lodash._arraypool"),i=e("lodash._maxpoolsize");function a(e){e.length=0;if(n.length0&&this._separator){this.push(this._separator)}};a.prototype._pushTail=function(){if(this._tail){this.push(this._tail)}};function o(e){var t=new a(e);return t}o.SandwichStream=a;t.exports=o},{stream:32}],183:[function(e,t,r){(function(r){var n=e("path");var i=e("clone");var a=e("clone-stats");var o=e("./lib/cloneBuffer");var s=e("./lib/isBuffer");var u=e("./lib/isStream");var f=e("./lib/isNull");var l=e("./lib/inspectStream");var h=e("stream");var c=e("replace-ext");function p(e){if(!e)e={};var t=e.path?[e.path]:e.history;this.history=t||[];this.cwd=e.cwd||r.cwd();this.base=e.base||this.cwd;this.stat=e.stat||null;this.contents=e.contents||null}p.prototype.isBuffer=function(){return s(this.contents)};p.prototype.isStream=function(){return u(this.contents)};p.prototype.isNull=function(){return f(this.contents)};p.prototype.isDirectory=function(){return this.isNull()&&this.stat&&this.stat.isDirectory()};p.prototype.clone=function(e){if(typeof e==="boolean"){e={deep:e,contents:true}}else if(!e){e={deep:true,contents:true}}else{e.deep=e.deep===true;e.contents=e.contents!==false}var t;if(this.isStream()){t=this.contents.pipe(new h.PassThrough);this.contents=this.contents.pipe(new h.PassThrough)}else if(this.isBuffer()){t=e.contents?o(this.contents):this.contents}var r=new p({cwd:this.cwd,base:this.base,stat:this.stat?a(this.stat):null,history:this.history.slice(),contents:t});Object.keys(this).forEach(function(t){if(t==="_contents"||t==="stat"||t==="history"||t==="path"||t==="base"||t==="cwd"){return}r[t]=e.deep?i(this[t],true):this[t]},this);return r};p.prototype.pipe=function(e,t){if(!t)t={};if(typeof t.end==="undefined")t.end=true;if(this.isStream()){return this.contents.pipe(e,t)}if(this.isBuffer()){if(t.end){e.end(this.contents)}else{e.write(this.contents)}return e}if(t.end)e.end();return e};p.prototype.inspect=function(){var e=[];var t=this.base&&this.path?this.relative:this.path;if(t){e.push('"'+t+'"')}if(this.isBuffer()){e.push(this.contents.inspect())}if(this.isStream()){e.push(l(this.contents))}return""};Object.defineProperty(p.prototype,"contents",{get:function(){return this._contents},set:function(e){if(!s(e)&&!u(e)&&!f(e)){throw new Error("File.contents can only be a Buffer, a Stream, or null.")}this._contents=e}});Object.defineProperty(p.prototype,"relative",{get:function(){if(!this.base)throw new Error("No base specified! Can not get relative.");if(!this.path)throw new Error("No path specified! Can not get relative.");return n.relative(this.base,this.path)},set:function(){throw new Error("File.relative is generated from the base and path attributes. Do not modify it.")}});Object.defineProperty(p.prototype,"dirname",{get:function(){if(!this.path)throw new Error("No path specified! Can not get dirname.");return n.dirname(this.path)},set:function(e){if(!this.path)throw new Error("No path specified! Can not set dirname.");this.path=n.join(e,n.basename(this.path))}});Object.defineProperty(p.prototype,"basename",{get:function(){if(!this.path)throw new Error("No path specified! Can not get basename.");return n.basename(this.path)},set:function(e){if(!this.path)throw new Error("No path specified! Can not set basename.");this.path=n.join(n.dirname(this.path),e)}});Object.defineProperty(p.prototype,"extname",{get:function(){if(!this.path)throw new Error("No path specified! Can not get extname.");return n.extname(this.path)},set:function(e){if(!this.path)throw new Error("No path specified! Can not set extname.");this.path=c(this.path,e)}});Object.defineProperty(p.prototype,"path",{get:function(){return this.history[this.history.length-1]},set:function(e){if(typeof e!=="string")throw new Error("path should be string");if(e&&e!==this.path){this.history.push(e)}}});t.exports=p}).call(this,e("_process"))},{"./lib/cloneBuffer":184,"./lib/inspectStream":185,"./lib/isBuffer":186,"./lib/isNull":187,"./lib/isStream":188,_process:14,clone:190,"clone-stats":189,path:13,"replace-ext":191,stream:32}],184:[function(e,t,r){var n=e("buffer").Buffer;t.exports=function(e){var t=new n(e.length);e.copy(t);return t}},{buffer:5}],185:[function(e,t,r){var n=e("./isStream");t.exports=function(e){if(!n(e))return;var t=e.constructor.name;if(t==="Stream")t="";return"<"+t+"Stream>"}},{"./isStream":188}],186:[function(e,t,r){t.exports=e("buffer").Buffer.isBuffer},{buffer:5}],187:[function(e,t,r){t.exports=function(e){return e===null}},{}],188:[function(e,t,r){var n=e("stream").Stream;t.exports=function(e){return!!e&&e instanceof n}},{stream:32}],189:[function(e,t,r){var n=e("fs").Stats;t.exports=i;function i(e){var t=new n;Object.keys(e).forEach(function(r){t[r]=e[r]});return t}},{fs:3}],190:[function(e,t,r){(function(e){var r=function(){"use strict";function t(r,n,i,a){var s;if(typeof n==="object"){i=n.depth;a=n.prototype;s=n.filter;n=n.circular}var u=[];var f=[];var l=typeof e!="undefined";if(typeof n=="undefined")n=true;if(typeof i=="undefined")i=Infinity;function h(r,i){if(r===null)return null;if(i==0)return r;var s;var c;if(typeof r!="object"){return r}if(t.__isArray(r)){s=[]}else if(t.__isRegExp(r)){s=new RegExp(r.source,o(r));if(r.lastIndex)s.lastIndex=r.lastIndex}else if(t.__isDate(r)){s=new Date(r.getTime())}else if(l&&e.isBuffer(r)){s=new e(r.length);r.copy(s);return s}else{if(typeof a=="undefined"){c=Object.getPrototypeOf(r);s=Object.create(c)}else{s=Object.create(a);c=a}}if(n){var p=u.indexOf(r);if(p!=-1){return f[p]}u.push(r);f.push(s)}for(var d in r){var g;if(c){g=Object.getOwnPropertyDescriptor(c,d)}if(g&&g.set==null){continue}s[d]=h(r[d],i-1)}return s}return h(r,i)}t.clonePrototype=function s(e){if(e===null)return null;var t=function(){};t.prototype=e;return new t};function r(e){return Object.prototype.toString.call(e)}t.__objToStr=r;function n(e){return typeof e==="object"&&r(e)==="[object Date]"}t.__isDate=n;function i(e){return typeof e==="object"&&r(e)==="[object Array]"}t.__isArray=i;function a(e){return typeof e==="object"&&r(e)==="[object RegExp]"}t.__isRegExp=a;function o(e){var t="";if(e.global)t+="g";if(e.ignoreCase)t+="i";if(e.multiline)t+="m";return t}t.__getRegExpFlags=o;return t}();if(typeof t==="object"&&t.exports){t.exports=r}}).call(this,e("buffer").Buffer)},{buffer:5}],191:[function(e,t,r){var n=e("path");t.exports=function(e,t){if(typeof e!=="string")return e;if(e.length===0)return e;var r=n.basename(e,n.extname(e))+t;return n.join(n.dirname(e),r)}},{path:13}]},{},[1])(1)}); 5 | -------------------------------------------------------------------------------- /layout.css: -------------------------------------------------------------------------------- 1 | .title { 2 | background: #dddddd; 3 | margin: 10px auto 10px auto; 4 | width: 960px; 5 | padding: 2px; 6 | text-align: center; 7 | } 8 | 9 | .explorer { 10 | display: flex; 11 | flex-direction: row; 12 | flex-wrap: wrap; 13 | background: #dddddd; 14 | padding: 10px; 15 | } 16 | 17 | .item { 18 | width: 100px; 19 | height: 130px; 20 | text-align: center; 21 | } 22 | 23 | .item-title { 24 | font-size: 18px; 25 | width: 90px; 26 | word-wrap: break-word; 27 | } 28 | 29 | .item-img { 30 | width: 80px; 31 | height: 80px; 32 | margin-left: auto; 33 | margin-right: auto; 34 | } 35 | 36 | .pathbar { 37 | width: 100%; 38 | height: 30px; 39 | text-align: center; 40 | font-size: 20px; 41 | } 42 | 43 | .selected { 44 | border: 2px solid black; 45 | } 46 | 47 | .infobar { 48 | float: right; 49 | height: 500px; 50 | width: 100px; 51 | border: 5px solid black; 52 | border-right: none; 53 | margin-left: 5px; 54 | } 55 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "ipfs-box", 3 | "version": "0.0.1", 4 | "description": "An ipfs file explorer app", 5 | "main": "index.html", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "author": "", 10 | "license": "MIT", 11 | "dependencies": { 12 | "drag-drop": "^2.2.4", 13 | "ipfs-api": "^2.7.0", 14 | "reactify": "^1.1.1" 15 | } 16 | } 17 | --------------------------------------------------------------------------------