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

Commit 009fb98

Browse files
authored
fix: remove format and/or codec options (#69)
IPFS is all `dag-pb` yet we allow passing `dag-cbor` as the format of IPLD node to use. This is likely to break anything that uses it as tools expect IPFS stuff to be `dag-pb`, possibly with `raw` leaves. Closes #67 BREAKING CHANGE: `--format` and/or `--codec` option has been removed from the CLI, the HTTP API and the core API.
1 parent 38a8b51 commit 009fb98

39 files changed

+14
-383
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@
7373
"ipfs-multipart": "^0.3.0",
7474
"ipfs-unixfs": "^0.3.0",
7575
"ipfs-unixfs-exporter": "^0.40.0",
76-
"ipfs-unixfs-importer": "^0.43.0",
76+
"ipfs-unixfs-importer": "^0.43.1",
7777
"ipfs-utils": "^0.4.2",
7878
"ipld-dag-pb": "^0.18.0",
7979
"it-last": "^1.0.1",

src/cli/chmod.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@ module.exports = {
2727
coerce: asBoolean,
2828
describe: 'Whether to change modes recursively'
2929
},
30-
codec: {
31-
alias: 'c',
32-
type: 'string',
33-
default: 'dag-pb',
34-
describe: 'If intermediate directories are created, use this codec to create them (experimental)'
35-
},
3630
'hash-alg': {
3731
alias: 'h',
3832
type: 'string',
@@ -59,7 +53,6 @@ module.exports = {
5953
mode,
6054
getIpfs,
6155
recursive,
62-
codec,
6356
hashAlg,
6457
flush,
6558
shardSplitThreshold
@@ -70,7 +63,6 @@ module.exports = {
7063

7164
return ipfs.files.chmod(path, mode, {
7265
recursive,
73-
format: codec,
7466
hashAlg,
7567
flush,
7668
shardSplitThreshold

src/cli/cp.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,6 @@ module.exports = {
1717
coerce: asBoolean,
1818
describe: 'Create any non-existent intermediate directories'
1919
},
20-
codec: {
21-
alias: 'c',
22-
type: 'string',
23-
default: 'dag-pb',
24-
describe: 'If intermediate directories are created, use this codec to create them (experimental)'
25-
},
2620
'hash-alg': {
2721
alias: 'h',
2822
type: 'string',
@@ -49,7 +43,6 @@ module.exports = {
4943
dest,
5044
getIpfs,
5145
parents,
52-
codec,
5346
flush,
5447
hashAlg,
5548
shardSplitThreshold
@@ -59,7 +52,6 @@ module.exports = {
5952
const ipfs = await getIpfs()
6053
return ipfs.files.cp(source, dest, {
6154
parents,
62-
format: codec,
6355
flush,
6456
hashAlg,
6557
shardSplitThreshold

src/cli/mkdir.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,6 @@ module.exports = {
2525
default: 0,
2626
describe: 'Cid version to use. (experimental).'
2727
},
28-
codec: {
29-
alias: 'c',
30-
type: 'string',
31-
default: 'dag-pb',
32-
describe: 'If intermediate directories are created, use this codec to create them (experimental)'
33-
},
3428
'hash-alg': {
3529
alias: 'h',
3630
type: 'string',
@@ -67,7 +61,6 @@ module.exports = {
6761
getIpfs,
6862
parents,
6963
cidVersion,
70-
codec,
7164
hashAlg,
7265
flush,
7366
shardSplitThreshold,
@@ -81,7 +74,6 @@ module.exports = {
8174
return ipfs.files.mkdir(path, {
8275
parents,
8376
cidVersion,
84-
format: codec,
8577
hashAlg,
8678
flush,
8779
shardSplitThreshold,

src/cli/mv.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,6 @@ module.exports = {
3030
default: 0,
3131
describe: 'Cid version to use. (experimental).'
3232
},
33-
codec: {
34-
alias: 'c',
35-
type: 'string',
36-
default: 'dag-pb',
37-
describe: 'If intermediate directories are created, use this codec to create them (experimental)'
38-
},
3933
'hash-alg': {
4034
alias: 'h',
4135
type: 'string',
@@ -64,7 +58,6 @@ module.exports = {
6458
parents,
6559
recursive,
6660
cidVersion,
67-
codec,
6861
hashAlg,
6962
flush,
7063
shardSplitThreshold
@@ -77,7 +70,6 @@ module.exports = {
7770
parents,
7871
recursive,
7972
cidVersion,
80-
format: codec,
8173
hashAlg,
8274
flush,
8375
shardSplitThreshold

src/cli/touch.js

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@ module.exports = {
3131
default: 0,
3232
describe: 'Cid version to use. (experimental).'
3333
},
34-
codec: {
35-
alias: 'c',
36-
type: 'string',
37-
default: 'dag-pb',
38-
describe: 'If intermediate directories are created, use this codec to create them (experimental)'
39-
},
4034
'hash-alg': {
4135
alias: 'h',
4236
type: 'string',
@@ -56,7 +50,6 @@ module.exports = {
5650
getIpfs,
5751
flush,
5852
cidVersion,
59-
codec,
6053
hashAlg,
6154
shardSplitThreshold,
6255
mtime
@@ -69,7 +62,6 @@ module.exports = {
6962
mtime,
7063
flush,
7164
cidVersion,
72-
format: codec,
7365
hashAlg,
7466
shardSplitThreshold
7567
})

src/cli/write.js

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,6 @@ module.exports = {
7878
type: 'string',
7979
default: 'sha2-256'
8080
},
81-
codec: {
82-
alias: ['c'],
83-
type: 'string',
84-
default: 'dag-pb'
85-
},
8681
'shard-split-threshold': {
8782
type: 'number',
8883
default: 1000,
@@ -114,7 +109,6 @@ module.exports = {
114109
reduceSingleLeafToSelf,
115110
cidVersion,
116111
hashAlg,
117-
codec,
118112
parents,
119113
progress,
120114
strategy,
@@ -136,7 +130,6 @@ module.exports = {
136130
reduceSingleLeafToSelf,
137131
cidVersion,
138132
hashAlg,
139-
format: codec,
140133
parents,
141134
progress,
142135
strategy,

src/core/chmod.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ const mh = require('multihashes')
1616
const defaultOptions = {
1717
flush: true,
1818
shardSplitThreshold: 1000,
19-
format: 'dag-pb',
2019
hashAlg: 'sha2-256',
2120
cidVersion: 0,
2221
recursive: false
@@ -174,7 +173,7 @@ module.exports = (context) => {
174173

175174
const updatedCid = await context.ipld.put(node, mc.DAG_PB, {
176175
cidVersion: cid.version,
177-
hashAlg: mh.names['sha2-256'],
176+
hashAlg: mh.names[options.hashAlg],
178177
onlyHash: !options.flush
179178
})
180179

@@ -188,8 +187,7 @@ module.exports = (context) => {
188187
cid: updatedCid,
189188
size: node.serialize().length,
190189
flush: options.flush,
191-
format: 'dag-pb',
192-
hashAlg: 'sha2-256',
190+
hashAlg: options.hashAlg,
193191
cidVersion: cid.version
194192
})
195193

src/core/cp.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ const toTrail = require('./utils/to-trail')
1515
const defaultOptions = {
1616
parents: false,
1717
flush: true,
18-
format: 'dag-pb',
1918
hashAlg: 'sha2-256',
2019
cidVersion: 0,
2120
shardSplitThreshold: 1000
@@ -150,7 +149,6 @@ const addSourceToParent = async (context, source, childName, parent, options) =>
150149
size: sourceBlock.data.length,
151150
cid: source.cid,
152151
name: childName,
153-
format: options.format,
154152
hashAlg: options.hashAlg,
155153
cidVersion: options.cidVersion,
156154
flush: options.flush

src/core/mkdir.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ const defaultOptions = {
1919
hashAlg: 'sha2-256',
2020
cidVersion: 0,
2121
shardSplitThreshold: 1000,
22-
format: 'dag-pb',
2322
flush: true,
2423
mode: null,
2524
mtime: null
@@ -116,7 +115,6 @@ const addEmptyDir = async (context, childName, emptyDir, parent, trail, options)
116115
size: emptyDir.node.size,
117116
cid: emptyDir.cid,
118117
name: childName,
119-
format: options.format,
120118
hashAlg: options.hashAlg,
121119
cidVersion: options.cidVersion,
122120
mode: options.mode,

0 commit comments

Comments
 (0)