diff --git a/src/index.js b/src/index.js index bef1b42f..cd60790f 100644 --- a/src/index.js +++ b/src/index.js @@ -9,6 +9,9 @@ const FixedSizeChunker = require('./chunker-fixed-size') const through2 = require('through2') const UnixFS = require('ipfs-unixfs') const async = require('async') +const events = require('events') +const Readable = require('stream').Readable +const pathj = require('path') exports = module.exports @@ -206,7 +209,6 @@ exports.import = (target, dagService, options, callback) => { leafSize: raw.fileSize(), Name: '' }) - cb() }) }, (cb) => { @@ -249,6 +251,114 @@ exports.import = (target, dagService, options, callback) => { // function streamImporter (stream, callback) {} } -exports.export = function () { - // export into files by hash +exports.export = function (hash, dagService, options, callback) { + if (typeof options === 'function') { + callback = options + options = {} + } + + const ee = new events.EventEmitter() + dagService.get(hash, (err, fetchedNode) => { + if (err) { + if (callback) { + return callback(err) + } + return + } + const data = UnixFS.unmarshal(fetchedNode.data) + const type = data.type + if (type === 'directory') { + dirExporter(fetchedNode, hash, callback) + } + if (type === 'file') { + fileExporter(fetchedNode, hash, false, callback) + } + }) + return ee + + function fileExporter (node, name, dir, callback) { + if (typeof dir === 'function') { callback = dir; dir = {} } + var rs = new Readable() + if (node.links.length === 0) { + const unmarshaledData = UnixFS.unmarshal(node.data) + ee.emit('file', { stream: rs, path: name, dir: dir }) + rs.push(unmarshaledData.data) + rs.push(null) + if (callback) { + callback() + } + return + } else { + ee.emit('file', { stream: rs, path: name, dir: dir }) + var init = false + rs._read = () => { + if (init) { + return + } + init = true + async.forEachSeries(node.links, (link, callback) => { + dagService.get(link.hash, (err, res) => { + if (err) { + callback(err) + } + var unmarshaledData = UnixFS.unmarshal(res.data) + rs.push(unmarshaledData.data) + callback() + }) + }, (err) => { + if (err) { + if (callback) { + return callback(err) + } + return + } + rs.push(null) + if (callback) { + callback() + } + return + }) + } + } + } + + function dirExporter (node, name, callback) { + var rs = new Readable() + if (node.links.length === 0) { + rs.push(node.data) + rs.push(null) + ee.emit('file', {stream: rs, path: name}) + if (callback) { + callback() + } + return + } else { + async.forEachSeries(node.links, (link, callback) => { + dagService.get(link.hash, (err, res) => { + if (err) { + callback(err) + } + var unmarshaledData = UnixFS.unmarshal(res.data) + if (unmarshaledData.type === 'file') { + return (fileExporter(res, pathj.join(name, link.name), callback)) + } + if (unmarshaledData.type === 'directory') { + return (dirExporter(res, pathj.join(name, link.name), callback)) + } + callback() + }) + }, (err) => { + if (err) { + if (callback) { + return callback(err) + } + return + } + if (callback) { + callback() + } + return + }) + } + } } diff --git a/test/buffer-test.js b/test/buffer-test.js index 097e2458..4f7e02e1 100644 --- a/test/buffer-test.js +++ b/test/buffer-test.js @@ -82,5 +82,60 @@ module.exports = function (repo) { }) }) }) + + it('export a file with no links', (done) => { + const hash = 'QmQmZQxSKQppbsWfVzBvg59Cn3DKtsNVQ94bjAxg2h3Lb8' + const bs = new BlockService(repo) + const ds = new DAGService(bs) + const testExport = importer.export(hash, ds) + testExport.on('file', (data) => { + ds.get(hash, (err, fetchedNode) => { + expect(err).to.not.exist + const unmarsh = UnixFS.unmarshal(fetchedNode.data) + expect(unmarsh.data).to.deep.equal(data.stream._readableState.buffer[0]) + done() + }) + }) + }) + + it('export a small file with links', (done) => { + const hash = 'QmW7BDxEbGqxxSYVtn3peNPQgdDXbWkoQ6J1EFYAEuQV3Q' + const bs = new BlockService(repo) + const ds = new DAGService(bs) + const testExport = importer.export(hash, ds) + testExport.on('file', (data) => { + expect(data.stream).to.exist + done() + }) + }) + + it('export a large file > 5mb', (done) => { + const hash = 'QmRQgufjp9vLE8XK2LGKZSsPCFCF6e4iynCQtNB5X2HBKE' + const bs = new BlockService(repo) + const ds = new DAGService(bs) + const testExport = importer.export(hash, ds) + testExport.on('file', (data) => { + expect(data.stream).to.exist + done() + }) + }) + + it('export a directory', (done) => { + const hash = 'QmWChcSFMNcFkfeJtNd8Yru1rE6PhtCRfewi1tMwjkwKjN' + const bs = new BlockService(repo) + const ds = new DAGService(bs) + const testExport = importer.export(hash, ds) + var fs = [] + testExport.on('file', (data) => { + fs.push(data) + }) + setTimeout(() => { + expect(fs[0].path).to.equal('QmWChcSFMNcFkfeJtNd8Yru1rE6PhtCRfewi1tMwjkwKjN/200Bytes.txt') + expect(fs[1].path).to.equal('QmWChcSFMNcFkfeJtNd8Yru1rE6PhtCRfewi1tMwjkwKjN/dir-another') + expect(fs[2].path).to.equal('QmWChcSFMNcFkfeJtNd8Yru1rE6PhtCRfewi1tMwjkwKjN/level-1/200Bytes.txt') + expect(fs[3].path).to.equal('QmWChcSFMNcFkfeJtNd8Yru1rE6PhtCRfewi1tMwjkwKjN/level-1/level-2') + done() + }, 1000) + }) }) } diff --git a/test/repo-example/blocks/12200046/12200046ea932273bc69bf22ccd57a2837eee93896de64e70099724ae333c67eebae.data b/test/repo-example/blocks/12200046/12200046ea932273bc69bf22ccd57a2837eee93896de64e70099724ae333c67eebae.data new file mode 100644 index 00000000..e80dbd9a Binary files /dev/null and b/test/repo-example/blocks/12200046/12200046ea932273bc69bf22ccd57a2837eee93896de64e70099724ae333c67eebae.data differ diff --git a/test/repo-example/blocks/1220016d/1220016d22c790b4e50495df66eff6361276442eff53b5457cf8de5c2c6726325ca7.data b/test/repo-example/blocks/1220016d/1220016d22c790b4e50495df66eff6361276442eff53b5457cf8de5c2c6726325ca7.data new file mode 100644 index 00000000..819ec6cf Binary files /dev/null and b/test/repo-example/blocks/1220016d/1220016d22c790b4e50495df66eff6361276442eff53b5457cf8de5c2c6726325ca7.data differ diff --git a/test/repo-example/blocks/1220016d/1220016dad5f5c19d1cad0382bdc72ee3c35ac5216bce4d54d875151dd67333a700c.data b/test/repo-example/blocks/1220016d/1220016dad5f5c19d1cad0382bdc72ee3c35ac5216bce4d54d875151dd67333a700c.data new file mode 100644 index 00000000..1379fd9c Binary files /dev/null and b/test/repo-example/blocks/1220016d/1220016dad5f5c19d1cad0382bdc72ee3c35ac5216bce4d54d875151dd67333a700c.data differ diff --git a/test/repo-example/blocks/12200b0a/12200b0a5998ef9632814f333e81fc82bed3690292d0d0058833abb2af46af5a1c91.data b/test/repo-example/blocks/12200b0a/12200b0a5998ef9632814f333e81fc82bed3690292d0d0058833abb2af46af5a1c91.data new file mode 100644 index 00000000..3b40300d Binary files /dev/null and b/test/repo-example/blocks/12200b0a/12200b0a5998ef9632814f333e81fc82bed3690292d0d0058833abb2af46af5a1c91.data differ diff --git a/test/repo-example/blocks/12202d19/12202d198f2071c2e3cb56d40ac3ca78f5129291807dfd1f9083ce6b3be74e408534.data b/test/repo-example/blocks/12202d19/12202d198f2071c2e3cb56d40ac3ca78f5129291807dfd1f9083ce6b3be74e408534.data new file mode 100644 index 00000000..912b64e0 Binary files /dev/null and b/test/repo-example/blocks/12202d19/12202d198f2071c2e3cb56d40ac3ca78f5129291807dfd1f9083ce6b3be74e408534.data differ diff --git a/test/repo-example/blocks/12202d19/12202d19d02a8747aaafe5db0ad7ecee53c63fbf4119bb6acaaf8cba3de8ccf3770a.data b/test/repo-example/blocks/12202d19/12202d19d02a8747aaafe5db0ad7ecee53c63fbf4119bb6acaaf8cba3de8ccf3770a.data new file mode 100644 index 00000000..3f5311b7 Binary files /dev/null and b/test/repo-example/blocks/12202d19/12202d19d02a8747aaafe5db0ad7ecee53c63fbf4119bb6acaaf8cba3de8ccf3770a.data differ diff --git a/test/repo-example/blocks/12202d9b/12202d9bdeee51833a1816d90a2d46406e4714193ab9e47690dbbe42260fe16de8d9.data b/test/repo-example/blocks/12202d9b/12202d9bdeee51833a1816d90a2d46406e4714193ab9e47690dbbe42260fe16de8d9.data new file mode 100644 index 00000000..1a86e0be Binary files /dev/null and b/test/repo-example/blocks/12202d9b/12202d9bdeee51833a1816d90a2d46406e4714193ab9e47690dbbe42260fe16de8d9.data differ diff --git a/test/repo-example/blocks/12203232/12203232f27e1ad4cfa27eabe7300c92b75037a5eeba0a40bc776472c88d2abcc760.data b/test/repo-example/blocks/12203232/12203232f27e1ad4cfa27eabe7300c92b75037a5eeba0a40bc776472c88d2abcc760.data new file mode 100644 index 00000000..a3e60c9e Binary files /dev/null and b/test/repo-example/blocks/12203232/12203232f27e1ad4cfa27eabe7300c92b75037a5eeba0a40bc776472c88d2abcc760.data differ diff --git a/test/repo-example/blocks/122036be/122036be591a509e38c1df109430bc6d6a63615735efc1ab3b317aee5e1d9888ac75.data b/test/repo-example/blocks/122036be/122036be591a509e38c1df109430bc6d6a63615735efc1ab3b317aee5e1d9888ac75.data new file mode 100644 index 00000000..ba0caf40 Binary files /dev/null and b/test/repo-example/blocks/122036be/122036be591a509e38c1df109430bc6d6a63615735efc1ab3b317aee5e1d9888ac75.data differ diff --git a/test/repo-example/blocks/1220414f/1220414ff3a99054999668b5934af1c42e578399a9485c4d19e8b2b65ba5dd723aab.data b/test/repo-example/blocks/1220414f/1220414ff3a99054999668b5934af1c42e578399a9485c4d19e8b2b65ba5dd723aab.data new file mode 100644 index 00000000..7f2f4e92 Binary files /dev/null and b/test/repo-example/blocks/1220414f/1220414ff3a99054999668b5934af1c42e578399a9485c4d19e8b2b65ba5dd723aab.data differ diff --git a/test/repo-example/blocks/122051b6/122051b6a7a8ac28d2eeddbf4339f78c0220c3023aeabc9a4e58927f30fddce8b505.data b/test/repo-example/blocks/122051b6/122051b6a7a8ac28d2eeddbf4339f78c0220c3023aeabc9a4e58927f30fddce8b505.data new file mode 100644 index 00000000..026ac913 Binary files /dev/null and b/test/repo-example/blocks/122051b6/122051b6a7a8ac28d2eeddbf4339f78c0220c3023aeabc9a4e58927f30fddce8b505.data differ diff --git a/test/repo-example/blocks/12205411/1220541179c3350d3b5f395966bb71808346f34c68796c10f3129c1511d0172fc9ed.data b/test/repo-example/blocks/12205411/1220541179c3350d3b5f395966bb71808346f34c68796c10f3129c1511d0172fc9ed.data new file mode 100644 index 00000000..9e5174d0 --- /dev/null +++ b/test/repo-example/blocks/12205411/1220541179c3350d3b5f395966bb71808346f34c68796c10f3129c1511d0172fc9ed.data @@ -0,0 +1,4 @@ +5 +" $G,A4{xZ/.D` 200Bytes.txt/ +" Y9_)a˹2RmŖke9level-2 + \ No newline at end of file diff --git a/test/repo-example/blocks/1220614d/1220614dcf483bf2fb19c82b22af9c8d47a35a6d4fdcf85e33db4df6987edee07063.data b/test/repo-example/blocks/1220614d/1220614dcf483bf2fb19c82b22af9c8d47a35a6d4fdcf85e33db4df6987edee07063.data new file mode 100644 index 00000000..8eb2a515 Binary files /dev/null and b/test/repo-example/blocks/1220614d/1220614dcf483bf2fb19c82b22af9c8d47a35a6d4fdcf85e33db4df6987edee07063.data differ diff --git a/test/repo-example/blocks/122065f3/122065f339db69b1605e388c95e9e1dc8451ada862755098a84689328d2a546c2963.data b/test/repo-example/blocks/122065f3/122065f339db69b1605e388c95e9e1dc8451ada862755098a84689328d2a546c2963.data new file mode 100644 index 00000000..dedf499f Binary files /dev/null and b/test/repo-example/blocks/122065f3/122065f339db69b1605e388c95e9e1dc8451ada862755098a84689328d2a546c2963.data differ diff --git a/test/repo-example/blocks/122074d4/122074d42168a1c62b4796e77a9591d8f1fab4685f6674eabecc7773913363b45301.data b/test/repo-example/blocks/122074d4/122074d42168a1c62b4796e77a9591d8f1fab4685f6674eabecc7773913363b45301.data new file mode 100644 index 00000000..e3ec206f --- /dev/null +++ b/test/repo-example/blocks/122074d4/122074d42168a1c62b4796e77a9591d8f1fab4685f6674eabecc7773913363b45301.data @@ -0,0 +1,5 @@ +5 +" $G,A4{xZ/.D` 200Bytes.txt3 +" Y9_)a˹2RmŖke9 dir-another0 +" Ty5 ;_9YfqFLhyl/level-1 + \ No newline at end of file diff --git a/test/repo-example/blocks/12207b9b/12207b9bf084ba1f973ba3994c3ac9cf556b894633bec0acf87dfd9cf6f957bc0855.data b/test/repo-example/blocks/12207b9b/12207b9bf084ba1f973ba3994c3ac9cf556b894633bec0acf87dfd9cf6f957bc0855.data new file mode 100644 index 00000000..1524efce Binary files /dev/null and b/test/repo-example/blocks/12207b9b/12207b9bf084ba1f973ba3994c3ac9cf556b894633bec0acf87dfd9cf6f957bc0855.data differ diff --git a/test/repo-example/blocks/12207cef/12207cefb4d9616bb6c0e915da503fb59c077861f3a5b7a9deeca5eff1fcccd3ccec.data b/test/repo-example/blocks/12207cef/12207cefb4d9616bb6c0e915da503fb59c077861f3a5b7a9deeca5eff1fcccd3ccec.data new file mode 100644 index 00000000..b0ac590e Binary files /dev/null and b/test/repo-example/blocks/12207cef/12207cefb4d9616bb6c0e915da503fb59c077861f3a5b7a9deeca5eff1fcccd3ccec.data differ diff --git a/test/repo-example/blocks/1220829c/1220829cebf24c4e827d15fde2e687828b9d97a9e1c73190722a0b1ca5ce3e0f85b1.data b/test/repo-example/blocks/1220829c/1220829cebf24c4e827d15fde2e687828b9d97a9e1c73190722a0b1ca5ce3e0f85b1.data new file mode 100644 index 00000000..aacafb9f Binary files /dev/null and b/test/repo-example/blocks/1220829c/1220829cebf24c4e827d15fde2e687828b9d97a9e1c73190722a0b1ca5ce3e0f85b1.data differ diff --git a/test/repo-example/blocks/12208940/12208940fef8c586f7df131d3fdabd1903c36abadcbb55b8f352446e8d67c6c7ee87.data b/test/repo-example/blocks/12208940/12208940fef8c586f7df131d3fdabd1903c36abadcbb55b8f352446e8d67c6c7ee87.data new file mode 100644 index 00000000..615417b1 Binary files /dev/null and b/test/repo-example/blocks/12208940/12208940fef8c586f7df131d3fdabd1903c36abadcbb55b8f352446e8d67c6c7ee87.data differ diff --git a/test/repo-example/blocks/1220984a/1220984a7e1501c42bbe85bf56f1451c0ea7c81e4038d31434c1eb1f94d33cac1ffd.data b/test/repo-example/blocks/1220984a/1220984a7e1501c42bbe85bf56f1451c0ea7c81e4038d31434c1eb1f94d33cac1ffd.data new file mode 100644 index 00000000..e743bdbf Binary files /dev/null and b/test/repo-example/blocks/1220984a/1220984a7e1501c42bbe85bf56f1451c0ea7c81e4038d31434c1eb1f94d33cac1ffd.data differ diff --git a/test/repo-example/blocks/12209b92/12209b92240f2b17e6f47bf84a518009a1c2ac48afe25032d5f5678398d33b20ea34.data b/test/repo-example/blocks/12209b92/12209b92240f2b17e6f47bf84a518009a1c2ac48afe25032d5f5678398d33b20ea34.data new file mode 100644 index 00000000..a6e00f34 Binary files /dev/null and b/test/repo-example/blocks/12209b92/12209b92240f2b17e6f47bf84a518009a1c2ac48afe25032d5f5678398d33b20ea34.data differ diff --git a/test/repo-example/blocks/12209d4c/12209d4c462f8c4f3c547314b12aa5c2af186e72a9bc4cb354c77280a75a5f37228e.data b/test/repo-example/blocks/12209d4c/12209d4c462f8c4f3c547314b12aa5c2af186e72a9bc4cb354c77280a75a5f37228e.data new file mode 100644 index 00000000..2424f592 Binary files /dev/null and b/test/repo-example/blocks/12209d4c/12209d4c462f8c4f3c547314b12aa5c2af186e72a9bc4cb354c77280a75a5f37228e.data differ diff --git a/test/repo-example/blocks/1220b617/1220b617096833a3ef63aa1e896c1f96ac861c38f6838eb8a24474da9f343cfef127.data b/test/repo-example/blocks/1220b617/1220b617096833a3ef63aa1e896c1f96ac861c38f6838eb8a24474da9f343cfef127.data new file mode 100644 index 00000000..fa45ee79 Binary files /dev/null and b/test/repo-example/blocks/1220b617/1220b617096833a3ef63aa1e896c1f96ac861c38f6838eb8a24474da9f343cfef127.data differ diff --git a/test/repo-example/blocks/1220d068/1220d0687dbeeeeca8508ee5dfe8a0d236e05c3f0afe90e43548acf028302527df49.data b/test/repo-example/blocks/1220d068/1220d0687dbeeeeca8508ee5dfe8a0d236e05c3f0afe90e43548acf028302527df49.data new file mode 100644 index 00000000..d19d0c86 Binary files /dev/null and b/test/repo-example/blocks/1220d068/1220d0687dbeeeeca8508ee5dfe8a0d236e05c3f0afe90e43548acf028302527df49.data differ diff --git a/test/repo-example/blocks/1220e57d/1220e57d74c345d324769d7d2267994a7dc8018ecfc65af4d6625931ededfecef583.data b/test/repo-example/blocks/1220e57d/1220e57d74c345d324769d7d2267994a7dc8018ecfc65af4d6625931ededfecef583.data new file mode 100644 index 00000000..dcd69d0b Binary files /dev/null and b/test/repo-example/blocks/1220e57d/1220e57d74c345d324769d7d2267994a7dc8018ecfc65af4d6625931ededfecef583.data differ diff --git a/test/repo-example/blocks/1220ff8e/1220ff8e0d20fe2a0b371dd8d7a45aac2e018919f2919da4be2e479c614960c4577f.data b/test/repo-example/blocks/1220ff8e/1220ff8e0d20fe2a0b371dd8d7a45aac2e018919f2919da4be2e479c614960c4577f.data new file mode 100644 index 00000000..46d10573 Binary files /dev/null and b/test/repo-example/blocks/1220ff8e/1220ff8e0d20fe2a0b371dd8d7a45aac2e018919f2919da4be2e479c614960c4577f.data differ diff --git a/test/repo-tests1457120896998/blocks/1220120f/1220120f6af601d46e10b2d2e11ed71c55d25f3042c22501e41d1246e7a1e9d3d8ec.data b/test/repo-tests1457120896998/blocks/1220120f/1220120f6af601d46e10b2d2e11ed71c55d25f3042c22501e41d1246e7a1e9d3d8ec.data deleted file mode 100644 index 389e1117..00000000 --- a/test/repo-tests1457120896998/blocks/1220120f/1220120f6af601d46e10b2d2e11ed71c55d25f3042c22501e41d1246e7a1e9d3d8ec.data +++ /dev/null @@ -1,28 +0,0 @@ - -Hello and Welcome to IPFS! - -██╗██████╗ ███████╗███████╗ -██║██╔══██╗██╔════╝██╔════╝ -██║██████╔╝█████╗ ███████╗ -██║██╔═══╝ ██╔══╝ ╚════██║ -██║██║ ██║ ███████║ -╚═╝╚═╝ ╚═╝ ╚══════╝ - -If you're seeing this, you have successfully installed -IPFS and are now interfacing with the ipfs merkledag! - - ------------------------------------------------------- -| Warning: | -| This is alpha software. Use at your own discretion! | -| Much is missing or lacking polish. There are bugs. | -| Not yet secure. Read the security notes for more. | - ------------------------------------------------------- - -Check out some of the other files in this directory: - - ./about - ./help - ./quick-start <-- usage examples - ./readme <-- this file - ./security-notes - \ No newline at end of file diff --git a/test/repo-tests1457120896998/blocks/122031d6/122031d6da265092f1b03fec969243fdcf095c1d219356cdf538ffce705a52d5738d.data b/test/repo-tests1457120896998/blocks/122031d6/122031d6da265092f1b03fec969243fdcf095c1d219356cdf538ffce705a52d5738d.data deleted file mode 100644 index 5ea0edda..00000000 Binary files a/test/repo-tests1457120896998/blocks/122031d6/122031d6da265092f1b03fec969243fdcf095c1d219356cdf538ffce705a52d5738d.data and /dev/null differ diff --git a/test/repo-tests1457120896998/blocks/122031e7/122031e7a41c15d03feb8cd793c3348ea3b310512d7767a9abfbd7a928a85e977173.data b/test/repo-tests1457120896998/blocks/122031e7/122031e7a41c15d03feb8cd793c3348ea3b310512d7767a9abfbd7a928a85e977173.data deleted file mode 100644 index ecce1053..00000000 --- a/test/repo-tests1457120896998/blocks/122031e7/122031e7a41c15d03feb8cd793c3348ea3b310512d7767a9abfbd7a928a85e977173.data +++ /dev/null @@ -1,4 +0,0 @@ -5 -" ׾F_uؔlzS?|ڲPc@ js-ipfs-repo - - \ No newline at end of file diff --git a/test/repo-tests1457120896998/blocks/12203628/12203628a4a19525dd84bbbffe132ec0b0d3be3528fbbcc814feb7f2fbf71ca06162.data b/test/repo-tests1457120896998/blocks/12203628/12203628a4a19525dd84bbbffe132ec0b0d3be3528fbbcc814feb7f2fbf71ca06162.data deleted file mode 100644 index bbe6bda7..00000000 Binary files a/test/repo-tests1457120896998/blocks/12203628/12203628a4a19525dd84bbbffe132ec0b0d3be3528fbbcc814feb7f2fbf71ca06162.data and /dev/null differ diff --git a/test/repo-tests1457120896998/blocks/12204a5a/12204a5a95586f52e25811cf214677160e64383755a8c5163ba3c053c3b65777ed16.data b/test/repo-tests1457120896998/blocks/12204a5a/12204a5a95586f52e25811cf214677160e64383755a8c5163ba3c053c3b65777ed16.data deleted file mode 100644 index 41456196..00000000 --- a/test/repo-tests1457120896998/blocks/12204a5a/12204a5a95586f52e25811cf214677160e64383755a8c5163ba3c053c3b65777ed16.data +++ /dev/null @@ -1,4 +0,0 @@ - -ys# js-ipfs-repo -Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript -s \ No newline at end of file diff --git a/test/repo-tests1457120896998/blocks/12205200/12205200cc6b6f79e1588480d9f9016ccadfda3d8bc7d2f8cdf302aa51dae8dae9da.data b/test/repo-tests1457120896998/blocks/12205200/12205200cc6b6f79e1588480d9f9016ccadfda3d8bc7d2f8cdf302aa51dae8dae9da.data deleted file mode 100644 index 10aa2ae4..00000000 Binary files a/test/repo-tests1457120896998/blocks/12205200/12205200cc6b6f79e1588480d9f9016ccadfda3d8bc7d2f8cdf302aa51dae8dae9da.data and /dev/null differ diff --git a/test/repo-tests1457120896998/blocks/122052c6/122052c63c7775396b3f82c639977a7223c2d96a9f70b5fd8b1d513f8c5b69dcaed4.data b/test/repo-tests1457120896998/blocks/122052c6/122052c63c7775396b3f82c639977a7223c2d96a9f70b5fd8b1d513f8c5b69dcaed4.data deleted file mode 100644 index 951bfe04..00000000 --- a/test/repo-tests1457120896998/blocks/122052c6/122052c63c7775396b3f82c639977a7223c2d96a9f70b5fd8b1d513f8c5b69dcaed4.data +++ /dev/null @@ -1,23 +0,0 @@ - - IPFS Alpha Security Notes - -We try hard to ensure our system is safe and robust, but all software -has bugs, especially new software. This distribution is meant to be an -alpha preview, don't use it for anything mission critical. - -Please note the following: - -- This is alpha software and has not been audited. It is our goal - to conduct a proper security audit once we close in on a 1.0 release. - -- ipfs is a networked program, and may have serious undiscovered - vulnerabilities. It is written in Go, and we do not execute any - user provided data. But please point any problems out to us in a - github issue, or email security@ipfs.io privately. - -- ipfs uses encryption for all communication, but it's NOT PROVEN SECURE - YET! It may be totally broken. For now, the code is included to make - sure we benchmark our operations with encryption in mind. In the future, - there will be an "unsafe" mode for high performance intranet apps. - If this is a blocking feature for you, please contact us. - \ No newline at end of file diff --git a/test/repo-tests1457120896998/blocks/12205994/122059948439065f29619ef41280cbb932be52c56d99c5966b65e0111239f098bbef.data b/test/repo-tests1457120896998/blocks/12205994/122059948439065f29619ef41280cbb932be52c56d99c5966b65e0111239f098bbef.data deleted file mode 100644 index 9553a942..00000000 --- a/test/repo-tests1457120896998/blocks/12205994/122059948439065f29619ef41280cbb932be52c56d99c5966b65e0111239f098bbef.data +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/test/repo-tests1457120896998/blocks/122062ce/122062ce1f2c91a13a97b596e873b5a3346a644605d7614dca53cd3a59f7385a8abb.data b/test/repo-tests1457120896998/blocks/122062ce/122062ce1f2c91a13a97b596e873b5a3346a644605d7614dca53cd3a59f7385a8abb.data deleted file mode 100644 index 2dd80560..00000000 --- a/test/repo-tests1457120896998/blocks/122062ce/122062ce1f2c91a13a97b596e873b5a3346a644605d7614dca53cd3a59f7385a8abb.data +++ /dev/null @@ -1,114 +0,0 @@ - -  # 0.1 - Quick Start - -This is a set of short examples with minimal explanation. It is meant as -a "quick start". Soon, we'll write a longer tour :-) - - -Add a file to ipfs: - - echo "hello world" >hello - ipfs add hello - - -View it: - - ipfs cat - - -Try a directory: - - mkdir foo - mkdir foo/bar - echo "baz" > foo/baz - echo "baz" > foo/bar/baz - ipfs add -r foo - - -View things: - - ipfs ls - ipfs ls /bar - ipfs cat /baz - ipfs cat /bar/baz - ipfs cat /bar - ipfs ls /baz - - -References: - - ipfs refs - ipfs refs -r - ipfs refs --help - - -Get: - - ipfs get foo2 - diff foo foo2 - - -Objects: - - ipfs object get - ipfs object get /foo2 - ipfs object --help - - -Pin + GC: - - ipfs pin -r - ipfs gc - ipfs ls - ipfs unpin -r - ipfs gc - - -Daemon: - - ipfs daemon (in another terminal) - ipfs id - - -Network: - - (must be online) - ipfs swarm peers - ipfs id - ipfs cat - - -Mount: - - (warning: fuse is finicky!) - ipfs mount - cd /ipfs/< - - -Tool: - - ipfs version - ipfs update - ipfs commands - ipfs config --help - open http://localhost:5001/webui - - -Browse: - - webui: - - http://localhost:5001/webui - - video: - - http://localhost:8080/ipfs/QmVc6zuAneKJzicnJpfrqCH9gSy6bz54JhcypfJYhGUFQu/play#/ipfs/QmTKZgRNwDNZwHtJSjCp6r5FYefzpULfy37JvMt9DwvXse - - images: - - http://localhost:8080/ipfs/QmZpc3HvfjEXvLWGQPWbHk3AjD5j8NEN4gmFN8Jmrd5g83/cs - - markdown renderer app: - - http://localhost:8080/ipfs/QmX7M9CiYXjVeFnkfVGf3y5ixTZ2ACeSGyL1vBJY1HvQPp/mdown - \ No newline at end of file diff --git a/test/repo-tests1457120896998/blocks/12206781/122067817186b8ff365c758f387e3ae7f28fa9367ee167c312e6d65a2e02e81ab815.data b/test/repo-tests1457120896998/blocks/12206781/122067817186b8ff365c758f387e3ae7f28fa9367ee167c312e6d65a2e02e81ab815.data deleted file mode 100644 index a8f98693..00000000 Binary files a/test/repo-tests1457120896998/blocks/12206781/122067817186b8ff365c758f387e3ae7f28fa9367ee167c312e6d65a2e02e81ab815.data and /dev/null differ diff --git a/test/repo-tests1457120896998/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data b/test/repo-tests1457120896998/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data deleted file mode 100644 index 74de75af..00000000 Binary files a/test/repo-tests1457120896998/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data and /dev/null differ diff --git a/test/repo-tests1457120896998/blocks/1220709b/1220709b2dcc5f6a90ad64d6fe3a5d202a72b057d1c7f2e682d0776a5363e2cca974.data b/test/repo-tests1457120896998/blocks/1220709b/1220709b2dcc5f6a90ad64d6fe3a5d202a72b057d1c7f2e682d0776a5363e2cca974.data deleted file mode 100644 index 3a99c365..00000000 --- a/test/repo-tests1457120896998/blocks/1220709b/1220709b2dcc5f6a90ad64d6fe3a5d202a72b057d1c7f2e682d0776a5363e2cca974.data +++ /dev/null @@ -1,3 +0,0 @@ -4 -" Y9_)a˹2RmŖke9 js-ipfs-repo - \ No newline at end of file diff --git a/test/repo-tests1457120896998/blocks/12207fb8/12207fb898b5d7be46d85feb75d894e16cfa9a7ae5533f8e997cdab2ebadd7506340.data b/test/repo-tests1457120896998/blocks/12207fb8/12207fb898b5d7be46d85feb75d894e16cfa9a7ae5533f8e997cdab2ebadd7506340.data deleted file mode 100644 index ee87b9db..00000000 --- a/test/repo-tests1457120896998/blocks/12207fb8/12207fb898b5d7be46d85feb75d894e16cfa9a7ae5533f8e997cdab2ebadd7506340.data +++ /dev/null @@ -1,4 +0,0 @@ -0 -" ,Qv3k>\IzxEElM/fLICENSE1 -" JZXoRX!Fwd87U;SöWw README.md{ - \ No newline at end of file diff --git a/test/repo-tests1457120896998/blocks/12208b87/12208b872ca4ee517608331696dd6b3e5cf3497a7845ee8f94456ccf4d1d2f6602b5.data b/test/repo-tests1457120896998/blocks/12208b87/12208b872ca4ee517608331696dd6b3e5cf3497a7845ee8f94456ccf4d1d2f6602b5.data deleted file mode 100644 index 3da92595..00000000 --- a/test/repo-tests1457120896998/blocks/12208b87/12208b872ca4ee517608331696dd6b3e5cf3497a7845ee8f94456ccf4d1d2f6602b5.data +++ /dev/null @@ -1,24 +0,0 @@ - -The MIT License (MIT) - -Copyright (c) 2015 IPFS - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - - \ No newline at end of file diff --git a/test/repo-tests1457120896998/blocks/122090c0/122090c07a7795c1193510a696d1fdfc0f1e4947cff8e422610996e609dbcb976598.data b/test/repo-tests1457120896998/blocks/122090c0/122090c07a7795c1193510a696d1fdfc0f1e4947cff8e422610996e609dbcb976598.data deleted file mode 100644 index 71be805f..00000000 --- a/test/repo-tests1457120896998/blocks/122090c0/122090c07a7795c1193510a696d1fdfc0f1e4947cff8e422610996e609dbcb976598.data +++ /dev/null @@ -1,9 +0,0 @@ - -Some helpful resources for finding your way around ipfs: - -- quick-start: a quick show of various ipfs features. -- ipfs commands: a list of all commands -- ipfs --help: every command describes itself -- https://github.com/ipfs/go-ipfs -- the src repository -- #ipfs on irc.freenode.org -- the community irc channel - \ No newline at end of file diff --git a/test/repo-tests1457120896998/blocks/1220929a/1220929a303c39da8a0b67c09697462f687a00c638bcb580feae06452e0c1f20b4.data b/test/repo-tests1457120896998/blocks/1220929a/1220929a303c39da8a0b67c09697462f687a00c638bcb580feae06452e0c1f20b4.data deleted file mode 100644 index 62d1c297..00000000 --- a/test/repo-tests1457120896998/blocks/1220929a/1220929a303c39da8a0b67c09697462f687a00c638bcb580feae06452e0c1f20b4.data +++ /dev/null @@ -1,8 +0,0 @@ - -Come hang out in our IRC chat room if you have any questions. - -Contact the ipfs dev team: -- Bugs: https://github.com/ipfs/go-ipfs/issues -- Help: irc.freenode.org/#ipfs -- Email: dev@ipfs.io - \ No newline at end of file diff --git a/test/repo-tests1457120896998/blocks/1220933b/1220933b41d37fd4508cdff45930dff56baef91c7dc345e73d049ab570abe10dfbb9.data b/test/repo-tests1457120896998/blocks/1220933b/1220933b41d37fd4508cdff45930dff56baef91c7dc345e73d049ab570abe10dfbb9.data deleted file mode 100644 index d899663b..00000000 Binary files a/test/repo-tests1457120896998/blocks/1220933b/1220933b41d37fd4508cdff45930dff56baef91c7dc345e73d049ab570abe10dfbb9.data and /dev/null differ diff --git a/test/repo-tests1457120896998/blocks/1220a52c/1220a52c3602030cb912edfe4de97002fdadf9d45666c3be122a2efb5db93c1d5fa6.data b/test/repo-tests1457120896998/blocks/1220a52c/1220a52c3602030cb912edfe4de97002fdadf9d45666c3be122a2efb5db93c1d5fa6.data deleted file mode 100644 index 627ffcdf..00000000 --- a/test/repo-tests1457120896998/blocks/1220a52c/1220a52c3602030cb912edfe4de97002fdadf9d45666c3be122a2efb5db93c1d5fa6.data +++ /dev/null @@ -1,55 +0,0 @@ - -  - IPFS -- Inter-Planetary File system - -IPFS is a global, versioned, peer-to-peer filesystem. It combines good ideas -from Git, BitTorrent, Kademlia, SFS, and the Web. It is like a single bit- -torrent swarm, exchanging git objects. IPFS provides an interface as simple -as the HTTP web, but with permanence built in. You can also mount the world -at /ipfs. - -IPFS is a protocol: -- defines a content-addressed file system -- coordinates content delivery -- combines Kademlia + BitTorrent + Git - -IPFS is a filesystem: -- has directories and files -- mountable filesystem (via FUSE) - -IPFS is a web: -- can be used to view documents like the web -- files accessible via HTTP at `http://ipfs.io/` -- browsers or extensions can learn to use `ipfs://` directly -- hash-addressed content guarantees authenticity - -IPFS is modular: -- connection layer over any network protocol -- routing layer -- uses a routing layer DHT (kademlia/coral) -- uses a path-based naming service -- uses bittorrent-inspired block exchange - -IPFS uses crypto: -- cryptographic-hash content addressing -- block-level deduplication -- file integrity + versioning -- filesystem-level encryption + signing support - -IPFS is p2p: -- worldwide peer-to-peer file transfers -- completely decentralized architecture -- **no** central point of failure - -IPFS is a cdn: -- add a file to the filesystem locally, and it's now available to the world -- caching-friendly (content-hash naming) -- bittorrent-based bandwidth distribution - -IPFS has a name service: -- IPNS, an SFS inspired name system -- global namespace based on PKI -- serves to build trust chains -- compatible with other NSes -- can map DNS, .onion, .bit, etc to IPNS - \ No newline at end of file diff --git a/test/repo-tests1457120896998/blocks/1220c0fc/1220c0fc6b49543d7bf04e83d2a5a7cbe72a83e80f9c7bca1abcaa42298a57a33ff5.data b/test/repo-tests1457120896998/blocks/1220c0fc/1220c0fc6b49543d7bf04e83d2a5a7cbe72a83e80f9c7bca1abcaa42298a57a33ff5.data deleted file mode 100644 index c9885c45..00000000 Binary files a/test/repo-tests1457120896998/blocks/1220c0fc/1220c0fc6b49543d7bf04e83d2a5a7cbe72a83e80f9c7bca1abcaa42298a57a33ff5.data and /dev/null differ diff --git a/test/repo-tests1457120896998/blocks/1220e3b0/1220e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.data b/test/repo-tests1457120896998/blocks/1220e3b0/1220e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.data deleted file mode 100644 index e69de29b..00000000 diff --git a/test/repo-tests1457120896998/blocks/1220e605/1220e605408ac3f78113ac9a7fd486441317afc9f967abe2aa05e7c641f7bbe98a37.data b/test/repo-tests1457120896998/blocks/1220e605/1220e605408ac3f78113ac9a7fd486441317afc9f967abe2aa05e7c641f7bbe98a37.data deleted file mode 100644 index b6539897..00000000 Binary files a/test/repo-tests1457120896998/blocks/1220e605/1220e605408ac3f78113ac9a7fd486441317afc9f967abe2aa05e7c641f7bbe98a37.data and /dev/null differ diff --git a/test/repo-tests1457120896998/blocks/1220e6a0/1220e6a045864ff8569e43e4866c0af807def07b0db2f018808620eb30b980e94011.data b/test/repo-tests1457120896998/blocks/1220e6a0/1220e6a045864ff8569e43e4866c0af807def07b0db2f018808620eb30b980e94011.data deleted file mode 100644 index 6860441a..00000000 --- a/test/repo-tests1457120896998/blocks/1220e6a0/1220e6a045864ff8569e43e4866c0af807def07b0db2f018808620eb30b980e94011.data +++ /dev/null @@ -1,3 +0,0 @@ -/ -" gq6\u8~:6~gZ.directT2 -" 6(%݄.Ӿ5(ab recursiveT \ No newline at end of file diff --git a/test/repo-tests1457120896998/blocks/1220ec5b/1220ec5b533a3218991f4377b8b8c2538b95dd29d31eac6433af0fb6fcd83dd80778.data b/test/repo-tests1457120896998/blocks/1220ec5b/1220ec5b533a3218991f4377b8b8c2538b95dd29d31eac6433af0fb6fcd83dd80778.data deleted file mode 100644 index 7b58d6c8..00000000 --- a/test/repo-tests1457120896998/blocks/1220ec5b/1220ec5b533a3218991f4377b8b8c2538b95dd29d31eac6433af0fb6fcd83dd80778.data +++ /dev/null @@ -1,3 +0,0 @@ -/ -" @ԆDgA7directT2 -" ;APY0k}E=p  recursiveT \ No newline at end of file diff --git a/test/repo-tests1457120896998/config b/test/repo-tests1457120896998/config deleted file mode 100644 index cbcdfe3b..00000000 --- a/test/repo-tests1457120896998/config +++ /dev/null @@ -1 +0,0 @@ -{"Identity":{"PeerID":"QmQ2zigjQikYnyYUSXZydNXrDRhBut2mubwJBaLXobMt3A","PrivKey":"CAASpgkwggSiAgEAAoIBAQC2SKo/HMFZeBml1AF3XijzrxrfQXdJzjePBZAbdxqKR1Mc6juRHXij6HXYPjlAk01BhF1S3Ll4Lwi0cAHhggf457sMg55UWyeGKeUv0ucgvCpBwlR5cQ020i0MgzjPWOLWq1rtvSbNcAi2ZEVn6+Q2EcHo3wUvWRtLeKz+DZSZfw2PEDC+DGPJPl7f8g7zl56YymmmzH9liZLNrzg/qidokUv5u1pdGrcpLuPNeTODk0cqKB+OUbuKj9GShYECCEjaybJDl9276oalL9ghBtSeEv20kugatTvYy590wFlJkkvyl+nPxIH0EEYMKK9XRWlu9XYnoSfboiwcv8M3SlsjAgMBAAECggEAZtju/bcKvKFPz0mkHiaJcpycy9STKphorpCT83srBVQi59CdFU6Mj+aL/xt0kCPMVigJw8P3/YCEJ9J+rS8BsoWE+xWUEsJvtXoT7vzPHaAtM3ci1HZd302Mz1+GgS8Epdx+7F5p80XAFLDUnELzOzKftvWGZmWfSeDnslwVONkL/1VAzwKy7Ce6hk4SxRE7l2NE2OklSHOzCGU1f78ZzVYKSnS5Ag9YrGjOAmTOXDbKNKN/qIorAQ1bovzGoCwx3iGIatQKFOxyVCyO1PsJYT7JO+kZbhBWRRE+L7l+ppPER9bdLFxs1t5CrKc078h+wuUr05S1P1JjXk68pk3+kQKBgQDeK8AR11373Mzib6uzpjGzgNRMzdYNuExWjxyxAzz53NAR7zrPHvXvfIqjDScLJ4NcRO2TddhXAfZoOPVH5k4PJHKLBPKuXZpWlookCAyENY7+Pd55S8r+a+MusrMagYNljb5WbVTgN8cgdpim9lbbIFlpN6SZaVjLQL3J8TWH6wKBgQDSChzItkqWX11CNstJ9zJyUE20I7LrpyBJNgG1gtvz3ZMUQCn3PxxHtQzN9n1P0mSSYs+jBKPuoSyYLt1wwe10/lpgL4rkKWU3/m1Myt0tveJ9WcqHh6tzcAbb/fXpUFT/o4SWDimWkPkuCb+8j//2yiXk0a/T2f36zKMuZvujqQKBgC6B7BAQDG2H2B/ijofp12ejJU36nL98gAZyqOfpLJ+FeMz4TlBDQ+phIMhnHXA5UkdDapQ+zA3SrFk+6yGk9Vw4Hf46B+82SvOrSbmnMa+PYqKYIvUzR4gg34rL/7AhwnbEyD5hXq4dHwMNsIDq+l2elPjwm/U9V0gdAl2+r50HAoGALtsKqMvhv8HucAMBPrLikhXP/8um8mMKFMrzfqZ+otxfHzlhI0L08Bo3jQrb0Z7ByNY6M8epOmbCKADsbWcVre/AAY0ZkuSZK/CaOXNX/AhMKmKJh8qAOPRY02LIJRBCpfS4czEdnfUhYV/TYiFNnKRj57PPYZdTzUsxa/yVTmECgYBr7slQEjb5Onn5mZnGDh+72BxLNdgwBkhO0OCdpdISqk0F0Pxby22DFOKXZEpiyI9XYP1C8wPiJsShGm2yEwBPWXnrrZNWczaVuCbXHrZkWQogBDG3HGXNdU4MAWCyiYlyinIBpPpoAJZSzpGLmWbMWh28+RJS6AQX6KHrK1o2uw=="},"Datastore":{"Type":"","Path":"","StorageMax":"","StorageGCWatermark":0,"GCPeriod":"","Params":null,"NoSync":false},"Addresses":{"Swarm":["/ip4/0.0.0.0/tcp/4001","/ip6/::/tcp/4001"],"API":"/ip4/127.0.0.1/tcp/5001","Gateway":"/ip4/127.0.0.1/tcp/8080"},"Mounts":{"IPFS":"/ipfs","IPNS":"/ipns","FuseAllowOther":false},"Version":{"Current":"0.4.0-dev","Check":"error","CheckDate":"0001-01-01T00:00:00Z","CheckPeriod":"172800000000000","AutoUpdate":"minor"},"Discovery":{"MDNS":{"Enabled":true,"Interval":10}},"Ipns":{"RepublishPeriod":"","RecordLifetime":"","ResolveCacheSize":128},"Bootstrap":["/ip4/104.131.131.82/tcp/4001/ipfs/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ","/ip4/104.236.176.52/tcp/4001/ipfs/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z","/ip4/104.236.179.241/tcp/4001/ipfs/QmSoLPppuBtQSGwKDZT2M73ULpjvfd3aZ6ha4oFGL1KrGM","/ip4/162.243.248.213/tcp/4001/ipfs/QmSoLueR4xBeUbY9WZ9xGUUxunbKWcrNFTDAadQJmocnWm","/ip4/128.199.219.111/tcp/4001/ipfs/QmSoLSafTMBsPKadTEgaXctDQVcqN88CNLHXMkTNwMKPnu","/ip4/104.236.76.40/tcp/4001/ipfs/QmSoLV4Bbm51jM9C4gDYZQ9Cy3U6aXMJDAbzgu2fzaDs64","/ip4/178.62.158.247/tcp/4001/ipfs/QmSoLer265NRgSp2LA3dPaeykiS1J6DifTC88f5uVQKNAd","/ip4/178.62.61.185/tcp/4001/ipfs/QmSoLMeWqB7YGVLJN3pNLQpmmEk35v6wYtsMGLzSr5QBU3","/ip4/104.236.151.122/tcp/4001/ipfs/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx"],"Tour":{"Last":""},"Gateway":{"HTTPHeaders":null,"RootRedirect":"","Writable":false},"SupernodeRouting":{"Servers":["/ip4/104.236.176.52/tcp/4002/ipfs/QmXdb7tWTxdFEQEFgWBqkuYSrZd3mXrC7HxkD4krGNYx2U","/ip4/104.236.179.241/tcp/4002/ipfs/QmVRqViDByUxjUMoPnjurjKvZhaEMFDtK35FJXHAM4Lkj6","/ip4/104.236.151.122/tcp/4002/ipfs/QmSZwGx8Tn8tmcM4PtDJaMeUQNRhNFdBLVGPzRiNaRJtFH","/ip4/162.243.248.213/tcp/4002/ipfs/QmbHVEEepCi7rn7VL7Exxpd2Ci9NNB6ifvqwhsrbRMgQFP","/ip4/128.199.219.111/tcp/4002/ipfs/Qmb3brdCYmKG1ycwqCbo6LUwWxTuo3FisnJV2yir7oN92R","/ip4/104.236.76.40/tcp/4002/ipfs/QmdRBCV8Cz2dGhoKLkD3YjPwVFECmqADQkx5ZteF2c6Fy4","/ip4/178.62.158.247/tcp/4002/ipfs/QmUdiMPci7YoEUBkyFZAh2pAbjqcPr7LezyiPD2artLw3v","/ip4/178.62.61.185/tcp/4002/ipfs/QmVw6fGNqBixZE4bewRLT2VXX7fAHUHs8JyidDiJ1P7RUN"]},"API":{"HTTPHeaders":null},"Swarm":{"AddrFilters":null},"Log":{"MaxSizeMB":250,"MaxBackups":1,"MaxAgeDays":0}} \ No newline at end of file diff --git a/test/repo-tests1457120896998/datastore/000002.ldb b/test/repo-tests1457120896998/datastore/000002.ldb deleted file mode 100644 index fc04d660..00000000 Binary files a/test/repo-tests1457120896998/datastore/000002.ldb and /dev/null differ diff --git a/test/repo-tests1457120896998/datastore/000005.ldb b/test/repo-tests1457120896998/datastore/000005.ldb deleted file mode 100644 index 63d9d260..00000000 Binary files a/test/repo-tests1457120896998/datastore/000005.ldb and /dev/null differ diff --git a/test/repo-tests1457120896998/datastore/CURRENT b/test/repo-tests1457120896998/datastore/CURRENT deleted file mode 100644 index 875cf233..00000000 --- a/test/repo-tests1457120896998/datastore/CURRENT +++ /dev/null @@ -1 +0,0 @@ -MANIFEST-000007 diff --git a/test/repo-tests1457120896998/datastore/LOCK b/test/repo-tests1457120896998/datastore/LOCK deleted file mode 100644 index e69de29b..00000000 diff --git a/test/repo-tests1457120896998/datastore/LOG b/test/repo-tests1457120896998/datastore/LOG deleted file mode 100644 index 863b68fd..00000000 --- a/test/repo-tests1457120896998/datastore/LOG +++ /dev/null @@ -1,10 +0,0 @@ -=============== Dec 10, 2015 (PST) =============== -07:50:02.056578 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed -07:50:02.057231 db@open opening -07:50:02.057312 journal@recovery F·1 -07:50:02.057514 journal@recovery recovering @3 -07:50:02.058921 mem@flush created L0@5 N·4 S·1KiB "/ip..\xf6\xe4\xa9,v5":"/pk..\xf6\xe4\xa9,v6" -07:50:02.059983 db@janitor F·4 G·0 -07:50:02.060001 db@open done T·2.755926ms -07:50:02.073183 db@close closing -07:50:02.073285 db@close done T·97.522µs diff --git a/test/repo-tests1457120896998/datastore/LOG.old b/test/repo-tests1457120896998/datastore/LOG.old deleted file mode 100644 index 708351e7..00000000 --- a/test/repo-tests1457120896998/datastore/LOG.old +++ /dev/null @@ -1,10 +0,0 @@ -=============== Dec 10, 2015 (PST) =============== -07:49:57.048841 log@legend F·NumFile S·FileSize N·Entry C·BadEntry B·BadBlock Ke·KeyError D·DroppedEntry L·Level Q·SeqNum T·TimeElapsed -07:49:57.049014 db@open opening -07:49:57.049066 journal@recovery F·1 -07:49:57.049233 journal@recovery recovering @1 -07:49:57.049693 mem@flush created L0@2 N·2 S·211B "/lo..oot,v2":"/lo..ins,v1" -07:49:57.050381 db@janitor F·3 G·0 -07:49:57.050397 db@open done T·1.375431ms -07:49:57.064580 db@close closing -07:49:57.064655 db@close done T·72.59µs diff --git a/test/repo-tests1457120896998/datastore/MANIFEST-000007 b/test/repo-tests1457120896998/datastore/MANIFEST-000007 deleted file mode 100644 index 6af3b545..00000000 Binary files a/test/repo-tests1457120896998/datastore/MANIFEST-000007 and /dev/null differ diff --git a/test/repo-tests1457120896998/version b/test/repo-tests1457120896998/version deleted file mode 100644 index 00750edc..00000000 --- a/test/repo-tests1457120896998/version +++ /dev/null @@ -1 +0,0 @@ -3 diff --git a/test/test-data/ipfsmarket-1.ogv b/test/test-data/ipfsmarket-1.ogv new file mode 100644 index 00000000..55e83f48 Binary files /dev/null and b/test/test-data/ipfsmarket-1.ogv differ diff --git a/test/test-data/test-video.ogv b/test/test-data/test-video.ogv new file mode 100644 index 00000000..55e83f48 Binary files /dev/null and b/test/test-data/test-video.ogv differ diff --git a/test/test-import.js b/test/test-import.js index 6efd93bc..d98d2e16 100644 --- a/test/test-import.js +++ b/test/test-import.js @@ -13,6 +13,8 @@ const fs = require('fs') const UnixFS = require('ipfs-unixfs') const path = require('path') +let ds + describe('layout: importer', function () { const big = path.join(__dirname, '/test-data/1.2MiB.txt') const small = path.join(__dirname, '/test-data/200Bytes.txt') @@ -33,8 +35,6 @@ describe('layout: importer', function () { } }) - let ds - it('start dag service', function (done) { const options = { stores: { @@ -262,19 +262,69 @@ describe('layout: importer', function () { }) }) - // TODO, make this work with small files it.skip('import from a readable stream', (done) => { }) +}) - it.skip('export a file by hash', (done) => { - // TODO Create tests and function for exporting data +describe('layout: exporter', function () { + it('export a file with no links', (done) => { + const hash = 'QmQmZQxSKQppbsWfVzBvg59Cn3DKtsNVQ94bjAxg2h3Lb8' + const testExport = importer.export(hash, ds) + testExport.on('file', (data) => { + ds.get(hash, (err, fetchedNode) => { + expect(err).to.not.exist + const unmarsh = UnixFS.unmarshal(fetchedNode.data) + expect(unmarsh.data).to.deep.equal(data.stream._readableState.buffer[0]) + done() + }) + }) + }) + + it('export a small file with links', (done) => { const hash = 'QmW7BDxEbGqxxSYVtn3peNPQgdDXbWkoQ6J1EFYAEuQV3Q' - importer.export({ - hash: hash, - dagService: ds - }, function (err, file) { - console.log(err) - done() + const testExport = importer.export(hash, ds) + testExport.on('file', (data) => { + var ws = fs.createWriteStream(path.join(process.cwd(), '/test', data.path)) + data.stream.pipe(ws) + data.stream.on('end', () => { + const stats = fs.existsSync(path.join(process.cwd(), '/test', data.path)) + expect(stats).to.equal(true) + fs.unlinkSync(path.join(process.cwd(), '/test', data.path)) + done() + }) + }) + }) + + it('export a large file > 5mb', (done) => { + const hash = 'QmRQgufjp9vLE8XK2LGKZSsPCFCF6e4iynCQtNB5X2HBKE' + const testExport = importer.export(hash, ds) + testExport.on('file', (data) => { + var ws = fs.createWriteStream(path.join(process.cwd(), '/test', data.path)) + data.stream.pipe(ws) + data.stream.on('end', () => { + const stats = fs.existsSync(path.join(process.cwd(), '/test', data.path)) + expect(stats).to.equal(true) + fs.unlinkSync(path.join(process.cwd(), '/test', data.path)) + done() + }) + }) + }) + + it('export a directory', (done) => { + const hash = 'QmWChcSFMNcFkfeJtNd8Yru1rE6PhtCRfewi1tMwjkwKjN' + var testExport = importer.export(hash, ds) + var fs = [] + var x = 0 + testExport.on('file', (data) => { + fs.push(data) + x++ + if (x === 4) { + expect(fs[0].path).to.equal('QmWChcSFMNcFkfeJtNd8Yru1rE6PhtCRfewi1tMwjkwKjN/200Bytes.txt') + expect(fs[1].path).to.equal('QmWChcSFMNcFkfeJtNd8Yru1rE6PhtCRfewi1tMwjkwKjN/dir-another') + expect(fs[2].path).to.equal('QmWChcSFMNcFkfeJtNd8Yru1rE6PhtCRfewi1tMwjkwKjN/level-1/200Bytes.txt') + expect(fs[3].path).to.equal('QmWChcSFMNcFkfeJtNd8Yru1rE6PhtCRfewi1tMwjkwKjN/level-1/level-2') + done() + } }) }) })