diff --git a/package.json b/package.json index 6ba92841e..3d0e8bacb 100644 --- a/package.json +++ b/package.json @@ -84,7 +84,7 @@ "cross-env": "^6.0.0", "detect-node": "^2.0.4", "go-ipfs-dep": "^0.4.22", - "interface-ipfs-core": "^0.127.0", + "interface-ipfs-core": "^0.128.0", "ipfsd-ctl": "^1.0.0", "ndjson": "^1.5.0", "nock": "^11.4.0", diff --git a/src/add/index.js b/src/add/index.js index 546e5428d..e8b3c22f0 100644 --- a/src/add/index.js +++ b/src/add/index.js @@ -42,7 +42,7 @@ module.exports = configure(({ ky }) => { for await (let file of ndjson(toIterable(res.body))) { file = toCamel(file) - // console.log(file) + if (options.progress && file.bytes) { options.progress(file.bytes) } else { @@ -52,16 +52,23 @@ module.exports = configure(({ ky }) => { } }) -function toCoreInterface ({ name, hash, size, mode, mtime }) { +function toCoreInterface ({ name, hash, size, mode, mtime, mtimeNsecs }) { const output = { path: name, hash, size: parseInt(size) } - if (mode !== undefined) { + if (mode != null) { output.mode = parseInt(mode, 8) } + if (mtime != null) { + output.mtime = { + secs: mtime, + nsecs: mtimeNsecs || 0 + } + } + return output } diff --git a/src/files/cp.js b/src/files/cp.js index f9ed0bb20..ce68aa588 100644 --- a/src/files/cp.js +++ b/src/files/cp.js @@ -13,6 +13,7 @@ module.exports = configure(({ ky }) => { if (options.flush != null) searchParams.set('flush', options.flush) if (options.hashAlg) searchParams.set('hash', options.hashAlg) if (options.parents != null) searchParams.set('parents', options.parents) + if (options.shardSplitThreshold != null) searchParams.set('shardSplitThreshold', options.shardSplitThreshold) return ky.post('files/cp', { timeout: options.timeout, diff --git a/src/files/mkdir.js b/src/files/mkdir.js index 382c62b22..7083d4b40 100644 --- a/src/files/mkdir.js +++ b/src/files/mkdir.js @@ -15,6 +15,7 @@ module.exports = configure(({ ky }) => { if (options.flush != null) searchParams.set('flush', options.flush) if (options.hashAlg) searchParams.set('hash', options.hashAlg) if (options.parents != null) searchParams.set('parents', options.parents) + if (options.shardSplitThreshold != null) searchParams.set('shardSplitThreshold', options.shardSplitThreshold) if (mtime) { searchParams.set('mtime', mtime.secs) diff --git a/src/files/mv.js b/src/files/mv.js index 78560dfeb..5b0efbc89 100644 --- a/src/files/mv.js +++ b/src/files/mv.js @@ -13,6 +13,7 @@ module.exports = configure(({ ky }) => { if (options.flush != null) searchParams.set('flush', options.flush) if (options.hashAlg) searchParams.set('hash', options.hashAlg) if (options.parents != null) searchParams.set('parents', options.parents) + if (options.shardSplitThreshold != null) searchParams.set('shardSplitThreshold', options.shardSplitThreshold) return ky.post('files/mv', { timeout: options.timeout, diff --git a/src/files/rm.js b/src/files/rm.js index c0a5e7eab..ebfbd4061 100644 --- a/src/files/rm.js +++ b/src/files/rm.js @@ -10,6 +10,7 @@ module.exports = configure(({ ky }) => { searchParams.append('arg', path) if (options.recursive != null) searchParams.set('recursive', options.recursive) if (options.force != null) searchParams.set('force', options.force) + if (options.shardSplitThreshold != null) searchParams.set('shardSplitThreshold', options.shardSplitThreshold) return ky.post('files/rm', { timeout: options.timeout, diff --git a/src/files/write.js b/src/files/write.js index e31f0a8a2..a91c920a7 100644 --- a/src/files/write.js +++ b/src/files/write.js @@ -21,6 +21,7 @@ module.exports = configure(({ ky }) => { if (options.parents != null) searchParams.set('parents', options.parents) if (options.rawLeaves != null) searchParams.set('raw-leaves', options.rawLeaves) if (options.truncate != null) searchParams.set('truncate', options.truncate) + if (options.shardSplitThreshold != null) searchParams.set('shardSplitThreshold', options.shardSplitThreshold) if (mtime) { searchParams.set('mtime', mtime.secs) diff --git a/test/interface.spec.js b/test/interface.spec.js index e09cac5a6..796c1ae86 100644 --- a/test/interface.spec.js +++ b/test/interface.spec.js @@ -242,6 +242,30 @@ describe('interface-ipfs-core tests', () => { { name: 'should write file and specify mtime as hrtime', reason: 'TODO not implemented in go-ipfs yet' + }, + { + name: 'should stat file with mode', + reason: 'TODO not implemented in go-ipfs yet' + }, + { + name: 'should stat file with mtime', + reason: 'TODO not implemented in go-ipfs yet' + }, + { + name: 'should stat dir with mode', + reason: 'TODO not implemented in go-ipfs yet' + }, + { + name: 'should stat dir with mtime', + reason: 'TODO not implemented in go-ipfs yet' + }, + { + name: 'should stat sharded dir with mode', + reason: 'TODO not implemented in go-ipfs yet' + }, + { + name: 'should stat sharded dir with mtime', + reason: 'TODO not implemented in go-ipfs yet' } ] })