diff --git a/package.json b/package.json index 07ad807db..bd69817f5 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/get.js b/src/get.js index 635f8b34f..d2d990f09 100644 --- a/src/get.js +++ b/src/get.js @@ -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) }, + mode: header.mode + } + if (header.type === 'directory') { - yield { - path: header.name - } + yield file } else { - yield { - path: header.name, - content: body - } + yield { ...file, content: body } } } } diff --git a/test/interface.spec.js b/test/interface.spec.js index ebec1b0e9..2f0021ba7 100644 --- a/test/interface.spec.js +++ b/test/interface.spec.js @@ -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'