From 64d79b2e68d0e4079822810132d7b358bb93a215 Mon Sep 17 00:00:00 2001 From: Victor Bjelkholm Date: Sun, 29 Jan 2017 10:00:02 +0100 Subject: [PATCH 1/8] Add failing get recursive test --- test/cli/test-files.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/cli/test-files.js b/test/cli/test-files.js index 2f5510c026..ec287ce9bf 100644 --- a/test/cli/test-files.js +++ b/test/cli/test-files.js @@ -89,5 +89,13 @@ describe('files', () => { ].join('\n')) }) }) + + it('get recursively', () => { + return ipfs('files get QmUhUuiTKkkK8J6JZ9zmj8iNHPuNfGYcszgRumzhHBxEEU').then((out) => { + const directory = path.join(process.cwd(), 'QmUhUuiTKkkK8J6JZ9zmj8iNHPuNfGYcszgRumzhHBxEEU') + expect(fs.readdirSync(directory).length).to.be.eql(8) + // TODO add assertion on content of files + }) + }) }) }) From 52406ef9eaf853eb516c1cf3315379eb46ddc91a Mon Sep 17 00:00:00 2001 From: David Dias Date: Sun, 29 Jan 2017 17:29:20 +0000 Subject: [PATCH 2/8] chore: update deps --- package.json | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/package.json b/package.json index 144d09b021..440e9093e7 100644 --- a/package.json +++ b/package.json @@ -97,19 +97,19 @@ "hoek": "^4.1.0", "idb-pull-blob-store": "^0.5.1", "ipfs-api": "^12.1.4", - "ipfs-bitswap": "^0.9.0", + "ipfs-bitswap": "^0.9.2", "ipfs-block": "^0.5.4", - "ipfs-block-service": "^0.8.0", + "ipfs-block-service": "^0.8.1", "ipfs-multipart": "^0.1.0", "ipfs-repo": "^0.11.2", "ipfs-unixfs": "^0.1.9", - "ipfs-unixfs-engine": "^0.15.0", - "ipld-resolver": "^0.4.1", + "ipfs-unixfs-engine": "^0.15.1", + "ipld-resolver": "^0.4.2", "isstream": "^0.1.2", "libp2p-floodsub": "0.7.1", "joi": "^10.2.0", - "libp2p-ipfs-nodejs": "^0.17.8", - "libp2p-ipfs-browser": "^0.17.7", + "libp2p-ipfs-nodejs": "^0.17.9", + "libp2p-ipfs-browser": "^0.17.8", "lodash.flatmap": "^4.5.0", "lodash.get": "^4.4.2", "lodash.has": "^4.5.2", @@ -171,4 +171,4 @@ "nginnever ", "npmcdn-to-unpkg-bot " ] -} \ No newline at end of file +} From e25033cb7f4bc2db6c9031d49aa26663a5b84a34 Mon Sep 17 00:00:00 2001 From: David Dias Date: Mon, 30 Jan 2017 15:28:56 +0000 Subject: [PATCH 3/8] chore: update deps --- package.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 440e9093e7..01c37a01bb 100644 --- a/package.json +++ b/package.json @@ -103,8 +103,8 @@ "ipfs-multipart": "^0.1.0", "ipfs-repo": "^0.11.2", "ipfs-unixfs": "^0.1.9", - "ipfs-unixfs-engine": "^0.15.1", - "ipld-resolver": "^0.4.2", + "ipfs-unixfs-engine": "^0.15.2", + "ipld-resolver": "^0.4.3", "isstream": "^0.1.2", "libp2p-floodsub": "0.7.1", "joi": "^10.2.0", From bac0a096d8dde3bc3742f11fe3a59937a1aae0b7 Mon Sep 17 00:00:00 2001 From: Pedro Teixeira Date: Wed, 1 Feb 2017 11:16:21 +0000 Subject: [PATCH 4/8] fixed recursive get --- package.json | 6 +- src/cli/commands/files/get.js | 60 +++---- test/cli/test-files.js | 148 +++++++++++++----- ...JOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data | 28 ++++ ...WJNESD7XHQSXA5EGJVNTPVHD7444C2KLKXHDI.data | Bin 0 -> 10765 bytes ...LZHQZUR2R3GECRFV3WPKNL7PL2SKFIL2LXC4Y.data | 4 + ...774EZOYCYNHPRVFD53ZSAU7237F67XDSQGCYQ.data | Bin 0 -> 10807 bytes ...XCX5XMZLMGTYVODWPEDIW7JYEG7YXBIA7IUWY.data | 3 + ...5KVN6ALXC6QRHK2X4R6EUFRMBB5OSFO2FUYDQ.data | 3 + ...2DCW7R77FRIVHQ3V5OIPPS3XQBX34KRPNOIRQ.data | 3 + ...HSCRTXCYHGIOBXKWUMKFR3UPAFHQ5WK5362FQ.data | 4 + ...ANT6IBNTFN7WR5RPD5F6GN6MBKUUO25DNOTWQ.data | Bin 0 -> 10891 bytes ...DDTF32OIR4FWLKT5YLL7MLDVIT7DC3NHOK5VA.data | 23 +++ ...2BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data | 2 + ...LOQ45VUM2GUZCGAXLWCTOKKPGTUWPXHBNIVOY.data | 114 ++++++++++++++ ...HTQ7R247ZI7KJWP3QWPQYS43LFULQC5ANLQFI.data | Bin 0 -> 10765 bytes ...VXLWEU4FWPVGT24VJT7DUZPTNLF25N25IGGQA.data | 4 + ...YVY4BA22FPHUIODJEXS4LCTQDWA275XAJDAPI.data | Bin 0 -> 309 bytes ...LP4OS5EAVHFMCX2HD7FZUC2B3WUU3D4LGKS5A.data | 3 + ...D6VA64TGWP67KYA3AIMBUMVWGZ5AQN2L2HSWQ.data | Bin 0 -> 10765 bytes ...LJNXLLHZOPGSL2PBC65D4UIVWM6TI5F5TAFNI.data | 24 +++ ...NLTXZM4PW4VEFWQBJ4ACZQAS37BLGL4HUO5XY.data | Bin 0 -> 309 bytes ...TJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data | 9 ++ ...AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data | 8 + ...2FSMG76VV256I4PXBULZZ5ASNLK4FL4EG7XOI.data | Bin 0 -> 10849 bytes ...7E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ.data | 55 +++++++ ...RTG5JS3JCUJDQM2DRB5RVF33DCUUOFJNGVDUI.data | Bin 0 -> 10849 bytes ...EBXFD5QN6MTI5YBYMCVQJDXPKCOVR6RMLHZFQ.data | Bin 0 -> 10807 bytes ...B5FJNHZPTSVA7IB6OHXSQ2XSVEEKMKK6RT75I.data | Bin 0 -> 101 bytes ...57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data | 0 ...RYYVBUXHTS3SM5EORZDU63LYPEFUAFE4SBM4I.data | 115 ++++++++++++++ ...NH7VEGIQJRPL6J7FT2XYVKAXT4MQPXXPUYUNY.data | Bin 0 -> 10765 bytes ...SIM3AK7AD554D3BWZPAGEAQYQOWMFZQDUUAEI.data | 3 + ...33ROGCKOFZLXJJ2MPKYZBTV4H3N7GYHXMAO6A.data | 3 + ...YNRNMP2VDKWBWGAEDDEJDACM3SGG3VIANDDXI.data | Bin 0 -> 10765 bytes test/test-data/recursive-get-dir/config | 1 + .../recursive-get-dir/datastore/000002.ldb | Bin 0 -> 211 bytes .../recursive-get-dir/datastore/000005.ldb | Bin 0 -> 1120 bytes .../recursive-get-dir/datastore/000010.ldb | Bin 0 -> 1143 bytes .../recursive-get-dir/datastore/CURRENT | 1 + .../recursive-get-dir/datastore/LOCK | 0 .../test-data/recursive-get-dir/datastore/LOG | 29 ++++ .../recursive-get-dir/datastore/LOG.old | 10 ++ .../datastore/MANIFEST-000014 | Bin 0 -> 314 bytes .../recursive-get-dir/init-docs/about | 53 +++++++ .../recursive-get-dir/init-docs/contact | 6 + .../recursive-get-dir/init-docs/docs/index | 1 + .../recursive-get-dir/init-docs/help | 7 + .../recursive-get-dir/init-docs/quick-start | 113 +++++++++++++ .../recursive-get-dir/init-docs/readme | 26 +++ .../init-docs/security-notes | 21 +++ .../init-docs/tour/0.0-intro | 34 ++++ test/test-data/recursive-get-dir/version | 1 + 53 files changed, 839 insertions(+), 86 deletions(-) create mode 100644 test/test-data/recursive-get-dir/blocks/CIQBE/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQDD/CIQDDVW2EZIJF4NQH7WJNESD7XHQSXA5EGJVNTPVHD7444C2KLKXHDI.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQDD/CIQDDZ5EDQK5AP7LRTLZHQZUR2R3GECRFV3WPKNL7PL2SKFIL2LXC4Y.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQDM/CIQDMKFEUGKSLXMEXO774EZOYCYNHPRVFD53ZSAU7237F67XDSQGCYQ.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQDV/CIQDVKITASFS55MC2TXCX5XMZLMGTYVODWPEDIW7JYEG7YXBIA7IUWY.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQEN/CIQENVCICS44LLYUDQ5KVN6ALXC6QRHK2X4R6EUFRMBB5OSFO2FUYDQ.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQER/CIQERMRAAFXUAUOX3V2DCW7R77FRIVHQ3V5OIPPS3XQBX34KRPNOIRQ.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQEU/CIQEUWUVLBXVFYSYCHHSCRTXCYHGIOBXKWUMKFR3UPAFHQ5WK5362FQ.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQFE/CIQFEAGMNNXXTYKYQSANT6IBNTFN7WR5RPD5F6GN6MBKUUO25DNOTWQ.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQFF/CIQFFRR4O52TS2Z7QLDDTF32OIR4FWLKT5YLL7MLDVIT7DC3NHOK5VA.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQFT/CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQGF/CIQGFTQ7FSI2COUXWWLOQ45VUM2GUZCGAXLWCTOKKPGTUWPXHBNIVOY.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQGP/CIQGPALRQ24P6NS4OWHTQ7R247ZI7KJWP3QWPQYS43LFULQC5ANLQFI.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQH7/CIQH7OEYWXL34RWYL7VXLWEU4FWPVGT24VJT7DUZPTNLF25N25IGGQA.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQHA/CIQHAKDLTL5GMIFGN5YVY4BA22FPHUIODJEXS4LCTQDWA275XAJDAPI.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQHB/CIQHBGZNZRPWVEFNMTLP4OS5EAVHFMCX2HD7FZUC2B3WUU3D4LGKS5A.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQHP/CIQHPUVCWD6JA6AFUVD6VA64TGWP67KYA3AIMBUMVWGZ5AQN2L2HSWQ.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQIX/CIQIXBZMUTXFC5QIGMLJNXLLHZOPGSL2PBC65D4UIVWM6TI5F5TAFNI.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQJ2/CIQJ23BL4UHXA2KTI6NLTXZM4PW4VEFWQBJ4ACZQAS37BLGL4HUO5XY.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQJB/CIQJBQD2O6K4CGJVCCTJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQJF/CIQJFGRQHQ45VCQLM7AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQJG/CIQJGO2B2N75IUEM372FSMG76VV256I4PXBULZZ5ASNLK4FL4EG7XOI.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQKK/CIQKKLBWAIBQZOIS5X7E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQLB/CIQLBK52T5EHVHZY5URTG5JS3JCUJDQM2DRB5RVF33DCUUOFJNGVDUI.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQLB/CIQLBS5HG4PRCRQ7O4EBXFD5QN6MTI5YBYMCVQJDXPKCOVR6RMLHZFQ.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQMB/CIQMB7DLJFKD267QJ2B5FJNHZPTSVA7IB6OHXSQ2XSVEEKMKK6RT75I.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQOH/CIQOHMGEIKMPYHAUTL57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQOL/CIQOLBQZSZAODJGGH6RYYVBUXHTS3SM5EORZDU63LYPEFUAFE4SBM4I.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQOM/CIQOMBKARLB7PAITVSNH7VEGIQJRPL6J7FT2XYVKAXT4MQPXXPUYUNY.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQON/CIQONICFQZH7QVU6IPSIM3AK7AD554D3BWZPAGEAQYQOWMFZQDUUAEI.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQOY/CIQOYW2THIZBRGI7IN33ROGCKOFZLXJJ2MPKYZBTV4H3N7GYHXMAO6A.data create mode 100644 test/test-data/recursive-get-dir/blocks/CIQPD/CIQPDQJBGYDZNMOAGGYNRNMP2VDKWBWGAEDDEJDACM3SGG3VIANDDXI.data create mode 100644 test/test-data/recursive-get-dir/config create mode 100644 test/test-data/recursive-get-dir/datastore/000002.ldb create mode 100644 test/test-data/recursive-get-dir/datastore/000005.ldb create mode 100644 test/test-data/recursive-get-dir/datastore/000010.ldb create mode 100644 test/test-data/recursive-get-dir/datastore/CURRENT create mode 100644 test/test-data/recursive-get-dir/datastore/LOCK create mode 100644 test/test-data/recursive-get-dir/datastore/LOG create mode 100644 test/test-data/recursive-get-dir/datastore/LOG.old create mode 100644 test/test-data/recursive-get-dir/datastore/MANIFEST-000014 create mode 100644 test/test-data/recursive-get-dir/init-docs/about create mode 100644 test/test-data/recursive-get-dir/init-docs/contact create mode 100644 test/test-data/recursive-get-dir/init-docs/docs/index create mode 100644 test/test-data/recursive-get-dir/init-docs/help create mode 100644 test/test-data/recursive-get-dir/init-docs/quick-start create mode 100644 test/test-data/recursive-get-dir/init-docs/readme create mode 100644 test/test-data/recursive-get-dir/init-docs/security-notes create mode 100644 test/test-data/recursive-get-dir/init-docs/tour/0.0-intro create mode 100644 test/test-data/recursive-get-dir/version diff --git a/package.json b/package.json index 2ec5e18ec6..7b3f92fb63 100644 --- a/package.json +++ b/package.json @@ -66,6 +66,7 @@ "chai": "^3.5.0", "delay": "^1.3.1", "detect-node": "^2.0.3", + "dir-compare": "^1.3.0", "eslint-plugin-react": "^6.9.0", "execa": "^0.6.0", "expose-loader": "^0.7.1", @@ -106,10 +107,10 @@ "ipfs-unixfs-engine": "^0.15.4", "ipld-resolver": "^0.4.3", "isstream": "^0.1.2", - "libp2p-floodsub": "0.7.2", "joi": "^10.2.0", - "libp2p-ipfs-nodejs": "^0.17.9", + "libp2p-floodsub": "0.7.2", "libp2p-ipfs-browser": "^0.17.8", + "libp2p-ipfs-nodejs": "^0.17.9", "lodash.flatmap": "^4.5.0", "lodash.get": "^4.4.2", "lodash.has": "^4.5.2", @@ -117,6 +118,7 @@ "lodash.sortby": "^4.7.0", "lodash.values": "^4.3.0", "mafmt": "^2.1.6", + "mkdirp": "^0.5.1", "multiaddr": "^2.2.0", "multihashes": "^0.3.2", "path-exists": "^3.0.0", diff --git a/src/cli/commands/files/get.js b/src/cli/commands/files/get.js index bc011ff68b..3acefb20d8 100644 --- a/src/cli/commands/files/get.js +++ b/src/cli/commands/files/get.js @@ -6,7 +6,7 @@ const log = debug('cli:files') log.error = debug('cli:files:error') var fs = require('fs') const path = require('path') -const pathExists = require('path-exists') +const mkdirp = require('mkdirp') const pull = require('pull-stream') const toPull = require('stream-to-pull-stream') @@ -23,53 +23,29 @@ function checkArgs (hash, outPath) { return outPath } -function ensureDir (dir, cb) { - pathExists(dir) - .then((exists) => { - if (!exists) { - fs.mkdir(dir, cb) - } else { - cb() - } - }) - .catch(cb) +function ensureDirFor (dir, file, callback) { + const lastSlash = file.path.lastIndexOf('/') + const filePath = file.path.substring(0, lastSlash + 1) + const dirPath = path.join(dir, filePath) + mkdirp(dirPath, callback) } function fileHandler (dir) { - return function onFile (file, cb) { - const lastSlash = file.path.lastIndexOf('/') - // Check to see if the result is in a directory - if (lastSlash === -1) { - const dirPath = path.join(dir, file.path) - // Check to see if the result is a directory - if (file.content) { - file.content.pipe(fs.createWriteStream(dirPath)) - .once('error', cb) - .once('end', cb) + return function onFile (file, callback) { + ensureDirFor(dir, file, (err) => { + if (err) { + callback(err) } else { - ensureDir(dirPath, cb) - } - } else { - const filePath = file.path.substring(0, lastSlash + 1) - const dirPath = path.join(dir, filePath) - - ensureDir(dirPath, (err) => { - if (err) { - return cb(err) - } - if (file.content) { - const filename = file.path.substring(lastSlash) - const target = path.join(dirPath, filename) - - file.content.pipe(fs.createWriteStream(target)) - .once('error', cb) - .once('end', cb) - return + file.content + .pipe(fs.createWriteStream(path.join(dir, file.path))) + .once('error', callback) + .once('finish', callback) + } else { + callback() } - cb() - }) - } + } + }) } } diff --git a/test/cli/test-files.js b/test/cli/test-files.js index 1563a69c8c..ac81eadfa4 100644 --- a/test/cli/test-files.js +++ b/test/cli/test-files.js @@ -5,6 +5,8 @@ const expect = require('chai').expect const repoPath = require('./index').repoPath const fs = require('fs') const path = require('path') +const compareDir = require('dir-compare').compareSync +const rimraf = require('rimraf').sync const describeOnlineAndOffline = require('../utils/on-and-off') const ipfs = require('../utils/ipfs-exec')(repoPath) @@ -35,7 +37,7 @@ describe('files', () => { 'hello world\n' ) - fs.unlinkSync(file) + rimraf(file) }) }) @@ -52,7 +54,7 @@ describe('files', () => { 'hello world\n' ) - fs.unlinkSync(file) + rimraf(file) }) }) @@ -72,51 +74,113 @@ describe('files', () => { }) }) - it('add recursively test 1', () => { - return ipfs('files add -r src/init-files/init-docs').then((out) => { + it('add recursively test', () => { + return ipfs('files add -r test/test-data/recursive-get-dir').then((out) => { expect(out).to.be.eql([ - 'added QmYE7xo6NxbHEVEHej1yzxijYaNY51BaeKxjXxn6Ssa6Bs init-docs/tour/0.0-intro', - 'added QmciSU8hfpAXKjvK5YLUSwApomGSWN5gFbP4EpDAEzu2Te init-docs/tour', - 'added QmTumTjvcYCAvRRwQ8sDRxh8ezmrcr88YFU7iYNroGGTBZ init-docs/security-notes', - 'added QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB init-docs/readme', - 'added QmdncfsVm2h5Kqq9hPmU7oAVX2zTSVP3L869tgTbPYnsha init-docs/quick-start', - 'added QmY5heUM5qgRubMDD1og9fhCPA6QdkMp3QCwd4s7gJsyE7 init-docs/help', - 'added QmQN88TEidd3RY2u3dpib49fERTDfKtDpvxnvczATNsfKT init-docs/docs/index', - 'added QmegvLXxpVKiZ4b57Xs1syfBVRd8CbucVHAp7KpLQdGieC init-docs/docs', - 'added QmYCvbfNbCwFR45HiNP45rwJgvatpiW38D961L5qAhUM5Y init-docs/contact', - 'added QmZTR5bcpQD7cFgTorqxZDYaew1Wqgfbd2ud9QqGPAkK2V init-docs/about', - 'added QmUhUuiTKkkK8J6JZ9zmj8iNHPuNfGYcszgRumzhHBxEEU init-docs' + 'added QmR56UJmAaZLXLdTT1ALrE9vVqV8soUEekm9BMd4FnuYqV recursive-get-dir/version', + 'added QmYE7xo6NxbHEVEHej1yzxijYaNY51BaeKxjXxn6Ssa6Bs recursive-get-dir/init-docs/tour/0.0-intro', + 'added QmciSU8hfpAXKjvK5YLUSwApomGSWN5gFbP4EpDAEzu2Te recursive-get-dir/init-docs/tour', + 'added QmTumTjvcYCAvRRwQ8sDRxh8ezmrcr88YFU7iYNroGGTBZ recursive-get-dir/init-docs/security-notes', + 'added QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB recursive-get-dir/init-docs/readme', + 'added QmdncfsVm2h5Kqq9hPmU7oAVX2zTSVP3L869tgTbPYnsha recursive-get-dir/init-docs/quick-start', + 'added QmY5heUM5qgRubMDD1og9fhCPA6QdkMp3QCwd4s7gJsyE7 recursive-get-dir/init-docs/help', + 'added QmQN88TEidd3RY2u3dpib49fERTDfKtDpvxnvczATNsfKT recursive-get-dir/init-docs/docs/index', + 'added QmegvLXxpVKiZ4b57Xs1syfBVRd8CbucVHAp7KpLQdGieC recursive-get-dir/init-docs/docs', + 'added QmYCvbfNbCwFR45HiNP45rwJgvatpiW38D961L5qAhUM5Y recursive-get-dir/init-docs/contact', + 'added QmZTR5bcpQD7cFgTorqxZDYaew1Wqgfbd2ud9QqGPAkK2V recursive-get-dir/init-docs/about', + 'added QmUhUuiTKkkK8J6JZ9zmj8iNHPuNfGYcszgRumzhHBxEEU recursive-get-dir/init-docs', + 'added QmeiTxVN4xAjxUzHzBqCpK3GaT3GeiLQeJRpYDXDfLeEmR recursive-get-dir/datastore/MANIFEST-000014', + 'added QmQpc75sJGUv59dAwHF7vazBGV9o6C7z587Dp9nv7HYAps recursive-get-dir/datastore/LOG.old', + 'added QmbFNLNr9at9eK5LrNyUdyE5cdLb5yaT9DkjXw7BK68kcM recursive-get-dir/datastore/LOG', + 'added QmfJMCvenrj4SKKRc48DYPxwVdS44qCUCqqtbqhJuSTWXP recursive-get-dir/datastore/LOCK', + 'added QmVJi93Yj5RW3NuqqxonGz3jAXUYHrdQvWrURxg1TiLEuX recursive-get-dir/datastore/CURRENT', + 'added QmcJ6TXPMPm6puSC9vpxuG57PyfGpr8bvTgkKU9SHHU5Uo recursive-get-dir/datastore/000010.ldb', + 'added QmPFVLPmp9zv5Z5KUqLhe2EivAGccQW2r7M7jhVJGLZoZU recursive-get-dir/datastore/000005.ldb', + 'added QmfExFwdFKspsY2q5WnhQjd1QDKnjpTQ4UkiHqqQxV7h67 recursive-get-dir/datastore/000002.ldb', + 'added Qma13ZrhKG52MWnwtZ6fMD8jGj8d4Q9sJgn5xtKgeZw5uz recursive-get-dir/datastore', + 'added QmPkWYfSLCEBLZu7BZt4kigGDMe3cpogMbeVf97gN2xJDN recursive-get-dir/config', + 'added QmbJgQa4XNBFvGQcLbWBNtvWZetbCUKiyAQNfePoTzwf9L recursive-get-dir/blocks/CIQPD/CIQPDQJBGYDZNMOAGGYNRNMP2VDKWBWGAEDDEJDACM3SGG3VIANDDXI.data', + 'added QmSCUPYy4CfFt9nA61J9v2DMfJygQAJjaUcRmygDbVME2D recursive-get-dir/blocks/CIQPD', + 'added QmTU72W5EAnNUAtnVW1qoFzdDD8FyiBjpF5MUzjBAFnHS6 recursive-get-dir/blocks/CIQOY/CIQOYW2THIZBRGI7IN33ROGCKOFZLXJJ2MPKYZBTV4H3N7GYHXMAO6A.data', + 'added QmQ1mNtPTJ6JG3TNNq73m2orvsfKCKrqMKoXyXwRKWM1ma recursive-get-dir/blocks/CIQOY', + 'added QmaTXag3TaaG6hFUXGxybEuMUk7UHSutZobZgDtjr6aXjf recursive-get-dir/blocks/CIQON/CIQONICFQZH7QVU6IPSIM3AK7AD554D3BWZPAGEAQYQOWMFZQDUUAEI.data', + 'added QmNi9kKnfKJGuofhBRKMdKj5R6BQAYHWRtu3vXJHRy69TE recursive-get-dir/blocks/CIQON', + 'added QmTH5Jc2uhu5LqGEFAgrn2HwoDHLpvQd9b6fyoUGi6aeQu recursive-get-dir/blocks/CIQOM/CIQOMBKARLB7PAITVSNH7VEGIQJRPL6J7FT2XYVKAXT4MQPXXPUYUNY.data', + 'added Qmec4atiyfysPR8HU5gPfjKY1NpQDY2kmSeeadx8wLEBqY recursive-get-dir/blocks/CIQOM', + 'added QmeBypQ2yE4t4Loybhby15DjkeLDXJKCcgMfxTXeFnHa8F recursive-get-dir/blocks/CIQOL/CIQOLBQZSZAODJGGH6RYYVBUXHTS3SM5EORZDU63LYPEFUAFE4SBM4I.data', + 'added Qmd6s8LXAEjW7y9QbGSzeuewrRBYjJHmcazG3Hk7cJ74da recursive-get-dir/blocks/CIQOL', + 'added QmfJMCvenrj4SKKRc48DYPxwVdS44qCUCqqtbqhJuSTWXP recursive-get-dir/blocks/CIQOH/CIQOHMGEIKMPYHAUTL57JSEZN64SIJ5OIHSGJG4TJSSJLGI3PBJLQVI.data', + 'added QmdiJnDhn4Bb1odByw1BA5qpXssjxgttVz42tpEfo7HNUe recursive-get-dir/blocks/CIQOH', + 'added Qmc1nasezDdPyZiXB5VB6Aygzswcr6QkauzzXMeUGouHTN recursive-get-dir/blocks/CIQMB/CIQMB7DLJFKD267QJ2B5FJNHZPTSVA7IB6OHXSQ2XSVEEKMKK6RT75I.data', + 'added QmeqJBkwmzsVR79HBKLW7AYhfAMxMaJs5dGHSgey5ezy7N recursive-get-dir/blocks/CIQMB', + 'added QmaSjzSSRanYzRGPXQY6m5SWfSkkfcnzNkurJEQc4chPJx recursive-get-dir/blocks/CIQLB/CIQLBS5HG4PRCRQ7O4EBXFD5QN6MTI5YBYMCVQJDXPKCOVR6RMLHZFQ.data', + 'added QmQ8ag7ysVyCMzJGFjxrUStwWtniQ69c7G9aezbmsKeNYD recursive-get-dir/blocks/CIQLB/CIQLBK52T5EHVHZY5URTG5JS3JCUJDQM2DRB5RVF33DCUUOFJNGVDUI.data', + 'added Qmbqod68qdYiEs7kkTGu7G59adekUbAFAAg7WEyM6iPP5z recursive-get-dir/blocks/CIQLB', + 'added Qmd4FKC6GcKnhJHnEJJwqg9A1eDd7JXKkG5v3iv9XSHtwq recursive-get-dir/blocks/CIQKK/CIQKKLBWAIBQZOIS5X7E32LQAL6236OUKZTMHPQSFIXPWXNZHQOV7JQ.data', + 'added QmUBsjP45UUHzKymAUqwEFJsuCvfC1AcaLvBgMsoGMipoG recursive-get-dir/blocks/CIQKK', + 'added QmWR1EuH5cui4EW5W16ADxzmYEFPjHDs1LcPe3uQL3CmiS recursive-get-dir/blocks/CIQJG/CIQJGO2B2N75IUEM372FSMG76VV256I4PXBULZZ5ASNLK4FL4EG7XOI.data', + 'added QmWrs7zVFkbpsTEbEpe3MyAB8ssUNp8jamE7i4PZ736zWy recursive-get-dir/blocks/CIQJG', + 'added QmWNXfkCTxSAuFBdNQ8gGmyxnZ28XrzRbjjmvCViLoNU5W recursive-get-dir/blocks/CIQJF/CIQJFGRQHQ45VCQLM7AJNF2GF5UHUAGGHC6LLAH6VYDEKLQMD4QLILY.data', + 'added QmWjsRHRK7ENAhMvgwfkze9bkySxjAsNMGXrMGMsFcrDWU recursive-get-dir/blocks/CIQJF', + 'added QmTt3mbtfVGEfqqjec9WZcWaC4SkesErDPAhhr8NRfsWFp recursive-get-dir/blocks/CIQJB/CIQJBQD2O6K4CGJVCCTJNUP57QHR4SKHZ74OIITBBGLOMCO3ZOLWLGA.data', + 'added QmQebEvyaFbez884asHoTrNsbck1JdMLcM8EhUFYCraGHZ recursive-get-dir/blocks/CIQJB', + 'added Qmb7AKKnZwLLFtseMZiHkq4fKNhP5rSggcvN2oGXUBZv8B recursive-get-dir/blocks/CIQJ2/CIQJ23BL4UHXA2KTI6NLTXZM4PW4VEFWQBJ4ACZQAS37BLGL4HUO5XY.data', + 'added QmT1zKYzUpt2kF8AEV2igH9hXwzGu4q8pc4uJ9BLWqjMhT recursive-get-dir/blocks/CIQJ2', + 'added QmazVLpyExfPkwASngrz3MDZD1pdaBUxj7VqAkjAFAWaa9 recursive-get-dir/blocks/CIQIX/CIQIXBZMUTXFC5QIGMLJNXLLHZOPGSL2PBC65D4UIVWM6TI5F5TAFNI.data', + 'added QmNM7hxdJfaApCJe1ubCrhAQSA6AWQXUvKZrHcf5RxsNvn recursive-get-dir/blocks/CIQIX', + 'added QmRfQcw4qrW91Vqj3evXiH11MuvRVJb7S7vKSgau7aBzRa recursive-get-dir/blocks/CIQHP/CIQHPUVCWD6JA6AFUVD6VA64TGWP67KYA3AIMBUMVWGZ5AQN2L2HSWQ.data', + 'added QmRsyLntZoGPWURqtemAmgRdtmuCjbbdZ5xzkCAEUhh4iU recursive-get-dir/blocks/CIQHP', + 'added QmU7mw6KaaAJA6tHi9FdiHu2HtA6rjb6e1aYuWscwTJ9yV recursive-get-dir/blocks/CIQHB/CIQHBGZNZRPWVEFNMTLP4OS5EAVHFMCX2HD7FZUC2B3WUU3D4LGKS5A.data', + 'added Qma1ytRhbzt3tGcJopMvd7g3ZE38mRKTTuJuRaHmguq8mN recursive-get-dir/blocks/CIQHB', + 'added QmVLdEzvgvM5k7NUWWSgURAZuJmiQBnbuZga3EpRip8xTu recursive-get-dir/blocks/CIQHA/CIQHAKDLTL5GMIFGN5YVY4BA22FPHUIODJEXS4LCTQDWA275XAJDAPI.data', + 'added QmddXWuKjfCbF6HXR9jStKDoLEAZ7xc8SZgDanQLMiGjpn recursive-get-dir/blocks/CIQHA', + 'added QmZe7irS2FotZtsUx9wpy5QPKJF6YEaAEZLHLUwQy6XgY8 recursive-get-dir/blocks/CIQH7/CIQH7OEYWXL34RWYL7VXLWEU4FWPVGT24VJT7DUZPTNLF25N25IGGQA.data', + 'added Qmb5NqTFar7MnxyRwwQtfb81nyS6g5NRG1bdo6AefmvhXU recursive-get-dir/blocks/CIQH7', + 'added QmWGima5TqLfUTzUsCF6h3oXGvwu3QQ1zjZYLDMaGeFRbB recursive-get-dir/blocks/CIQGP/CIQGPALRQ24P6NS4OWHTQ7R247ZI7KJWP3QWPQYS43LFULQC5ANLQFI.data', + 'added QmZMHzPS1qema8HvLk4jRuSLrUjRHZ8Siu6Wc4njAmx8MG recursive-get-dir/blocks/CIQGP', + 'added QmabxyrxY1uUzHcd7mTBCfibFwemGC89vuJFUw4UkebmSn recursive-get-dir/blocks/CIQGF/CIQGFTQ7FSI2COUXWWLOQ45VUM2GUZCGAXLWCTOKKPGTUWPXHBNIVOY.data', + 'added QmYLZ3uqYLkViS7Bh3vxcT5yrPscyWMV11iqFVJnqA7JVT recursive-get-dir/blocks/CIQGF', + 'added QmSMYdQtDTqykd7oLKZq3vJtS7KoWZwjL7GA9zj6UsCngE recursive-get-dir/blocks/CIQFT/CIQFTFEEHEDF6KLBT32BFAGLXEZL4UWFNWM4LFTLMXQBCERZ6CMLX3Y.data', + 'added QmWjMLA3ppmngQaHs8YEQ3Bru4tKoDeJh2cKv7U7dtLUuf recursive-get-dir/blocks/CIQFT', + 'added QmVdfEEiQmem5GanTjja7HKHNFpfa2LB8196fD9m9b656Q recursive-get-dir/blocks/CIQFF/CIQFFRR4O52TS2Z7QLDDTF32OIR4FWLKT5YLL7MLDVIT7DC3NHOK5VA.data', + 'added QmUcLzGWDuBPA6iVF65n676KiCbQNXV4owecfSR4QFVy3U recursive-get-dir/blocks/CIQFF', + 'added QmNtkNt8oZASY7AYVpswA3RQ43hASjP1NGj8GB1L6vgHUx recursive-get-dir/blocks/CIQFE/CIQFEAGMNNXXTYKYQSANT6IBNTFN7WR5RPD5F6GN6MBKUUO25DNOTWQ.data', + 'added QmXrrAYhbThjuHRPA23HujCLFbTrnwd3jmvNbZBAnKEddk recursive-get-dir/blocks/CIQFE', + 'added QmcozcFvmaTqVPaFXgZUHPsroSG8YP6tHEYyFaFhnonwSG recursive-get-dir/blocks/CIQEU/CIQEUWUVLBXVFYSYCHHSCRTXCYHGIOBXKWUMKFR3UPAFHQ5WK5362FQ.data', + 'added QmVU52FEpQQF3ViFGUKLhLeJaRKpCZfqN4AWLuzAXyrzyU recursive-get-dir/blocks/CIQEU', + 'added QmPiJAUg2J3dWWnQvtKXbkr8g1qCxX4RCPkU3wFmxd6x8H recursive-get-dir/blocks/CIQER/CIQERMRAAFXUAUOX3V2DCW7R77FRIVHQ3V5OIPPS3XQBX34KRPNOIRQ.data', + 'added QmboWqKvhjxdBw1AfxQ56sqhqrrtG7ibaGhHb19TPnjr69 recursive-get-dir/blocks/CIQER', + 'added QmPbgB6GzeUEnvXqQgYLTJnrdcm95kGRWH36euTr2eAB2w recursive-get-dir/blocks/CIQEN/CIQENVCICS44LLYUDQ5KVN6ALXC6QRHK2X4R6EUFRMBB5OSFO2FUYDQ.data', + 'added QmZCxJdNTR1MHRNGGWgZRZdW66FTpyTLdT8odbUz1CP7J9 recursive-get-dir/blocks/CIQEN', + 'added QmQCYnQWAHqSy1ts7VmHbp18BFEmbVvfX7FASVQF21uo5g recursive-get-dir/blocks/CIQDV/CIQDVKITASFS55MC2TXCX5XMZLMGTYVODWPEDIW7JYEG7YXBIA7IUWY.data', + 'added QmQaTiy1CufRfP3zTCW8fAtNWjvdeWuMkvTi4q6dykNDif recursive-get-dir/blocks/CIQDV', + 'added QmSynZ3cTjBzpMTSPCP5Q6RJSa9WEAA8p178cZRLnKdahz recursive-get-dir/blocks/CIQDM/CIQDMKFEUGKSLXMEXO774EZOYCYNHPRVFD53ZSAU7237F67XDSQGCYQ.data', + 'added QmNS3zMGDTPRTuR8nbPz4ddQpGN4gtuVyZ5G3mn3ajg4Rb recursive-get-dir/blocks/CIQDM', + 'added QmTpxXKswGwhTYLn1qL4EG9aLGFXS2LSnreceV2FJeArVh recursive-get-dir/blocks/CIQDD/CIQDDZ5EDQK5AP7LRTLZHQZUR2R3GECRFV3WPKNL7PL2SKFIL2LXC4Y.data', + 'added Qmbm7ToWsTta4Y1RipmRudCenKF7qAHRVTCtTPuoVqfY8H recursive-get-dir/blocks/CIQDD/CIQDDVW2EZIJF4NQH7WJNESD7XHQSXA5EGJVNTPVHD7444C2KLKXHDI.data', + 'added QmSCq2peGvGDXZKuX565UczxRpgzsiPPF3PgcJq9zDbByL recursive-get-dir/blocks/CIQDD', + 'added QmdgaiKe1HFfhrZvLwTFCrXmgTojhSWuBvyFXUVc8KzJVc recursive-get-dir/blocks/CIQBE/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data', + 'added QmYwUkwNwJN2cevwXKL48DRpbbjbdLWyyLANG3BKTtsTZ8 recursive-get-dir/blocks/CIQBE', + 'added QmQQHYDwAQms78fPcvx1uFFsfho23YJNoewfLbi9AtdyJ9 recursive-get-dir/blocks', + 'added QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2 recursive-get-dir' ].join('\n')) }) }) - - it('add recursively test 2', () => { - return ipfs('files add -r test').then((out) => { - const nLines = out.split('\n').length - expect(nLines).to.be.above(10) - /* - expect(out).to.be.eql([ - 'added QmYE7xo6NxbHEVEHej1yzxijYaNY51BaeKxjXxn6Ssa6Bs init-docs/tour/0.0-intro', - 'added QmciSU8hfpAXKjvK5YLUSwApomGSWN5gFbP4EpDAEzu2Te init-docs/tour', - 'added QmTumTjvcYCAvRRwQ8sDRxh8ezmrcr88YFU7iYNroGGTBZ init-docs/security-notes', - 'added QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB init-docs/readme', - 'added QmdncfsVm2h5Kqq9hPmU7oAVX2zTSVP3L869tgTbPYnsha init-docs/quick-start', - 'added QmY5heUM5qgRubMDD1og9fhCPA6QdkMp3QCwd4s7gJsyE7 init-docs/help', - 'added QmQN88TEidd3RY2u3dpib49fERTDfKtDpvxnvczATNsfKT init-docs/docs/index', - 'added QmegvLXxpVKiZ4b57Xs1syfBVRd8CbucVHAp7KpLQdGieC init-docs/docs', - 'added QmYCvbfNbCwFR45HiNP45rwJgvatpiW38D961L5qAhUM5Y init-docs/contact', - 'added QmZTR5bcpQD7cFgTorqxZDYaew1Wqgfbd2ud9QqGPAkK2V init-docs/about', - 'added QmUhUuiTKkkK8J6JZ9zmj8iNHPuNfGYcszgRumzhHBxEEU init-docs' - ].join('\n')) - */ - }) - }) - + it('get recursively', () => { - return ipfs('files get QmUhUuiTKkkK8J6JZ9zmj8iNHPuNfGYcszgRumzhHBxEEU').then((out) => { - const directory = path.join(process.cwd(), 'QmUhUuiTKkkK8J6JZ9zmj8iNHPuNfGYcszgRumzhHBxEEU') - expect(fs.readdirSync(directory).length).to.be.eql(8) - // TODO add assertion on content of files + const outDir = path.join(process.cwd(), 'QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2') + rimraf(outDir) + return ipfs('files get QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2').then((out) => { + console.log(out) + expect(out).to.be.eql( + 'Saving file(s) to QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2' + ) + + const outDir = path.join(process.cwd(), 'QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2') + const expectedDir = path.join(process.cwd(), 'test', 'test-data', 'recursive-get-dir') + const compareResult = compareDir(outDir, expectedDir) + expect(compareResult.differences).to.be.eql(0) + rimraf(outDir) }) }) }) diff --git a/test/test-data/recursive-get-dir/blocks/CIQBE/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data b/test/test-data/recursive-get-dir/blocks/CIQBE/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data new file mode 100644 index 0000000000..389e111776 --- /dev/null +++ b/test/test-data/recursive-get-dir/blocks/CIQBE/CIQBED3K6YA5I3QQWLJOCHWXDRK5EXZQILBCKAPEDUJENZ5B5HJ5R3A.data @@ -0,0 +1,28 @@ + +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/test-data/recursive-get-dir/blocks/CIQDD/CIQDDVW2EZIJF4NQH7WJNESD7XHQSXA5EGJVNTPVHD7444C2KLKXHDI.data b/test/test-data/recursive-get-dir/blocks/CIQDD/CIQDDVW2EZIJF4NQH7WJNESD7XHQSXA5EGJVNTPVHD7444C2KLKXHDI.data new file mode 100644 index 0000000000000000000000000000000000000000..5ea0edda6f82982c276a4a3813a50c0e35121c68 GIT binary patch literal 10765 zcmeIzF%AJy6a~;Rm3)!Nk3xb(CK9$mt(wFR^jf72s6=9D)srdd6*gc6EI~I4+fbbT zRX6Y66Q?1IqgQpGAHRd{ss22Q^=&*UXYbW{zqlNV{wBXJW712aODXvf?XV11kq9)T zAq{CrLmJYMhBTxh4QWV28q$!4G^8O7X-GpF(vXHUq#+GyNJARZkcKp*;U8!iTA|tK KY}4Vho$h|}9P~&4 literal 0 HcmV?d00001 diff --git a/test/test-data/recursive-get-dir/blocks/CIQDD/CIQDDZ5EDQK5AP7LRTLZHQZUR2R3GECRFV3WPKNL7PL2SKFIL2LXC4Y.data b/test/test-data/recursive-get-dir/blocks/CIQDD/CIQDDZ5EDQK5AP7LRTLZHQZUR2R3GECRFV3WPKNL7PL2SKFIL2LXC4Y.data new file mode 100644 index 0000000000..ecce1053f6 --- /dev/null +++ b/test/test-data/recursive-get-dir/blocks/CIQDD/CIQDDZ5EDQK5AP7LRTLZHQZUR2R3GECRFV3WPKNL7PL2SKFIL2LXC4Y.data @@ -0,0 +1,4 @@ +5 +" ׾F_uؔlzS?|ڲPc@ js-ipfs-repo + + \ No newline at end of file diff --git a/test/test-data/recursive-get-dir/blocks/CIQDM/CIQDMKFEUGKSLXMEXO774EZOYCYNHPRVFD53ZSAU7237F67XDSQGCYQ.data b/test/test-data/recursive-get-dir/blocks/CIQDM/CIQDMKFEUGKSLXMEXO774EZOYCYNHPRVFD53ZSAU7237F67XDSQGCYQ.data new file mode 100644 index 0000000000000000000000000000000000000000..bbe6bda78d0a52f6d87da578f452d43718b9aa9f GIT binary patch literal 10807 zcmeI&tqQ_m6vpvsQC>mhU=TmxWeCpZ4H&eDU=nNw5wR?6Yue0K5w>X*qZns5SS{Xw z-hn1RK)egXzn^qC&+{usEM| recursiveT \ No newline at end of file diff --git a/test/test-data/recursive-get-dir/blocks/CIQEN/CIQENVCICS44LLYUDQ5KVN6ALXC6QRHK2X4R6EUFRMBB5OSFO2FUYDQ.data b/test/test-data/recursive-get-dir/blocks/CIQEN/CIQENVCICS44LLYUDQ5KVN6ALXC6QRHK2X4R6EUFRMBB5OSFO2FUYDQ.data new file mode 100644 index 0000000000..2965d1c457 --- /dev/null +++ b/test/test-data/recursive-get-dir/blocks/CIQEN/CIQENVCICS44LLYUDQ5KVN6ALXC6QRHK2X4R6EUFRMBB5OSFO2FUYDQ.data @@ -0,0 +1,3 @@ + + hello world + \ No newline at end of file diff --git a/test/test-data/recursive-get-dir/blocks/CIQER/CIQERMRAAFXUAUOX3V2DCW7R77FRIVHQ3V5OIPPS3XQBX34KRPNOIRQ.data b/test/test-data/recursive-get-dir/blocks/CIQER/CIQERMRAAFXUAUOX3V2DCW7R77FRIVHQ3V5OIPPS3XQBX34KRPNOIRQ.data new file mode 100644 index 0000000000..4a26a4ac35 --- /dev/null +++ b/test/test-data/recursive-get-dir/blocks/CIQER/CIQERMRAAFXUAUOX3V2DCW7R77FRIVHQ3V5OIPPS3XQBX34KRPNOIRQ.data @@ -0,0 +1,3 @@ +/ +" !61صF2$`7#u@1directT2 +" Hz8#3u2ED ƥ*QKMQ recursiveT \ No newline at end of file diff --git a/test/test-data/recursive-get-dir/blocks/CIQEU/CIQEUWUVLBXVFYSYCHHSCRTXCYHGIOBXKWUMKFR3UPAFHQ5WK5362FQ.data b/test/test-data/recursive-get-dir/blocks/CIQEU/CIQEUWUVLBXVFYSYCHHSCRTXCYHGIOBXKWUMKFR3UPAFHQ5WK5362FQ.data new file mode 100644 index 0000000000..4145619655 --- /dev/null +++ b/test/test-data/recursive-get-dir/blocks/CIQEU/CIQEUWUVLBXVFYSYCHHSCRTXCYHGIOBXKWUMKFR3UPAFHQ5WK5362FQ.data @@ -0,0 +1,4 @@ + +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/test-data/recursive-get-dir/blocks/CIQFE/CIQFEAGMNNXXTYKYQSANT6IBNTFN7WR5RPD5F6GN6MBKUUO25DNOTWQ.data b/test/test-data/recursive-get-dir/blocks/CIQFE/CIQFEAGMNNXXTYKYQSANT6IBNTFN7WR5RPD5F6GN6MBKUUO25DNOTWQ.data new file mode 100644 index 0000000000000000000000000000000000000000..10aa2ae4f1291a62edd84980f1c05b09b95f78ff GIT binary patch literal 10891 zcmWgA;8GG&c)a0=(~LhdBC~#fIWaSTr;7SI$0sSXC;Kd!I#aqLXh*0Jg9L-nsLIh$ z8ciXixns0s7%de?YlP9-aI`iYtqn(O!_nGsv^E^A4M%Ik(b{mdHXN-DM{C2;+HkZs z9IXvUYs1mnaI`iYtqn(O!_nGsv^E^A4M%Ik(b{mdHXN-DM{C2;+HkZs9IXvUYs1mn zaI`iYG__&mlom_2c+JFlUxXS??=;#MbToJ7(P`PK4+MoQKg`(u9q~6w(px+ cb8FMhello + 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/test-data/recursive-get-dir/blocks/CIQGP/CIQGPALRQ24P6NS4OWHTQ7R247ZI7KJWP3QWPQYS43LFULQC5ANLQFI.data b/test/test-data/recursive-get-dir/blocks/CIQGP/CIQGPALRQ24P6NS4OWHTQ7R247ZI7KJWP3QWPQYS43LFULQC5ANLQFI.data new file mode 100644 index 0000000000000000000000000000000000000000..a8f98693b7d4797d0a55704b16c15a6aa7d34bd5 GIT binary patch literal 10765 zcmeIzF%AJy6a~Szz&}ww{ J&EYejEr0X~^v?hQ literal 0 HcmV?d00001 diff --git a/test/test-data/recursive-get-dir/blocks/CIQH7/CIQH7OEYWXL34RWYL7VXLWEU4FWPVGT24VJT7DUZPTNLF25N25IGGQA.data b/test/test-data/recursive-get-dir/blocks/CIQH7/CIQH7OEYWXL34RWYL7VXLWEU4FWPVGT24VJT7DUZPTNLF25N25IGGQA.data new file mode 100644 index 0000000000..ee87b9db01 --- /dev/null +++ b/test/test-data/recursive-get-dir/blocks/CIQH7/CIQH7OEYWXL34RWYL7VXLWEU4FWPVGT24VJT7DUZPTNLF25N25IGGQA.data @@ -0,0 +1,4 @@ +0 +" ,Qv3k>\IzxEElM/fLICENSE1 +" JZXoRX!Fwd87U;SöWw README.md{ + \ No newline at end of file diff --git a/test/test-data/recursive-get-dir/blocks/CIQHA/CIQHAKDLTL5GMIFGN5YVY4BA22FPHUIODJEXS4LCTQDWA275XAJDAPI.data b/test/test-data/recursive-get-dir/blocks/CIQHA/CIQHAKDLTL5GMIFGN5YVY4BA22FPHUIODJEXS4LCTQDWA275XAJDAPI.data new file mode 100644 index 0000000000000000000000000000000000000000..74de75af616ff437b5c7a3a5272281eac2146b6c GIT binary patch literal 309 zcmWgA<5Ch*SgK>j#LTl(=mjz6J*Z#Z`mUeibke1%>*qt`A@ymo*6O-~wOC)CS z3K@XZPnu<5V|lBKJN>}4>2CTNRSd^0_H1qVw~ozKk4Ii%i@p$ha(-S(VseSZ2}U7Z zkd6rls>-Jxlr$AsHtpiyKm2l@?&p6zQA*^T_KfrP>FKF6gjh0Ca|$F5F$tM~lqa2& z*O|D`YWmh`FN(J=HpxnHW4)f}dn)*>RpfVzsIJ{Y+=Zo?$=SNaC5c5P5({~S^g+6W z__Mw-Uda>Kbm^hob(zph@di$ZR2iSh3b{RB`110NH$rShsfj7MsS@Wngv>!2f{xjg zms)1qHyyK_UR9)g=w{aZf~|kMWdrSdqBHNTyCTF_oSIx(lvz@#o0ngbS}f7b!NtVE F2moEFc%uLS literal 0 HcmV?d00001 diff --git a/test/test-data/recursive-get-dir/blocks/CIQHB/CIQHBGZNZRPWVEFNMTLP4OS5EAVHFMCX2HD7FZUC2B3WUU3D4LGKS5A.data b/test/test-data/recursive-get-dir/blocks/CIQHB/CIQHBGZNZRPWVEFNMTLP4OS5EAVHFMCX2HD7FZUC2B3WUU3D4LGKS5A.data new file mode 100644 index 0000000000..3a99c365f0 --- /dev/null +++ b/test/test-data/recursive-get-dir/blocks/CIQHB/CIQHBGZNZRPWVEFNMTLP4OS5EAVHFMCX2HD7FZUC2B3WUU3D4LGKS5A.data @@ -0,0 +1,3 @@ +4 +" Y9_)a˹2RmŖke9 js-ipfs-repo + \ No newline at end of file diff --git a/test/test-data/recursive-get-dir/blocks/CIQHP/CIQHPUVCWD6JA6AFUVD6VA64TGWP67KYA3AIMBUMVWGZ5AQN2L2HSWQ.data b/test/test-data/recursive-get-dir/blocks/CIQHP/CIQHPUVCWD6JA6AFUVD6VA64TGWP67KYA3AIMBUMVWGZ5AQN2L2HSWQ.data new file mode 100644 index 0000000000000000000000000000000000000000..78421c81c29ed8c18921f686ea3292e3e7300668 GIT binary patch literal 10765 zcmeIzAqoOf6a~;x48ym`#~`RM41#V$vuVH`*sVtQAcCXSECW-t8{CI3!R7?FVL1Jz z%e(i)S;%Adsve7DGwPqdpJ%zbPo~%Tdwt$7FNbotEpDrr43g+lN<931^R@s0 literal 0 HcmV?d00001 diff --git a/test/test-data/recursive-get-dir/blocks/CIQIX/CIQIXBZMUTXFC5QIGMLJNXLLHZOPGSL2PBC65D4UIVWM6TI5F5TAFNI.data b/test/test-data/recursive-get-dir/blocks/CIQIX/CIQIXBZMUTXFC5QIGMLJNXLLHZOPGSL2PBC65D4UIVWM6TI5F5TAFNI.data new file mode 100644 index 0000000000..3da92595c2 --- /dev/null +++ b/test/test-data/recursive-get-dir/blocks/CIQIX/CIQIXBZMUTXFC5QIGMLJNXLLHZOPGSL2PBC65D4UIVWM6TI5F5TAFNI.data @@ -0,0 +1,24 @@ + +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/test-data/recursive-get-dir/blocks/CIQJ2/CIQJ23BL4UHXA2KTI6NLTXZM4PW4VEFWQBJ4ACZQAS37BLGL4HUO5XY.data b/test/test-data/recursive-get-dir/blocks/CIQJ2/CIQJ23BL4UHXA2KTI6NLTXZM4PW4VEFWQBJ4ACZQAS37BLGL4HUO5XY.data new file mode 100644 index 0000000000000000000000000000000000000000..b799cf6b2236c91f8224b9fefe43aca16c773490 GIT binary patch literal 309 zcmWgA<5Ch*SgK>j#LTl(=mjz6J*Z#Z`mUeibke1%>*qt`A@ymo*6O-~wOC)CS z3K@XZPnu<5V|lBKJN>}4>2CTNRSd^0_H1qVw~ozKk4Ii%i@p$ha(-S(VseSZ2}U7Z zkd6rls>-Jxlr$AsHtpiyKm2l@?&p6zQA*^T_KfrP>FKF6gjh0Ca|$F5F$tM~ls|2g zoaXRw$uaxIJs~DLpX;8StGsyP<=b&`P8V3!Rm2K~xC=`&le2Y;OA?DpBo6Qj>4S6$ z@n?Nwypkud>C!{F>oTF2;tiY*sWLv16>@vN@a5$jZ-m&2QWH~hQzg!E2$_R41Rb*} zFSX3JZ#rf` +- 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/test-data/recursive-get-dir/blocks/CIQLB/CIQLBK52T5EHVHZY5URTG5JS3JCUJDQM2DRB5RVF33DCUUOFJNGVDUI.data b/test/test-data/recursive-get-dir/blocks/CIQLB/CIQLBK52T5EHVHZY5URTG5JS3JCUJDQM2DRB5RVF33DCUUOFJNGVDUI.data new file mode 100644 index 0000000000000000000000000000000000000000..82458cdf713592bffde3af64f85bfa867231d7d1 GIT binary patch literal 10849 zcmWgA;8GG&c)a0=(~LhdBC~#fIWaSTr;7SI$0sSXC;Kd!I#aqLXh*0Jg9L-nsLIh$ z8ciXixns0s7%de?YlP9-aI`iYtqn(O!_nGsv^E^A4M%Ik(b{mdHXN-DM{C2;+HkZs z9IXvUYs1mnaI`iYtqn(O!_nGsv^E^A4M%Ik(b{mdHXN-DM{C2;+HkZs9IXvUYs1mn zaI`iYG__&mlom_2c+JFlUxXS??=;#MbToJ7(P`PK4+MoQKg`(u9pXsYYQnaL-~-$SEZaY-MiqUv4K}orj%_y00+YJV}#XGok z)Gc&_%?H(zbc;FK34aUrCGW}p=j0S(a*4bcz{(GU&M5Dn1~4bcz{(GU&M5Dn1~4bcz{(GU&M5Dn1~ z4bcz{(GU&M5Dn4rZ!}yDE04r@ptViQt$NSPbgyf+T8kZmjdSx~?(hFos3IOo>d{>N G+6cZA+z2}W literal 0 HcmV?d00001 diff --git a/test/test-data/recursive-get-dir/blocks/CIQMB/CIQMB7DLJFKD267QJ2B5FJNHZPTSVA7IB6OHXSQ2XSVEEKMKK6RT75I.data b/test/test-data/recursive-get-dir/blocks/CIQMB/CIQMB7DLJFKD267QJ2B5FJNHZPTSVA7IB6OHXSQ2XSVEEKMKK6RT75I.data new file mode 100644 index 0000000000000000000000000000000000000000..c9885c45d7e7c10d02b98208d40cfd7b8bfaed21 GIT binary patch literal 101 zcmWgA=TZ_+Kwo-;;PadOz%uNME$6+{JHE$$U!OUW!sO)in> z4G}T|X$WFClbv7rFrua5=1<0)Q}=J#b|1g=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 -o foo2 + diff foo foo2 + + +Objects: + + ipfs object get + ipfs object get /foo2 + ipfs object --help + + +Pin + GC: + + ipfs pin add + ipfs repo gc + ipfs ls + ipfs pin rm + ipfs repo 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/ + ls + + +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/test-data/recursive-get-dir/blocks/CIQOM/CIQOMBKARLB7PAITVSNH7VEGIQJRPL6J7FT2XYVKAXT4MQPXXPUYUNY.data b/test/test-data/recursive-get-dir/blocks/CIQOM/CIQOMBKARLB7PAITVSNH7VEGIQJRPL6J7FT2XYVKAXT4MQPXXPUYUNY.data new file mode 100644 index 0000000000000000000000000000000000000000..b65398976526bbfc4648bcc7e8dc533ce6f4dff5 GIT binary patch literal 10765 zcmeIzF%AJy6a~FJWY200SX~$SEzBZ1I|j^S%f*oZe})FX(9Q%%jt? zQy&NlS$>$Y`#n34QbA^3F(V^P!?OjhZT>&P<~cuU%i;RLe(ysy@1_qD4Q&dq4R$uX zbPxoo11sKKRu>QF9Qd?w0|O_M0pouNU?_u2-8}VndNoG}qZmkp00{rx(5+JHej5PO CoIXSV literal 0 HcmV?d00001 diff --git a/test/test-data/recursive-get-dir/datastore/000005.ldb b/test/test-data/recursive-get-dir/datastore/000005.ldb new file mode 100644 index 0000000000000000000000000000000000000000..63d9d260b936415ee42b5aeda6c79fb941664398 GIT binary patch literal 1120 zcmZQDSjViNS&&z(FQg!8*qs;0^V3RMWIveo0t|Brg#j3VRkisv@!=|IgJvNC_dNx9y@%e`@arzW`upR#0^RR3Lu1P3 zgny1+s9JOHtH$|N^V2^pIaU+*`j0Vdf^UEA=Y(L*NL7==e45ubJUDbI<}5@1nZ5i@ zU-f@onB_6=BHQa-tVc_VRZiT0AST5ib<){%%1r}PkJe@8+6(<3{`CFeMP?prC*c znwwdgM`+7O$B&?~72w>77RV zf{y0SJUT5q^?{&}<%b!&-?Q^56=dcWGqS)myonCBGLo1n?_9oP$D!cvsdqIm%dJT< zUeCYn&kfrf>=lfOBoQtW6k&$7W$0~c7gOL@IORq4N$7y_CFLmFs-1D4yKkEePa;Yx&V3}9e z6J;wFzbL(7XX!B6*Rdrw=+4dxeU2>!j1QaGe>~sK(>yOETD?v4ss5$s3VXC14~0|~ z@|s=JZrGS)y@`hY)f%XfBnQv@ZgL4too7C-W6;9@lKgp&)Y9xu#YGC zq+Q(oPkf)J&zo^7bJ>~t)Xqs~*IU@HQqP#^{d0FztkiZ*y~k%OjhiRCYiY>$1@7+Z zzc{J2k%`0O*2zuI)9>zn)wWdsh9cXQc|w1;OnM=;)%wQi`6UM;Jtuj8n*Q?qk;X3q zZaf<6!(B7;zLu#kRKLAQM`r(FbFXM+CT2zkqS6H@{24)n$QSJzIOo8pg&P<+nGG2K hLjXe)2VAZvSyQK-gJTMZI7kRT2>;#Cty1cK8vstu!bkuB literal 0 HcmV?d00001 diff --git a/test/test-data/recursive-get-dir/datastore/000010.ldb b/test/test-data/recursive-get-dir/datastore/000010.ldb new file mode 100644 index 0000000000000000000000000000000000000000..92077582ca4c1094d81e1c35f8703550afefa5f7 GIT binary patch literal 1143 zcmZQDV9?Jj$Sc+tQjj$4&Wq#uX{9W(pHXd=&LNx2cdi6ocRIV%d~TcDw2tFO0@nWL9`h-bL3Yk+%*afr8@TbPk^RJchgVHA9N_5eTxD41QxO=J9Z^{56JZ); z7-4K;T3DFokyM;!W}Z>zXzZ6K)WGC&@4ao?>Nz(8|F>suXs_zIpd7w&-MpLjzTew7 zw;bnNa{uX~ml~7*<|J4d{FVA*zBjGA&O}w!=F`N7tE3H@g#_I96y)_DdRxPzt0SfDVr1iIeMXL&AqQ0=U2^7|FGm(P2B50#;ggx{k5MHf;A&mO%C&EUfb~C z(50BO4E<;J@;iOi|8-%O$GnSduXnK?Eh$zxasPps6ob@BXVWP+4NN^+mzirX^ndu{ z#t*;Sx0dNGNfK9{8ZLg&Y3{=GymywrWge8Ax zb8_8$u}O-_UoIvnSEU^1zHqkmzk}Jo{lB**@XgG7Tp+=qBxht`XsT;yq-$sxVrXh* zVrgY+u4iCoXlQ9}W@#R!!6>CfIN}*~849wANg!O1*k!T*#RNJcTULFAv{=p%R0p5|p&LRGejGWK}qNY!jl|rkT zI2eSMF&Q*5DjD#yacZ@Bw0-AgWMpJzU~XdMX8?+GF*PwVGHml$WiN9uvO;p{6~^*7 zjnC_)?mL!yo-^-fogiH<)#V;6^U8XnY{lXir8n#>9VYuaw!{YA*;%2_v890VVH5k0 z=ev2D=Y>S8w`o4rzw}&TkCx-1kjg?{vrD=>%@*e)9$i}<^>(k?*#eGjDX!_SpO^_A zd~u&uKT_JeV$DC^DKqPN`vna4@g$$Li@X1c@ALF|GfrhLJ5!(9IqB?r3;R{-856yK z?v9F;+ODbh_-v(d^JI4|4f(#n-Cg|`C$%;*ad_N1xygC@-QBO+mg?V7WV_2So6|Ky~%*a4g zWP`$=5k#;l^#s5<2R<#_z`)6D!1x~m7-n+7<=&pJcTULFAv{=p%R0p5|p&LRGe zjGPcN*cn(K5N|UhD@2zb$Y#P0Wn_a{!gQHYLO&-zIWb2+Ei)&zxF|orgpmm%D-4w= M$jmEdWQ2$T0KrCJEdT%j literal 0 HcmV?d00001 diff --git a/test/test-data/recursive-get-dir/init-docs/about b/test/test-data/recursive-get-dir/init-docs/about new file mode 100644 index 0000000000..eaa644b24b --- /dev/null +++ b/test/test-data/recursive-get-dir/init-docs/about @@ -0,0 +1,53 @@ + + 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 diff --git a/test/test-data/recursive-get-dir/init-docs/contact b/test/test-data/recursive-get-dir/init-docs/contact new file mode 100644 index 0000000000..965de025e2 --- /dev/null +++ b/test/test-data/recursive-get-dir/init-docs/contact @@ -0,0 +1,6 @@ +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 diff --git a/test/test-data/recursive-get-dir/init-docs/docs/index b/test/test-data/recursive-get-dir/init-docs/docs/index new file mode 100644 index 0000000000..c846c91b8c --- /dev/null +++ b/test/test-data/recursive-get-dir/init-docs/docs/index @@ -0,0 +1 @@ +Index diff --git a/test/test-data/recursive-get-dir/init-docs/help b/test/test-data/recursive-get-dir/init-docs/help new file mode 100644 index 0000000000..d069d6ba76 --- /dev/null +++ b/test/test-data/recursive-get-dir/init-docs/help @@ -0,0 +1,7 @@ +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 diff --git a/test/test-data/recursive-get-dir/init-docs/quick-start b/test/test-data/recursive-get-dir/init-docs/quick-start new file mode 100644 index 0000000000..92eca892de --- /dev/null +++ b/test/test-data/recursive-get-dir/init-docs/quick-start @@ -0,0 +1,113 @@ +# 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 -o foo2 + diff foo foo2 + + +Objects: + + ipfs object get + ipfs object get /foo2 + ipfs object --help + + +Pin + GC: + + ipfs pin add + ipfs repo gc + ipfs ls + ipfs pin rm + ipfs repo 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/ + ls + + +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 diff --git a/test/test-data/recursive-get-dir/init-docs/readme b/test/test-data/recursive-get-dir/init-docs/readme new file mode 100644 index 0000000000..eeade6617b --- /dev/null +++ b/test/test-data/recursive-get-dir/init-docs/readme @@ -0,0 +1,26 @@ +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 diff --git a/test/test-data/recursive-get-dir/init-docs/security-notes b/test/test-data/recursive-get-dir/init-docs/security-notes new file mode 100644 index 0000000000..da55ea71c4 --- /dev/null +++ b/test/test-data/recursive-get-dir/init-docs/security-notes @@ -0,0 +1,21 @@ + 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. diff --git a/test/test-data/recursive-get-dir/init-docs/tour/0.0-intro b/test/test-data/recursive-get-dir/init-docs/tour/0.0-intro new file mode 100644 index 0000000000..36d8da0c6d --- /dev/null +++ b/test/test-data/recursive-get-dir/init-docs/tour/0.0-intro @@ -0,0 +1,34 @@ +WIP + +# 0.0 - Introduction + +Welcome to IPFS! This tour will guide you through a few of the +features of this tool, and the most common commands. Then, it will +immerse you into the world of merkledags and the amazing things +you can do with them. + + +This tour has many parts, and can be taken in different sequences. +Different people learn different ways, so choose your own adventure: + + To start with the concepts, try: + - The Merkle DAG + - Data Structures on the Merkle DAG + - Representing Files with unixfs + - add, cat, ls, refs + ... + + + To start with the examples, try: + - add, cat, ls, refs + - Representing Files with unixfs + - Data Structures on the Merkle DAG + - The Merkle DAG + ... + + + To start with the network, try: + - IPFS Nodes + - Running the daemon + - The Swarm + - The Web diff --git a/test/test-data/recursive-get-dir/version b/test/test-data/recursive-get-dir/version new file mode 100644 index 0000000000..b8626c4cff --- /dev/null +++ b/test/test-data/recursive-get-dir/version @@ -0,0 +1 @@ +4 From 01a267f4b175b1e70a46a5a1ce8ff6a5c270c27f Mon Sep 17 00:00:00 2001 From: Pedro Teixeira Date: Wed, 1 Feb 2017 12:26:35 +0000 Subject: [PATCH 5/8] files: supporting dir in export stream --- src/cli/commands/files/get.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/cli/commands/files/get.js b/src/cli/commands/files/get.js index 3acefb20d8..7bbc82f221 100644 --- a/src/cli/commands/files/get.js +++ b/src/cli/commands/files/get.js @@ -36,13 +36,15 @@ function fileHandler (dir) { if (err) { callback(err) } else { + const fullFilePath = path.join(dir, file.path) if (file.content) { file.content - .pipe(fs.createWriteStream(path.join(dir, file.path))) + .pipe(fs.createWriteStream(fullFilePath)) .once('error', callback) .once('finish', callback) } else { - callback() + // this is a dir + mkdirp(fullFilePath, callback) } } }) From bf9d81a3f102e7f6f0dbf9192be2e6da1999d9e6 Mon Sep 17 00:00:00 2001 From: Pedro Teixeira Date: Wed, 1 Feb 2017 12:27:17 +0000 Subject: [PATCH 6/8] tests: recursive get: comparing files by size and content + writing out the differences if there are any --- test/cli/test-files.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/test/cli/test-files.js b/test/cli/test-files.js index ac81eadfa4..69ea34a009 100644 --- a/test/cli/test-files.js +++ b/test/cli/test-files.js @@ -178,7 +178,14 @@ describe('files', () => { const outDir = path.join(process.cwd(), 'QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2') const expectedDir = path.join(process.cwd(), 'test', 'test-data', 'recursive-get-dir') - const compareResult = compareDir(outDir, expectedDir) + const compareResult = compareDir(outDir, expectedDir, { + compareContent: true, + compareSize: true + }) + if (compareResult.differences) { + const diffs = compareResult.diffSet.filter(d => d.state !== 'equal') + console.log('differences: %s', JSON.stringify(diffs, null, ' ')) + } expect(compareResult.differences).to.be.eql(0) rimraf(outDir) }) From 2ae60a378a5fd2ba7fd1fdb734aeeec2414fee69 Mon Sep 17 00:00:00 2001 From: Pedro Teixeira Date: Wed, 1 Feb 2017 13:54:42 +0000 Subject: [PATCH 7/8] make linter pass --- test/cli/test-files.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/test/cli/test-files.js b/test/cli/test-files.js index 69ea34a009..956bef12d5 100644 --- a/test/cli/test-files.js +++ b/test/cli/test-files.js @@ -182,10 +182,6 @@ describe('files', () => { compareContent: true, compareSize: true }) - if (compareResult.differences) { - const diffs = compareResult.diffSet.filter(d => d.state !== 'equal') - console.log('differences: %s', JSON.stringify(diffs, null, ' ')) - } expect(compareResult.differences).to.be.eql(0) rimraf(outDir) }) From cae7a2815cf7551f38c5ca2d9a937f0dc30fd694 Mon Sep 17 00:00:00 2001 From: David Dias Date: Wed, 1 Feb 2017 14:22:46 +0000 Subject: [PATCH 8/8] fix: remove unnecessary console.log --- test/cli/test-files.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/cli/test-files.js b/test/cli/test-files.js index 956bef12d5..328019c01b 100644 --- a/test/cli/test-files.js +++ b/test/cli/test-files.js @@ -171,7 +171,6 @@ describe('files', () => { const outDir = path.join(process.cwd(), 'QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2') rimraf(outDir) return ipfs('files get QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2').then((out) => { - console.log(out) expect(out).to.be.eql( 'Saving file(s) to QmYmW4HiZhotsoSqnv2o1oUusvkRM8b9RweBoH7ao5nki2' )