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

Include hash field for exported files #191

Merged
merged 1 commit into from
Nov 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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