Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Commit

Permalink
chore: udpate importer to only output unixfs things
Browse files Browse the repository at this point in the history
BREAKING CHANGE:

If you specify `raw-nodes` to be true or `cid-version` to be `1`
and your data fits in one chunk, you would previously get a `CID`
that resolves to an `ipld-raw` node.

Now you will get a `CID` that resolves to a `dag-pb` node, so the
output of every import will be a `unixfs` object.
  • Loading branch information
achingbrain committed Feb 5, 2020
1 parent cdc7d6b commit 7f03fac
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
"ipfs-repo": "^0.30.0",
"ipfs-unixfs": "^0.3.0",
"ipfs-unixfs-exporter": "^0.41.0",
"ipfs-unixfs-importer": "^0.44.0",
"ipfs-unixfs-importer": "^0.45.0",
"ipfs-utils": "^0.7.1",
"ipld": "~0.25.0",
"ipld-bitcoin": "~0.3.0",
Expand Down
4 changes: 2 additions & 2 deletions test/cli/files.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ describe('files', () => runOnAndOff((thing) => {

const out = await ipfs('add test/fixtures/less-than-default-max-chunk-size --cid-version=1')
expect(out)
.to.eql('added bafkreie3abdlmy7dtxddm4vkbhd2x2yax5scf4m35eyxf3ywj2uwkjbhgi less-than-default-max-chunk-size\n')
.to.eql('added bafybeiaoh5okvpnuhndsz4kgdhulnkm566rz7w7il6r2zm6wxu5f5uqlsu less-than-default-max-chunk-size\n')
})

it('add with cid-version=1 > default max chunk size', async function () {
Expand Down Expand Up @@ -250,7 +250,7 @@ describe('files', () => runOnAndOff((thing) => {

const out = await ipfs('add test/fixtures/less-than-default-max-chunk-size --cid-version=1 --raw-leaves=true')
expect(out)
.to.eql('added bafkreie3abdlmy7dtxddm4vkbhd2x2yax5scf4m35eyxf3ywj2uwkjbhgi less-than-default-max-chunk-size\n')
.to.eql('added bafybeiaoh5okvpnuhndsz4kgdhulnkm566rz7w7il6r2zm6wxu5f5uqlsu less-than-default-max-chunk-size\n')
})

it('add with cid-version=1 and raw-leaves=true > default max chunk size', async function () {
Expand Down
4 changes: 2 additions & 2 deletions test/core/files.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ describe('files', function () {
}))

expect(files.length).to.equal(1)
expect(files[0].cid.toString()).to.equal('bafkreifojmzibzlof6xyh5auu3r5vpu5l67brf3fitaf73isdlglqw2t7q')
expect(files[0].size).to.equal(3)
expect(files[0].cid.toString()).to.equal('bafybeide2caf5we5a7izifzwzz5ds2gla67vsfgrzvbzpnyyirnfzgwf5e')
expect(files[0].size).to.equal(11)
})

it('should add a file with a v1 CID and not raw leaves', async () => {
Expand Down

0 comments on commit 7f03fac

Please sign in to comment.