├── package.json ├── README.md ├── index.js └── test.js /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "parse-dat-url", 3 | "version": "3.0.3", 4 | "description": "Node's url.parse() but updated to support versioned dat URLs.", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "repository": { 10 | "type": "git", 11 | "url": "git+https://github.com/pfrazee/parse-dat-url.git" 12 | }, 13 | "keywords": [ 14 | "dat", 15 | "url", 16 | "parse" 17 | ], 18 | "author": "Paul Frazee ", 19 | "license": "MIT", 20 | "bugs": { 21 | "url": "https://github.com/pfrazee/parse-dat-url/issues" 22 | }, 23 | "homepage": "https://github.com/pfrazee/parse-dat-url#readme" 24 | } 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # parse-dat-url 2 | 3 | Node url.parse updated to support versioned dat URLs. 4 | 5 | ```js 6 | var parse = require('parse-dat-url') 7 | 8 | parse('dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1.0.0/path/to/file.txt') 9 | /* => { 10 | protocol: 'dat:', 11 | slashes: true, 12 | auth: null, 13 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 14 | port: null, 15 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 16 | hash: null, 17 | search: null, 18 | query: null, 19 | pathname: '/path/to/file.txt', 20 | path: '/path/to/file.txt', 21 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1.0.0/path/to/file.txt', 22 | version: 'v1.0.0' 23 | }*/ 24 | ``` -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | const isNode = typeof window === 'undefined' 2 | const parse = isNode ? require('url').parse : browserParse 3 | 4 | const SCHEME_REGEX = /[a-z]+:\/\//i 5 | // 1 2 3 4 6 | const VERSION_REGEX = /^(dat:\/\/)?([^/]+)(\+[^/]+)(.*)$/i 7 | 8 | module.exports = function parseDatURL (str, parseQS) { 9 | // prepend the scheme if it's missing 10 | if (!SCHEME_REGEX.test(str)) { 11 | str = 'dat://' + str 12 | } 13 | 14 | var parsed, version = null, match = VERSION_REGEX.exec(str) 15 | if (match) { 16 | // run typical parse with version segment removed 17 | parsed = parse((match[1] || '') + (match[2] || '') + (match[4] || ''), parseQS) 18 | version = match[3].slice(1) 19 | } else { 20 | parsed = parse(str, parseQS) 21 | } 22 | if (isNode) parsed.href = str // overwrite href to include actual original 23 | else parsed.path = parsed.pathname // to match node 24 | if (!parsed.query && parsed.searchParams) { 25 | parsed.query = Object.fromEntries(parsed.searchParams) // to match node 26 | } 27 | parsed.version = version // add version segment 28 | return parsed 29 | } 30 | 31 | function browserParse (str) { 32 | return new URL(str) 33 | } -------------------------------------------------------------------------------- /test.js: -------------------------------------------------------------------------------- 1 | const assert = require('assert') 2 | const parseDatURL = require('./index') 3 | 4 | const INPUTS = ` 5 | dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+0.0.0.1/ 6 | dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+1/ 7 | dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+c1/ 8 | dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1/ 9 | dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1.0.0/ 10 | dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+latest/ 11 | dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+0.0.0.1/path/to+file.txt 12 | dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+1/path/to+file.txt 13 | dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+c1/path/to+file.txt 14 | dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1/path/to+file.txt 15 | dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1.0.0/path/to+file.txt 16 | dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+latest/path/to+file.txt 17 | dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+0.0.0.1 18 | dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+1 19 | dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+c1 20 | dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1 21 | dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1.0.0 22 | dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+latest 23 | dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21/ 24 | dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21/path/to+file.txt 25 | dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21 26 | 584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+0.0.0.1/ 27 | 584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+1/ 28 | 584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+c1/ 29 | 584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1/ 30 | 584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1.0.0/ 31 | 584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+latest/ 32 | 584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+0.0.0.1/path/to+file.txt 33 | 584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+1/path/to+file.txt 34 | 584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+c1/path/to+file.txt 35 | 584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1/path/to+file.txt 36 | 584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1.0.0/path/to+file.txt 37 | 584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+latest/path/to+file.txt 38 | 584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+0.0.0.1 39 | 584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+1 40 | 584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+c1 41 | 584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1 42 | 584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1.0.0 43 | 584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+latest 44 | 584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21/ 45 | 584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21 46 | 584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21/path/to+file.txt 47 | dat://foo.com+0.0.0.1/ 48 | dat://foo.com+1/ 49 | dat://foo.com+c1/ 50 | dat://foo.com+v1/ 51 | dat://foo.com+v1.0.0/ 52 | dat://foo.com+latest/ 53 | dat://foo.com+0.0.0.1/path/to+file.txt 54 | dat://foo.com+1/path/to+file.txt 55 | dat://foo.com+c1/path/to+file.txt 56 | dat://foo.com+v1/path/to+file.txt 57 | dat://foo.com+v1.0.0/path/to+file.txt 58 | dat://foo.com+latest/path/to+file.txt 59 | dat://foo.com+0.0.0.1 60 | dat://foo.com+1 61 | dat://foo.com+c1 62 | dat://foo.com+v1 63 | dat://foo.com+v1.0.0 64 | dat://foo.com+latest 65 | dat://foo.com/ 66 | dat://foo.com 67 | dat://foo.com/path/to+file.txt 68 | foo.com+0.0.0.1/ 69 | foo.com+1/ 70 | foo.com+c1/ 71 | foo.com+v1/ 72 | foo.com+v1.0.0/ 73 | foo.com+latest/ 74 | foo.com+0.0.0.1/path/to+file.txt 75 | foo.com+1/path/to+file.txt 76 | foo.com+c1/path/to+file.txt 77 | foo.com+v1/path/to+file.txt 78 | foo.com+v1.0.0/path/to+file.txt 79 | foo.com+latest/path/to+file.txt 80 | foo.com+0.0.0.1 81 | foo.com+1 82 | foo.com+c1 83 | foo.com+v1 84 | foo.com+v1.0.0 85 | foo.com+latest 86 | foo.com/ 87 | foo.com 88 | foo.com/path/to+file.txt 89 | `.split('\n').filter(Boolean) 90 | 91 | const OUTPUTS = [ { 92 | protocol: 'dat:', 93 | slashes: true, 94 | auth: null, 95 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 96 | port: null, 97 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 98 | hash: null, 99 | search: null, 100 | query: null, 101 | pathname: '/', 102 | path: '/', 103 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+0.0.0.1/', 104 | version: '0.0.0.1' }, 105 | { 106 | protocol: 'dat:', 107 | slashes: true, 108 | auth: null, 109 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 110 | port: null, 111 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 112 | hash: null, 113 | search: '', 114 | query: {}, 115 | pathname: '/', 116 | path: '/', 117 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+1/', 118 | version: '1' }, 119 | { 120 | protocol: 'dat:', 121 | slashes: true, 122 | auth: null, 123 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 124 | port: null, 125 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 126 | hash: null, 127 | search: '', 128 | query: {}, 129 | pathname: '/', 130 | path: '/', 131 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+c1/', 132 | version: 'c1' }, 133 | { 134 | protocol: 'dat:', 135 | slashes: true, 136 | auth: null, 137 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 138 | port: null, 139 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 140 | hash: null, 141 | search: '', 142 | query: {}, 143 | pathname: '/', 144 | path: '/', 145 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1/', 146 | version: 'v1' }, 147 | { 148 | protocol: 'dat:', 149 | slashes: true, 150 | auth: null, 151 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 152 | port: null, 153 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 154 | hash: null, 155 | search: '', 156 | query: {}, 157 | pathname: '/', 158 | path: '/', 159 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1.0.0/', 160 | version: 'v1.0.0' }, 161 | { 162 | protocol: 'dat:', 163 | slashes: true, 164 | auth: null, 165 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 166 | port: null, 167 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 168 | hash: null, 169 | search: '', 170 | query: {}, 171 | pathname: '/', 172 | path: '/', 173 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+latest/', 174 | version: 'latest' }, 175 | { 176 | protocol: 'dat:', 177 | slashes: true, 178 | auth: null, 179 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 180 | port: null, 181 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 182 | hash: null, 183 | search: '', 184 | query: {}, 185 | pathname: '/path/to+file.txt', 186 | path: '/path/to+file.txt', 187 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+0.0.0.1/path/to+file.txt', 188 | version: '0.0.0.1' }, 189 | { 190 | protocol: 'dat:', 191 | slashes: true, 192 | auth: null, 193 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 194 | port: null, 195 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 196 | hash: null, 197 | search: '', 198 | query: {}, 199 | pathname: '/path/to+file.txt', 200 | path: '/path/to+file.txt', 201 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+1/path/to+file.txt', 202 | version: '1' }, 203 | { 204 | protocol: 'dat:', 205 | slashes: true, 206 | auth: null, 207 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 208 | port: null, 209 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 210 | hash: null, 211 | search: '', 212 | query: {}, 213 | pathname: '/path/to+file.txt', 214 | path: '/path/to+file.txt', 215 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+c1/path/to+file.txt', 216 | version: 'c1' }, 217 | { 218 | protocol: 'dat:', 219 | slashes: true, 220 | auth: null, 221 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 222 | port: null, 223 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 224 | hash: null, 225 | search: '', 226 | query: {}, 227 | pathname: '/path/to+file.txt', 228 | path: '/path/to+file.txt', 229 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1/path/to+file.txt', 230 | version: 'v1' }, 231 | { 232 | protocol: 'dat:', 233 | slashes: true, 234 | auth: null, 235 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 236 | port: null, 237 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 238 | hash: null, 239 | search: '', 240 | query: {}, 241 | pathname: '/path/to+file.txt', 242 | path: '/path/to+file.txt', 243 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1.0.0/path/to+file.txt', 244 | version: 'v1.0.0' }, 245 | { 246 | protocol: 'dat:', 247 | slashes: true, 248 | auth: null, 249 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 250 | port: null, 251 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 252 | hash: null, 253 | search: '', 254 | query: {}, 255 | pathname: '/path/to+file.txt', 256 | path: '/path/to+file.txt', 257 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+latest/path/to+file.txt', 258 | version: 'latest' }, 259 | { 260 | protocol: 'dat:', 261 | slashes: true, 262 | auth: null, 263 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 264 | port: null, 265 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 266 | hash: null, 267 | search: '', 268 | query: {}, 269 | pathname: null, 270 | path: null, 271 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+0.0.0.1', 272 | version: '0.0.0.1' }, 273 | { 274 | protocol: 'dat:', 275 | slashes: true, 276 | auth: null, 277 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 278 | port: null, 279 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 280 | hash: null, 281 | search: '', 282 | query: {}, 283 | pathname: null, 284 | path: null, 285 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+1', 286 | version: '1' }, 287 | { 288 | protocol: 'dat:', 289 | slashes: true, 290 | auth: null, 291 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 292 | port: null, 293 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 294 | hash: null, 295 | search: '', 296 | query: {}, 297 | pathname: null, 298 | path: null, 299 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+c1', 300 | version: 'c1' }, 301 | { 302 | protocol: 'dat:', 303 | slashes: true, 304 | auth: null, 305 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 306 | port: null, 307 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 308 | hash: null, 309 | search: '', 310 | query: {}, 311 | pathname: null, 312 | path: null, 313 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1', 314 | version: 'v1' }, 315 | { 316 | protocol: 'dat:', 317 | slashes: true, 318 | auth: null, 319 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 320 | port: null, 321 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 322 | hash: null, 323 | search: '', 324 | query: {}, 325 | pathname: null, 326 | path: null, 327 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1.0.0', 328 | version: 'v1.0.0' }, 329 | { 330 | protocol: 'dat:', 331 | slashes: true, 332 | auth: null, 333 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 334 | port: null, 335 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 336 | hash: null, 337 | search: '', 338 | query: {}, 339 | pathname: null, 340 | path: null, 341 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+latest', 342 | version: 'latest' }, 343 | { 344 | protocol: 'dat:', 345 | slashes: true, 346 | auth: null, 347 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 348 | port: null, 349 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 350 | hash: null, 351 | search: '', 352 | query: {}, 353 | pathname: '/', 354 | path: '/', 355 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21/', 356 | version: null }, 357 | { 358 | protocol: 'dat:', 359 | slashes: true, 360 | auth: null, 361 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 362 | port: null, 363 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 364 | hash: null, 365 | search: '', 366 | query: {}, 367 | pathname: '/path/to+file.txt', 368 | path: '/path/to+file.txt', 369 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21/path/to+file.txt', 370 | version: null }, 371 | { 372 | protocol: 'dat:', 373 | slashes: true, 374 | auth: null, 375 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 376 | port: null, 377 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 378 | hash: null, 379 | search: '', 380 | query: {}, 381 | pathname: null, 382 | path: null, 383 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 384 | version: null }, 385 | { 386 | protocol: 'dat:', 387 | slashes: true, 388 | auth: null, 389 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 390 | port: null, 391 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 392 | hash: null, 393 | search: '', 394 | query: {}, 395 | pathname: '/', 396 | path: '/', 397 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+0.0.0.1/', 398 | version: '0.0.0.1' }, 399 | { 400 | protocol: 'dat:', 401 | slashes: true, 402 | auth: null, 403 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 404 | port: null, 405 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 406 | hash: null, 407 | search: '', 408 | query: {}, 409 | pathname: '/', 410 | path: '/', 411 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+1/', 412 | version: '1' }, 413 | { 414 | protocol: 'dat:', 415 | slashes: true, 416 | auth: null, 417 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 418 | port: null, 419 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 420 | hash: null, 421 | search: '', 422 | query: {}, 423 | pathname: '/', 424 | path: '/', 425 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+c1/', 426 | version: 'c1' }, 427 | { 428 | protocol: 'dat:', 429 | slashes: true, 430 | auth: null, 431 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 432 | port: null, 433 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 434 | hash: null, 435 | search: '', 436 | query: {}, 437 | pathname: '/', 438 | path: '/', 439 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1/', 440 | version: 'v1' }, 441 | { 442 | protocol: 'dat:', 443 | slashes: true, 444 | auth: null, 445 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 446 | port: null, 447 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 448 | hash: null, 449 | search: '', 450 | query: {}, 451 | pathname: '/', 452 | path: '/', 453 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1.0.0/', 454 | version: 'v1.0.0' }, 455 | { 456 | protocol: 'dat:', 457 | slashes: true, 458 | auth: null, 459 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 460 | port: null, 461 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 462 | hash: null, 463 | search: '', 464 | query: {}, 465 | pathname: '/', 466 | path: '/', 467 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+latest/', 468 | version: 'latest' }, 469 | { 470 | protocol: 'dat:', 471 | slashes: true, 472 | auth: null, 473 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 474 | port: null, 475 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 476 | hash: null, 477 | search: '', 478 | query: {}, 479 | pathname: '/path/to+file.txt', 480 | path: '/path/to+file.txt', 481 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+0.0.0.1/path/to+file.txt', 482 | version: '0.0.0.1' }, 483 | { 484 | protocol: 'dat:', 485 | slashes: true, 486 | auth: null, 487 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 488 | port: null, 489 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 490 | hash: null, 491 | search: '', 492 | query: {}, 493 | pathname: '/path/to+file.txt', 494 | path: '/path/to+file.txt', 495 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+1/path/to+file.txt', 496 | version: '1' }, 497 | { 498 | protocol: 'dat:', 499 | slashes: true, 500 | auth: null, 501 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 502 | port: null, 503 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 504 | hash: null, 505 | search: '', 506 | query: {}, 507 | pathname: '/path/to+file.txt', 508 | path: '/path/to+file.txt', 509 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+c1/path/to+file.txt', 510 | version: 'c1' }, 511 | { 512 | protocol: 'dat:', 513 | slashes: true, 514 | auth: null, 515 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 516 | port: null, 517 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 518 | hash: null, 519 | search: '', 520 | query: {}, 521 | pathname: '/path/to+file.txt', 522 | path: '/path/to+file.txt', 523 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1/path/to+file.txt', 524 | version: 'v1' }, 525 | { 526 | protocol: 'dat:', 527 | slashes: true, 528 | auth: null, 529 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 530 | port: null, 531 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 532 | hash: null, 533 | search: '', 534 | query: {}, 535 | pathname: '/path/to+file.txt', 536 | path: '/path/to+file.txt', 537 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1.0.0/path/to+file.txt', 538 | version: 'v1.0.0' }, 539 | { 540 | protocol: 'dat:', 541 | slashes: true, 542 | auth: null, 543 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 544 | port: null, 545 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 546 | hash: null, 547 | search: '', 548 | query: {}, 549 | pathname: '/path/to+file.txt', 550 | path: '/path/to+file.txt', 551 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+latest/path/to+file.txt', 552 | version: 'latest' }, 553 | { 554 | protocol: 'dat:', 555 | slashes: true, 556 | auth: null, 557 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 558 | port: null, 559 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 560 | hash: null, 561 | search: '', 562 | query: {}, 563 | pathname: null, 564 | path: null, 565 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+0.0.0.1', 566 | version: '0.0.0.1' }, 567 | { 568 | protocol: 'dat:', 569 | slashes: true, 570 | auth: null, 571 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 572 | port: null, 573 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 574 | hash: null, 575 | search: '', 576 | query: {}, 577 | pathname: null, 578 | path: null, 579 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+1', 580 | version: '1' }, 581 | { 582 | protocol: 'dat:', 583 | slashes: true, 584 | auth: null, 585 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 586 | port: null, 587 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 588 | hash: null, 589 | search: '', 590 | query: {}, 591 | pathname: null, 592 | path: null, 593 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+c1', 594 | version: 'c1' }, 595 | { 596 | protocol: 'dat:', 597 | slashes: true, 598 | auth: null, 599 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 600 | port: null, 601 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 602 | hash: null, 603 | search: '', 604 | query: {}, 605 | pathname: null, 606 | path: null, 607 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1', 608 | version: 'v1' }, 609 | { 610 | protocol: 'dat:', 611 | slashes: true, 612 | auth: null, 613 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 614 | port: null, 615 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 616 | hash: null, 617 | search: '', 618 | query: {}, 619 | pathname: null, 620 | path: null, 621 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+v1.0.0', 622 | version: 'v1.0.0' }, 623 | { 624 | protocol: 'dat:', 625 | slashes: true, 626 | auth: null, 627 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 628 | port: null, 629 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 630 | hash: null, 631 | search: '', 632 | query: {}, 633 | pathname: null, 634 | path: null, 635 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21+latest', 636 | version: 'latest' }, 637 | { 638 | protocol: 'dat:', 639 | slashes: true, 640 | auth: null, 641 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 642 | port: null, 643 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 644 | hash: null, 645 | search: '', 646 | query: {}, 647 | pathname: '/', 648 | path: '/', 649 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21/', 650 | version: null }, 651 | { 652 | protocol: 'dat:', 653 | slashes: true, 654 | auth: null, 655 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 656 | port: null, 657 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 658 | hash: null, 659 | search: '', 660 | query: {}, 661 | pathname: null, 662 | path: null, 663 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 664 | version: null }, 665 | { 666 | protocol: 'dat:', 667 | slashes: true, 668 | auth: null, 669 | host: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 670 | port: null, 671 | hostname: '584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21', 672 | hash: null, 673 | search: '', 674 | query: {}, 675 | pathname: '/path/to+file.txt', 676 | path: '/path/to+file.txt', 677 | href: 'dat://584faa05d394190ab1a3f0240607f9bf2b7e2bd9968830a11cf77db0cea36a21/path/to+file.txt', 678 | version: null }, 679 | { 680 | protocol: 'dat:', 681 | slashes: true, 682 | auth: null, 683 | host: 'foo.com', 684 | port: null, 685 | hostname: 'foo.com', 686 | hash: null, 687 | search: '', 688 | query: {}, 689 | pathname: '/', 690 | path: '/', 691 | href: 'dat://foo.com+0.0.0.1/', 692 | version: '0.0.0.1' }, 693 | { 694 | protocol: 'dat:', 695 | slashes: true, 696 | auth: null, 697 | host: 'foo.com', 698 | port: null, 699 | hostname: 'foo.com', 700 | hash: null, 701 | search: '', 702 | query: {}, 703 | pathname: '/', 704 | path: '/', 705 | href: 'dat://foo.com+1/', 706 | version: '1' }, 707 | { 708 | protocol: 'dat:', 709 | slashes: true, 710 | auth: null, 711 | host: 'foo.com', 712 | port: null, 713 | hostname: 'foo.com', 714 | hash: null, 715 | search: '', 716 | query: {}, 717 | pathname: '/', 718 | path: '/', 719 | href: 'dat://foo.com+c1/', 720 | version: 'c1' }, 721 | { 722 | protocol: 'dat:', 723 | slashes: true, 724 | auth: null, 725 | host: 'foo.com', 726 | port: null, 727 | hostname: 'foo.com', 728 | hash: null, 729 | search: '', 730 | query: {}, 731 | pathname: '/', 732 | path: '/', 733 | href: 'dat://foo.com+v1/', 734 | version: 'v1' }, 735 | { 736 | protocol: 'dat:', 737 | slashes: true, 738 | auth: null, 739 | host: 'foo.com', 740 | port: null, 741 | hostname: 'foo.com', 742 | hash: null, 743 | search: '', 744 | query: {}, 745 | pathname: '/', 746 | path: '/', 747 | href: 'dat://foo.com+v1.0.0/', 748 | version: 'v1.0.0' }, 749 | { 750 | protocol: 'dat:', 751 | slashes: true, 752 | auth: null, 753 | host: 'foo.com', 754 | port: null, 755 | hostname: 'foo.com', 756 | hash: null, 757 | search: '', 758 | query: {}, 759 | pathname: '/', 760 | path: '/', 761 | href: 'dat://foo.com+latest/', 762 | version: 'latest' }, 763 | { 764 | protocol: 'dat:', 765 | slashes: true, 766 | auth: null, 767 | host: 'foo.com', 768 | port: null, 769 | hostname: 'foo.com', 770 | hash: null, 771 | search: '', 772 | query: {}, 773 | pathname: '/path/to+file.txt', 774 | path: '/path/to+file.txt', 775 | href: 'dat://foo.com+0.0.0.1/path/to+file.txt', 776 | version: '0.0.0.1' }, 777 | { 778 | protocol: 'dat:', 779 | slashes: true, 780 | auth: null, 781 | host: 'foo.com', 782 | port: null, 783 | hostname: 'foo.com', 784 | hash: null, 785 | search: '', 786 | query: {}, 787 | pathname: '/path/to+file.txt', 788 | path: '/path/to+file.txt', 789 | href: 'dat://foo.com+1/path/to+file.txt', 790 | version: '1' }, 791 | { 792 | protocol: 'dat:', 793 | slashes: true, 794 | auth: null, 795 | host: 'foo.com', 796 | port: null, 797 | hostname: 'foo.com', 798 | hash: null, 799 | search: '', 800 | query: {}, 801 | pathname: '/path/to+file.txt', 802 | path: '/path/to+file.txt', 803 | href: 'dat://foo.com+c1/path/to+file.txt', 804 | version: 'c1' }, 805 | { 806 | protocol: 'dat:', 807 | slashes: true, 808 | auth: null, 809 | host: 'foo.com', 810 | port: null, 811 | hostname: 'foo.com', 812 | hash: null, 813 | search: '', 814 | query: {}, 815 | pathname: '/path/to+file.txt', 816 | path: '/path/to+file.txt', 817 | href: 'dat://foo.com+v1/path/to+file.txt', 818 | version: 'v1' }, 819 | { 820 | protocol: 'dat:', 821 | slashes: true, 822 | auth: null, 823 | host: 'foo.com', 824 | port: null, 825 | hostname: 'foo.com', 826 | hash: null, 827 | search: '', 828 | query: {}, 829 | pathname: '/path/to+file.txt', 830 | path: '/path/to+file.txt', 831 | href: 'dat://foo.com+v1.0.0/path/to+file.txt', 832 | version: 'v1.0.0' }, 833 | { 834 | protocol: 'dat:', 835 | slashes: true, 836 | auth: null, 837 | host: 'foo.com', 838 | port: null, 839 | hostname: 'foo.com', 840 | hash: null, 841 | search: '', 842 | query: {}, 843 | pathname: '/path/to+file.txt', 844 | path: '/path/to+file.txt', 845 | href: 'dat://foo.com+latest/path/to+file.txt', 846 | version: 'latest' }, 847 | { 848 | protocol: 'dat:', 849 | slashes: true, 850 | auth: null, 851 | host: 'foo.com', 852 | port: null, 853 | hostname: 'foo.com', 854 | hash: null, 855 | search: '', 856 | query: {}, 857 | pathname: null, 858 | path: null, 859 | href: 'dat://foo.com+0.0.0.1', 860 | version: '0.0.0.1' }, 861 | { 862 | protocol: 'dat:', 863 | slashes: true, 864 | auth: null, 865 | host: 'foo.com', 866 | port: null, 867 | hostname: 'foo.com', 868 | hash: null, 869 | search: '', 870 | query: {}, 871 | pathname: null, 872 | path: null, 873 | href: 'dat://foo.com+1', 874 | version: '1' }, 875 | { 876 | protocol: 'dat:', 877 | slashes: true, 878 | auth: null, 879 | host: 'foo.com', 880 | port: null, 881 | hostname: 'foo.com', 882 | hash: null, 883 | search: '', 884 | query: {}, 885 | pathname: null, 886 | path: null, 887 | href: 'dat://foo.com+c1', 888 | version: 'c1' }, 889 | { 890 | protocol: 'dat:', 891 | slashes: true, 892 | auth: null, 893 | host: 'foo.com', 894 | port: null, 895 | hostname: 'foo.com', 896 | hash: null, 897 | search: '', 898 | query: {}, 899 | pathname: null, 900 | path: null, 901 | href: 'dat://foo.com+v1', 902 | version: 'v1' }, 903 | { 904 | protocol: 'dat:', 905 | slashes: true, 906 | auth: null, 907 | host: 'foo.com', 908 | port: null, 909 | hostname: 'foo.com', 910 | hash: null, 911 | search: '', 912 | query: {}, 913 | pathname: null, 914 | path: null, 915 | href: 'dat://foo.com+v1.0.0', 916 | version: 'v1.0.0' }, 917 | { 918 | protocol: 'dat:', 919 | slashes: true, 920 | auth: null, 921 | host: 'foo.com', 922 | port: null, 923 | hostname: 'foo.com', 924 | hash: null, 925 | search: '', 926 | query: {}, 927 | pathname: null, 928 | path: null, 929 | href: 'dat://foo.com+latest', 930 | version: 'latest' }, 931 | { 932 | protocol: 'dat:', 933 | slashes: true, 934 | auth: null, 935 | host: 'foo.com', 936 | port: null, 937 | hostname: 'foo.com', 938 | hash: null, 939 | search: '', 940 | query: {}, 941 | pathname: '/', 942 | path: '/', 943 | href: 'dat://foo.com/', 944 | version: null }, 945 | { 946 | protocol: 'dat:', 947 | slashes: true, 948 | auth: null, 949 | host: 'foo.com', 950 | port: null, 951 | hostname: 'foo.com', 952 | hash: null, 953 | search: '', 954 | query: {}, 955 | pathname: null, 956 | path: null, 957 | href: 'dat://foo.com', 958 | version: null }, 959 | { 960 | protocol: 'dat:', 961 | slashes: true, 962 | auth: null, 963 | host: 'foo.com', 964 | port: null, 965 | hostname: 'foo.com', 966 | hash: null, 967 | search: '', 968 | query: {}, 969 | pathname: '/path/to+file.txt', 970 | path: '/path/to+file.txt', 971 | href: 'dat://foo.com/path/to+file.txt', 972 | version: null }, 973 | { 974 | protocol: 'dat:', 975 | slashes: true, 976 | auth: null, 977 | host: 'foo.com', 978 | port: null, 979 | hostname: 'foo.com', 980 | hash: null, 981 | search: '', 982 | query: {}, 983 | pathname: '/', 984 | path: '/', 985 | href: 'dat://foo.com+0.0.0.1/', 986 | version: '0.0.0.1' }, 987 | { 988 | protocol: 'dat:', 989 | slashes: true, 990 | auth: null, 991 | host: 'foo.com', 992 | port: null, 993 | hostname: 'foo.com', 994 | hash: null, 995 | search: '', 996 | query: {}, 997 | pathname: '/', 998 | path: '/', 999 | href: 'dat://foo.com+1/', 1000 | version: '1' }, 1001 | { 1002 | protocol: 'dat:', 1003 | slashes: true, 1004 | auth: null, 1005 | host: 'foo.com', 1006 | port: null, 1007 | hostname: 'foo.com', 1008 | hash: null, 1009 | search: '', 1010 | query: {}, 1011 | pathname: '/', 1012 | path: '/', 1013 | href: 'dat://foo.com+c1/', 1014 | version: 'c1' }, 1015 | { 1016 | protocol: 'dat:', 1017 | slashes: true, 1018 | auth: null, 1019 | host: 'foo.com', 1020 | port: null, 1021 | hostname: 'foo.com', 1022 | hash: null, 1023 | search: '', 1024 | query: {}, 1025 | pathname: '/', 1026 | path: '/', 1027 | href: 'dat://foo.com+v1/', 1028 | version: 'v1' }, 1029 | { 1030 | protocol: 'dat:', 1031 | slashes: true, 1032 | auth: null, 1033 | host: 'foo.com', 1034 | port: null, 1035 | hostname: 'foo.com', 1036 | hash: null, 1037 | search: '', 1038 | query: {}, 1039 | pathname: '/', 1040 | path: '/', 1041 | href: 'dat://foo.com+v1.0.0/', 1042 | version: 'v1.0.0' }, 1043 | { 1044 | protocol: 'dat:', 1045 | slashes: true, 1046 | auth: null, 1047 | host: 'foo.com', 1048 | port: null, 1049 | hostname: 'foo.com', 1050 | hash: null, 1051 | search: '', 1052 | query: {}, 1053 | pathname: '/', 1054 | path: '/', 1055 | href: 'dat://foo.com+latest/', 1056 | version: 'latest' }, 1057 | { 1058 | protocol: 'dat:', 1059 | slashes: true, 1060 | auth: null, 1061 | host: 'foo.com', 1062 | port: null, 1063 | hostname: 'foo.com', 1064 | hash: null, 1065 | search: '', 1066 | query: {}, 1067 | pathname: '/path/to+file.txt', 1068 | path: '/path/to+file.txt', 1069 | href: 'dat://foo.com+0.0.0.1/path/to+file.txt', 1070 | version: '0.0.0.1' }, 1071 | { 1072 | protocol: 'dat:', 1073 | slashes: true, 1074 | auth: null, 1075 | host: 'foo.com', 1076 | port: null, 1077 | hostname: 'foo.com', 1078 | hash: null, 1079 | search: '', 1080 | query: {}, 1081 | pathname: '/path/to+file.txt', 1082 | path: '/path/to+file.txt', 1083 | href: 'dat://foo.com+1/path/to+file.txt', 1084 | version: '1' }, 1085 | { 1086 | protocol: 'dat:', 1087 | slashes: true, 1088 | auth: null, 1089 | host: 'foo.com', 1090 | port: null, 1091 | hostname: 'foo.com', 1092 | hash: null, 1093 | search: '', 1094 | query: {}, 1095 | pathname: '/path/to+file.txt', 1096 | path: '/path/to+file.txt', 1097 | href: 'dat://foo.com+c1/path/to+file.txt', 1098 | version: 'c1' }, 1099 | { 1100 | protocol: 'dat:', 1101 | slashes: true, 1102 | auth: null, 1103 | host: 'foo.com', 1104 | port: null, 1105 | hostname: 'foo.com', 1106 | hash: null, 1107 | search: '', 1108 | query: {}, 1109 | pathname: '/path/to+file.txt', 1110 | path: '/path/to+file.txt', 1111 | href: 'dat://foo.com+v1/path/to+file.txt', 1112 | version: 'v1' }, 1113 | { 1114 | protocol: 'dat:', 1115 | slashes: true, 1116 | auth: null, 1117 | host: 'foo.com', 1118 | port: null, 1119 | hostname: 'foo.com', 1120 | hash: null, 1121 | search: '', 1122 | query: {}, 1123 | pathname: '/path/to+file.txt', 1124 | path: '/path/to+file.txt', 1125 | href: 'dat://foo.com+v1.0.0/path/to+file.txt', 1126 | version: 'v1.0.0' }, 1127 | { 1128 | protocol: 'dat:', 1129 | slashes: true, 1130 | auth: null, 1131 | host: 'foo.com', 1132 | port: null, 1133 | hostname: 'foo.com', 1134 | hash: null, 1135 | search: '', 1136 | query: {}, 1137 | pathname: '/path/to+file.txt', 1138 | path: '/path/to+file.txt', 1139 | href: 'dat://foo.com+latest/path/to+file.txt', 1140 | version: 'latest' }, 1141 | { 1142 | protocol: 'dat:', 1143 | slashes: true, 1144 | auth: null, 1145 | host: 'foo.com', 1146 | port: null, 1147 | hostname: 'foo.com', 1148 | hash: null, 1149 | search: '', 1150 | query: {}, 1151 | pathname: null, 1152 | path: null, 1153 | href: 'dat://foo.com+0.0.0.1', 1154 | version: '0.0.0.1' }, 1155 | { 1156 | protocol: 'dat:', 1157 | slashes: true, 1158 | auth: null, 1159 | host: 'foo.com', 1160 | port: null, 1161 | hostname: 'foo.com', 1162 | hash: null, 1163 | search: '', 1164 | query: {}, 1165 | pathname: null, 1166 | path: null, 1167 | href: 'dat://foo.com+1', 1168 | version: '1' }, 1169 | { 1170 | protocol: 'dat:', 1171 | slashes: true, 1172 | auth: null, 1173 | host: 'foo.com', 1174 | port: null, 1175 | hostname: 'foo.com', 1176 | hash: null, 1177 | search: '', 1178 | query: {}, 1179 | pathname: null, 1180 | path: null, 1181 | href: 'dat://foo.com+c1', 1182 | version: 'c1' }, 1183 | { 1184 | protocol: 'dat:', 1185 | slashes: true, 1186 | auth: null, 1187 | host: 'foo.com', 1188 | port: null, 1189 | hostname: 'foo.com', 1190 | hash: null, 1191 | search: '', 1192 | query: {}, 1193 | pathname: null, 1194 | path: null, 1195 | href: 'dat://foo.com+v1', 1196 | version: 'v1' }, 1197 | { 1198 | protocol: 'dat:', 1199 | slashes: true, 1200 | auth: null, 1201 | host: 'foo.com', 1202 | port: null, 1203 | hostname: 'foo.com', 1204 | hash: null, 1205 | search: '', 1206 | query: {}, 1207 | pathname: null, 1208 | path: null, 1209 | href: 'dat://foo.com+v1.0.0', 1210 | version: 'v1.0.0' }, 1211 | { 1212 | protocol: 'dat:', 1213 | slashes: true, 1214 | auth: null, 1215 | host: 'foo.com', 1216 | port: null, 1217 | hostname: 'foo.com', 1218 | hash: null, 1219 | search: '', 1220 | query: {}, 1221 | pathname: null, 1222 | path: null, 1223 | href: 'dat://foo.com+latest', 1224 | version: 'latest' }, 1225 | { 1226 | protocol: 'dat:', 1227 | slashes: true, 1228 | auth: null, 1229 | host: 'foo.com', 1230 | port: null, 1231 | hostname: 'foo.com', 1232 | hash: null, 1233 | search: '', 1234 | query: {}, 1235 | pathname: '/', 1236 | path: '/', 1237 | href: 'dat://foo.com/', 1238 | version: null }, 1239 | { 1240 | protocol: 'dat:', 1241 | slashes: true, 1242 | auth: null, 1243 | host: 'foo.com', 1244 | port: null, 1245 | hostname: 'foo.com', 1246 | hash: null, 1247 | search: '', 1248 | query: {}, 1249 | pathname: null, 1250 | path: null, 1251 | href: 'dat://foo.com', 1252 | version: null }, 1253 | { 1254 | protocol: 'dat:', 1255 | slashes: true, 1256 | auth: null, 1257 | host: 'foo.com', 1258 | port: null, 1259 | hostname: 'foo.com', 1260 | hash: null, 1261 | search: '', 1262 | query: {}, 1263 | pathname: '/path/to+file.txt', 1264 | path: '/path/to+file.txt', 1265 | href: 'dat://foo.com/path/to+file.txt', 1266 | version: null } ] 1267 | 1268 | var testOut = INPUTS.map(parseDatURL) 1269 | for (var i =0; i < testOut.length; i++) { 1270 | try { 1271 | assert.deepEqual(testOut[i], OUTPUTS[i]) 1272 | } catch (e) { 1273 | console.log(i, 'failed') 1274 | console.log(e) 1275 | } 1276 | } 1277 | --------------------------------------------------------------------------------