Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
feat: migrate init to IPLD resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
daviddias committed Oct 29, 2016
1 parent 0fb1a1a commit 61d1084
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions src/core/components/init.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
'use strict'

const peerId = require('peer-id')
const BlockService = require('ipfs-block-service')
const DagService = require('ipfs-merkle-dag').DAGService
const path = require('path')
const glob = require('glob')
const fs = require('fs')
Expand Down Expand Up @@ -90,9 +88,6 @@ module.exports = function init (self) {
return callback(null, true)
}

const blocks = new BlockService(self._repo)
const dag = new DagService(blocks)

const initDocsPath = path.join(__dirname, '../../init-files/init-docs')
const index = __dirname.lastIndexOf('/')

Expand All @@ -112,7 +107,7 @@ module.exports = function init (self) {
}
}),
pull.filter(Boolean),
importer(dag),
importer(self._ipldResolver),
pull.through((el) => {
if (el.path === 'files/init-docs/docs') {
const hash = mh.toB58String(el.multihash)
Expand All @@ -123,7 +118,9 @@ module.exports = function init (self) {
}
}),
pull.onEnd((err) => {
if (err) return callback(err)
if (err) {
return callback(err)
}

callback(null, true)
})
Expand Down

0 comments on commit 61d1084

Please sign in to comment.