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

Commit 8b13957

Browse files
Arpit Agarwaldaviddias
Arpit Agarwal
authored andcommitted
feat: Include hash field for exported files (#191)
1 parent d88a561 commit 8b13957

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/exporter/file.js

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ module.exports = (node, name, pathRest, ipldResolver) => {
4040
return pull.values([{
4141
content: content,
4242
path: name,
43+
hash: node.multihash,
4344
size: file.fileSize()
4445
}])
4546
}

test/test-exporter.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ module.exports = (repo) => {
4545
function onFiles (err, files) {
4646
expect(err).to.not.exist()
4747
expect(files).to.have.length(1)
48+
expect(files[0]).to.have.property('hash')
4849
expect(files[0]).to.have.property('path', hash)
49-
5050
fileEql(files[0], unmarsh.data, done)
5151
}
5252
})
@@ -117,6 +117,7 @@ module.exports = (repo) => {
117117
pull(
118118
exporter(hash, ipldResolver),
119119
pull.collect((err, files) => {
120+
files.forEach(file => expect(file).to.have.property('hash'))
120121
expect(err).to.not.exist()
121122

122123
expect(

0 commit comments

Comments
 (0)