diff --git a/package.json b/package.json index 7667d59..3c6dc5f 100644 --- a/package.json +++ b/package.json @@ -37,18 +37,18 @@ }, "homepage": "https://github.com/ipfs/js-ipfs-mfs#readme", "devDependencies": { - "aegir": "^17.0.0", + "aegir": "^17.0.1", "chai": "^4.2.0", "detect-node": "^2.0.4", "detect-webworker": "^1.0.0", "dirty-chai": "^2.0.1", - "ipfs": "~0.32.3", + "ipfs": "~0.33.0", "pull-buffer-stream": "^1.0.0", "tmp": "~0.0.33" }, "dependencies": { "async": "^2.6.1", - "blob": "~0.0.4", + "blob": "~0.0.5", "cids": "~0.5.5", "debug": "^4.1.0", "file-api": "~0.10.4", @@ -58,7 +58,7 @@ "ipfs-unixfs-engine": "~0.33.0", "is-pull-stream": "~0.0.0", "is-stream": "^1.1.0", - "joi": "^14.0.1", + "joi": "^14.0.4", "joi-browser": "^13.4.0", "mortice": "^1.2.1", "once": "^1.4.0", diff --git a/src/core/utils/traverse-to.js b/src/core/utils/traverse-to.js index ae7a006..8adaf04 100644 --- a/src/core/utils/traverse-to.js +++ b/src/core/utils/traverse-to.js @@ -74,11 +74,11 @@ const traverseToMfsObject = (ipfs, path, options, callback) => { parent: null }) - reduce(pathSegments.map((pathSegment, index) => ({pathSegment, index})), { + reduce(pathSegments.map((pathSegment, index) => ({ pathSegment, index })), { name: FILE_SEPARATOR, node: rootNode, parent: null - }, (parent, {pathSegment, index}, done) => { + }, (parent, { pathSegment, index }, done) => { const existingLink = parent.node.links.find(link => link.name === pathSegment) if (!existingLink) { diff --git a/src/core/utils/with-mfs-root.js b/src/core/utils/with-mfs-root.js index 24512ba..820a22b 100644 --- a/src/core/utils/with-mfs-root.js +++ b/src/core/utils/with-mfs-root.js @@ -28,11 +28,11 @@ const withMfsRoot = (ipfs, callback) => { return waterfall([ // Store an empty node as the root - (next) => ipfs.files.add({ + (next) => ipfs.add({ path: '/' }, next), // Turn the hash into a Buffer - ([{hash}], next) => next(null, new CID(hash)), + ([{ hash }], next) => next(null, new CID(hash)), (cid, next) => repo.closed ? datastore.open((error) => next(error, cid)) : next(null, cid), // Store the Buffer in the datastore (cid, next) => datastore.put(MFS_ROOT_KEY, cid.buffer, (error) => next(error, cid)) diff --git a/test/write.spec.js b/test/write.spec.js index ad1627f..0058fbd 100644 --- a/test/write.spec.js +++ b/test/write.spec.js @@ -262,7 +262,7 @@ describe('write', function () { }) }) - runTest(({type, path, content}) => { + runTest(({ type, path, content }) => { it(`limits how many bytes to write to a file (${type})`, () => { return mfs.write(path, content, { create: true, @@ -276,7 +276,7 @@ describe('write', function () { }) }) - runTest(({type, path, content, contentSize}) => { + runTest(({ type, path, content, contentSize }) => { it(`overwrites start of a file without truncating (${type})`, () => { const newContent = Buffer.from('Goodbye world') @@ -294,7 +294,7 @@ describe('write', function () { }) }) - runTest(({type, path, content, contentSize}) => { + runTest(({ type, path, content, contentSize }) => { it(`pads the start of a new file when an offset is specified (${type})`, () => { const offset = 10 @@ -316,7 +316,7 @@ describe('write', function () { }) }) - runTest(({type, path, content, contentSize}) => { + runTest(({ type, path, content, contentSize }) => { it(`expands a file when an offset is specified (${type})`, () => { const offset = contentSize - 1 const newContent = Buffer.from('Oh hai!') @@ -336,7 +336,7 @@ describe('write', function () { }) }) - runTest(({type, path, content, contentSize}) => { + runTest(({ type, path, content, contentSize }) => { it(`expands a file when an offset is specified and the offset is longer than the file (${type})`, () => { const offset = contentSize + 5 const newContent = Buffer.from('Oh hai!') @@ -358,7 +358,7 @@ describe('write', function () { }) }) - runTest(({type, path, content}) => { + runTest(({ type, path, content }) => { it(`truncates a file after writing (${type})`, () => { const newContent = Buffer.from('Oh hai!') @@ -375,7 +375,7 @@ describe('write', function () { }) }) - runTest(({type, path, content}) => { + runTest(({ type, path, content }) => { it(`truncates a file after writing with a stream (${type})`, () => { const newContent = Buffer.from('Oh hai!') const stream = values([newContent]) @@ -393,7 +393,7 @@ describe('write', function () { }) }) - runTest(({type, path, content}) => { + runTest(({ type, path, content }) => { it(`truncates a file after writing with a stream with an offset (${type})`, () => { const offset = 100 const newContent = Buffer.from('Oh hai!') @@ -411,7 +411,7 @@ describe('write', function () { }) }) - runTest(({type, path, content}) => { + runTest(({ type, path, content }) => { it(`writes a file with raw blocks for newly created leaf nodes (${type})`, () => { return mfs.write(path, content, { create: true, @@ -439,7 +439,7 @@ describe('write', function () { } return Promise.all( - files.map(({name, source}) => mfs.write(`/concurrent/${name}`, source, { + files.map(({ name, source }) => mfs.write(`/concurrent/${name}`, source, { create: true, parents: true }))