const h = require('hyperscript') module.exports = function (err, data) { if (err) return respond(res, 404, 'ERROR: ' + err) if (data.slice(2, 7).toString() === 'links') { const dir = JSON.parse(data) const entries = Object.keys(dir.links).map(key => { const urlPath = '/web/' + encodeURIComponent(initId) + '/' + restOfPath + key return h('div', [ h('img', { src: '/img/emoji/file_folder.png', style: { width: '15px', height: 'auto' } }), h('a', {href: urlPath}, key) ]) }) var html = h('div', entries) return pull(once(html.outerHTML), toPull(res, onError)) } return pull(once(data), toPull(res)) }