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

Commit de72184

Browse files
committed
Revert "feat: complete files.stat with the 'with-local' option (#227)"
This reverts commit 5969fed.
1 parent ec16016 commit de72184

File tree

3 files changed

+3
-89
lines changed

3 files changed

+3
-89
lines changed

SPEC/FILES.md

-5
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,6 @@ Where:
618618
- `options` is an optional Object that might contain the following keys:
619619
- `hash` is a Boolean value to return only the hash.
620620
- `size` is a Boolean value to return only the size.
621-
- `withLocal` is a Boolean value to compute the amount of the dag that is local, and if possible the total size.
622621

623622
`callback` must follow the `function (err, stat) {}` signature, where `err` is an Error if the operation was not successful and `stat` is an Object with the following keys:
624623

@@ -627,10 +626,6 @@ Where:
627626
- `cumulativeSize` is an integer with the cumulative size in Bytes.
628627
- `blocks` is an integer indicating the number of blocks.
629628
- `type` is a string that can be either `directory` or `file`.
630-
- `withLocality` is a boolean to indicate if locality information are present.
631-
- `local` is a boolean to indicate if the queried dag is fully present locally.
632-
- `sizeLocal` is an integer indicating the cumulative size of the data present locally.
633-
634629

635630
If no `callback` is passed, a promise is returned.
636631

js/src/files-mfs.js

+2-52
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,7 @@ module.exports = (common) => {
276276
blocks: 1,
277277
size: 13,
278278
hash: 'QmcZojhwragQr5qhTeFAmELik623Z21e3jBTpJXoQ9si1T',
279-
cumulativeSize: 71,
280-
withLocality: false,
281-
local: undefined,
282-
sizeLocal: undefined
279+
cumulativeSize: 71
283280
})
284281
done()
285282
})
@@ -298,54 +295,7 @@ module.exports = (common) => {
298295
blocks: 2,
299296
size: 0,
300297
hash: 'QmVrkkNurBCeJvPRohW5JTvJG4AxGrFg7FnmsZZUS6nJto',
301-
cumulativeSize: 216,
302-
withLocality: false,
303-
local: undefined,
304-
sizeLocal: undefined
305-
})
306-
done()
307-
})
308-
})
309-
310-
it('stat withLocal file', function (done) {
311-
if (!withGo) {
312-
console.log('Not supported in js-ipfs yet')
313-
this.skip()
314-
}
315-
316-
ipfs.files.stat('/test/b', {'withLocal': true}, (err, stat) => {
317-
expect(err).to.not.exist()
318-
expect(stat).to.eql({
319-
type: 'file',
320-
blocks: 1,
321-
size: 13,
322-
hash: 'QmcZojhwragQr5qhTeFAmELik623Z21e3jBTpJXoQ9si1T',
323-
cumulativeSize: 71,
324-
withLocality: true,
325-
local: true,
326-
sizeLocal: 71
327-
})
328-
done()
329-
})
330-
})
331-
332-
it('stat withLocal dir', function (done) {
333-
if (!withGo) {
334-
console.log('Not supported in js-ipfs yet')
335-
this.skip()
336-
}
337-
338-
ipfs.files.stat('/test', {'withLocal': true}, (err, stat) => {
339-
expect(err).to.not.exist()
340-
expect(stat).to.eql({
341-
type: 'directory',
342-
blocks: 2,
343-
size: 0,
344-
hash: 'QmVrkkNurBCeJvPRohW5JTvJG4AxGrFg7FnmsZZUS6nJto',
345-
cumulativeSize: 216,
346-
withLocality: true,
347-
local: true,
348-
sizeLocal: 216
298+
cumulativeSize: 216
349299
})
350300
done()
351301
})

js/src/files.js

+1-32
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ module.exports = (common) => {
2424
this.timeout(40 * 1000)
2525

2626
let ipfs
27-
let withGo
2827

2928
function fixture (path) {
3029
return loadFixture(path, 'interface-ipfs-core')
@@ -61,11 +60,7 @@ module.exports = (common) => {
6160
factory.spawnNode((err, node) => {
6261
expect(err).to.not.exist()
6362
ipfs = node
64-
node.id((err, id) => {
65-
expect(err).to.not.exist()
66-
withGo = id.agentVersion.startsWith('go-ipfs')
67-
done()
68-
})
63+
done()
6964
})
7065
})
7166
})
@@ -1007,31 +1002,5 @@ module.exports = (common) => {
10071002
)
10081003
})
10091004
})
1010-
1011-
describe('.stat', () => {
1012-
before((done) => ipfs.files.add(smallFile.data, done))
1013-
1014-
it('stat outside of mfs', function (done) {
1015-
if (!withGo) {
1016-
console.log('Not supported in js-ipfs yet')
1017-
this.skip()
1018-
}
1019-
1020-
ipfs.files.stat('/ipfs/' + smallFile.cid, (err, stat) => {
1021-
expect(err).to.not.exist()
1022-
expect(stat).to.eql({
1023-
type: 'file',
1024-
blocks: 0,
1025-
size: 12,
1026-
hash: 'Qma4hjFTnCasJ8PVp3mZbZK5g2vGDT4LByLJ7m8ciyRFZP',
1027-
cumulativeSize: 20,
1028-
withLocality: false,
1029-
local: undefined,
1030-
sizeLocal: undefined
1031-
})
1032-
done()
1033-
})
1034-
})
1035-
})
10361005
})
10371006
}

0 commit comments

Comments
 (0)