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

Commit

Permalink
feat: Include hash field for exported files (#191)
Browse files Browse the repository at this point in the history
  • Loading branch information
atvanguard authored and daviddias committed Nov 7, 2017
1 parent d88a561 commit 8b13957
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/exporter/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ module.exports = (node, name, pathRest, ipldResolver) => {
return pull.values([{
content: content,
path: name,
hash: node.multihash,
size: file.fileSize()
}])
}
3 changes: 2 additions & 1 deletion test/test-exporter.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ module.exports = (repo) => {
function onFiles (err, files) {
expect(err).to.not.exist()
expect(files).to.have.length(1)
expect(files[0]).to.have.property('hash')
expect(files[0]).to.have.property('path', hash)

fileEql(files[0], unmarsh.data, done)
}
})
Expand Down Expand Up @@ -117,6 +117,7 @@ module.exports = (repo) => {
pull(
exporter(hash, ipldResolver),
pull.collect((err, files) => {
files.forEach(file => expect(file).to.have.property('hash'))
expect(err).to.not.exist()

expect(
Expand Down

0 comments on commit 8b13957

Please sign in to comment.