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

feat: meta for ipfs.get #1235

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
"async": "^3.1.0",
"browser-process-platform": "~0.1.1",
"go-ipfs-dep": "^0.4.23",
"interface-ipfs-core": "^0.131.7",
"interface-ipfs-core": "github:ipfs/interface-js-ipfs-core#test/meta-for-get",
"ipfsd-ctl": "^2.1.0",
"it-all": "^1.0.1",
"it-concat": "^1.0.0",
Expand Down
15 changes: 8 additions & 7 deletions src/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,16 @@ module.exports = configure(({ ky }) => {
const extractor = Tar.extract()

for await (const { header, body } of extractor(toIterable(res.body))) {
const file = {
path: header.name,
mtime: { secs: Math.floor(header.mtime.getTime() / 1000) },
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this support the nsecs mtime component too? At the moment I think it's going to throw away anything that isn't a whole second.

mode: header.mode
}

if (header.type === 'directory') {
yield {
path: header.name
}
yield file
} else {
yield {
path: header.name,
content: body
}
yield { ...file, content: body }
}
}
}
Expand Down
8 changes: 8 additions & 0 deletions test/interface.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ describe('interface-ipfs-core tests', () => {
name: 'should export a chunk of a file',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should get file with mtime',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should get file with mode',
reason: 'TODO not implemented in go-ipfs yet'
},
{
name: 'should ls with metadata',
reason: 'TODO not implemented in go-ipfs yet'
Expand Down