Socket
Socket
Sign inDemoInstall

hyperdrive-ui

Package Overview
Dependencies
74
Maintainers
5
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.2.3 to 2.0.0

.githooks/pre-commit/standard

55

index.js
var path = require('path')
var yo = require('yo-yo')
var data = require('render-data')
var yofs = require('yo-fs')

@@ -11,48 +10,24 @@

var root = opts.root || '/'
var dirs = {}
var entries = []
var dirs = {}
var fs = yofs(null, root, entries, clickEntry)
var display_id = 'display'
var display = yo`<div id="${display_id}"></div>`
var widget = yo`<div id="hyperdrive-ui">
${fs}
${display}
</div>`
function page (newRoot) {
root = newRoot
yofs(fs, newRoot, entries, clickEntry)
}
function breadcrumbs (root) {
var parts = root.split('/')
while (parts[parts.length - 1] === '') { parts.pop() }
function back () { page(path.dirname(root)) }
var crumbs
if (parts.length) crumbs = yo`<button class="link" onclick=${back}>back</button>`
return yo`<div id="breadcrumbs" class="breadcrumbs"> ${crumbs} </div>`
}
function clickEntry (ev, entry) {
root = entry.name
function clicky (ev, entry) {
if (entry.type === 'directory') {
document.getElementById(display_id).innerHTML = ''
root = entry.name
}
if (entry.type === 'file') {
data.render({
name: entry.name,
createReadStream: function () {
return archive.createFileReadStream(entry)
}
}, display, function (err) {
console.log('hello', err)
})
}
onclick(ev, entry)
}
var tree = yofs(root, entries, clicky)
function update () {
var fresh = tree.render(root, entries, clicky)
yo.update(tree.widget, fresh)
}
var stream = archive.list({live: true})
stream.on('data', function (entry) {
entry.createReadStream = function () {
return archive.createFileReadStream(entry)
}
entries.push(entry)

@@ -68,5 +43,5 @@ var dir = path.dirname(entry.name)

}
yofs(fs, root, entries, clickEntry)
update()
})
return widget
return tree.widget
}
{
"name": "hyperdrive-ui",
"version": "1.2.3",
"version": "2.0.0",
"description": "Render a hyperdrive in the browser.",
"main": "index.js",
"scripts": {
"build": "browserify app.js > bundle.js",
"watch": "watchify app.js -o bundle.js",
"start": "npm run watch & http-server .",
"deploy": "gh-pages-deploy"
"test": "standard",
"lint": "standard"
},
"author": "Karissa McKelvey <karissa@karissamck.com> (http://karissamck.com/)",
"license": "MIT",
"devDependencies": {
"brfs": "^1.4.3",
"browserify": "^12.0.0",
"choppa": "^1.0.2",
"drag-drop": "^2.11.0",
"filereader-stream": "^1.0.0",
"gh-pages-deploy": "^0.4.2",
"http-server": "^0.9.0",
"hyperdrive": "^6.2.1",
"level-browserify": "^1.1.0",
"memdb": "^1.3.1",
"standard": "^3.0.0",
"watchify": "~3.6.0",
"wzrd": "^1.3.1"
},
"dependencies": {
"concat-stream": "^1.5.1",
"hyperdrive-archive-swarm": "^1.0.1",
"render-data": "^1.0.0",
"signalhub": "^4.4.0",
"webrtc-swarm": "^2.4.0",
"yo-fs": "^1.0.3",
"yo-fs": "^2.0.0",
"yo-yo": "^1.2.1"
},
"gh-pages-deploy": {
"prep": [
"build"
],
"noprompt": false
},
"repository": {

@@ -45,0 +17,0 @@ "type": "git",

@@ -7,3 +7,3 @@ # hyperdrive-ui

Live demo: [http://karissa.github.io/hyperdrive-ui/](http://karissa.github.io/hyperdrive-ui/)
Live demo: [http://dat.land/](http://dat.land/)

@@ -15,8 +15,16 @@

## `hyperdriveUI(element, archive, opts, onclick)`
## `hyperdriveUI(archive, opts, onclick)`
Renders the explorer.
See `app.js` for an example.
```js
var explorer = require('hyperdrive-ui')
function onclick (ev, entry) {
console.log('clicked', entry.name, entry.type)
}
var tree = explorer(archive, onclick)
document.querySelector('#hyperdrive').appendChild(tree)
```
## get started

@@ -23,0 +31,0 @@

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc