diff --git a/.gitignore b/.gitignore index 4f05bfc8..db426f86 100644 --- a/.gitignore +++ b/.gitignore @@ -29,3 +29,6 @@ build/Release # Dependency directory # https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git node_modules + +dist +lib \ No newline at end of file diff --git a/karma.conf.js b/karma.conf.js deleted file mode 100644 index d9d691f1..00000000 --- a/karma.conf.js +++ /dev/null @@ -1,54 +0,0 @@ -const path = require('path') - -module.exports = function (config) { - config.set({ - basePath: '', - frameworks: ['mocha'], - - files: [ - 'tests/browser.js' - ], - - preprocessors: { - 'tests/*': ['webpack', 'sourcemap'] - }, - - webpack: { - devtool: 'eval', - resolve: { - extensions: ['', '.js', '.json'] - }, - externals: { - fs: '{}' - }, - node: { - Buffer: true - }, - module: { - loaders: [ - { test: /\.json$/, loader: 'json' } - ], - postLoaders: [ - { - include: path.resolve(__dirname, 'node_modules/ipfs-unixfs'), - loader: 'transform?brfs' - } - ] - } - }, - - webpackMiddleware: { - noInfo: true, - stats: { - colors: true - } - }, - reporters: ['spec'], - port: 9876, - colors: true, - logLevel: config.LOG_INFO, - autoWatch: false, - browsers: process.env.TRAVIS ? ['Firefox'] : ['Chrome'], - singleRun: true - }) -} diff --git a/package.json b/package.json index 76833278..302a2162 100644 --- a/package.json +++ b/package.json @@ -4,10 +4,12 @@ "description": "JavaScript implementation of the layout and chunking mechanisms used by IPFS", "main": "src/index.js", "scripts": { - "lint": "standard", - "test": "npm run test:node && npm run test:browser", - "test:node": "mocha tests/index.js", - "test:browser": "karma start karma.conf.js" + "lint": "dignified-lint", + "build": "dignified-build", + "test": "dignified-test", + "test:node": "dignified-test node", + "test:browser": "dignified-test browser", + "release": "dignified-release" }, "pre-commit": [ "lint", @@ -15,7 +17,7 @@ ], "repository": { "type": "git", - "url": "git+https://github.com/diasdavid/js-ipfs-data-importing.git" + "url": "git+https://github.com/ipfs/js-ipfs-data-importing.git" }, "keywords": [ "IPFS" @@ -28,9 +30,11 @@ "homepage": "https://github.com/diasdavid/js-ipfs-data-importing#readme", "devDependencies": { "brfs": "^1.4.3", + "block-stream2": "^1.1.0", "bs58": "^3.0.0", "buffer-loader": "0.0.1", "chai": "^3.4.1", + "dignified.js": "^1.0.0", "fs-blob-store": "^5.2.1", "highland": "^2.7.1", "idb-plus-blob-store": "^1.0.0", @@ -50,10 +54,7 @@ "pre-commit": "^1.1.2", "raw-loader": "^0.5.1", "rimraf": "^2.5.1", - "standard": "^6.0.8", - "string-to-stream": "^1.0.1", - "transform-loader": "^0.2.3", - "webpack": "^2.0.7-beta" + "string-to-stream": "^1.0.1" }, "dependencies": { "async": "^1.5.2", diff --git a/src/chunker-fixed-size.js b/src/chunker-fixed-size.js index 1fe9f8ad..372ef519 100644 --- a/src/chunker-fixed-size.js +++ b/src/chunker-fixed-size.js @@ -1,4 +1,6 @@ -var chunker = require('block-stream2') +'use strict' + +const chunker = require('block-stream2') exports = module.exports = function (size) { return chunker({ size: size, zeroPadding: false }) diff --git a/src/index.js b/src/index.js index b4655d7c..bef1b42f 100644 --- a/src/index.js +++ b/src/index.js @@ -1,3 +1,5 @@ +'use strict' + const debug = require('debug') const log = debug('importer') log.err = debug('importer:error') @@ -7,6 +9,7 @@ const FixedSizeChunker = require('./chunker-fixed-size') const through2 = require('through2') const UnixFS = require('ipfs-unixfs') const async = require('async') + exports = module.exports const CHUNK_SIZE = 262144 diff --git a/tests/browser.js b/test/browser.js similarity index 97% rename from tests/browser.js rename to test/browser.js index 2d812dfb..575396f7 100644 --- a/tests/browser.js +++ b/test/browser.js @@ -1,4 +1,6 @@ /* eslint-env mocha */ +'use strict' + const tests = require('./buffer-test') const async = require('async') const store = require('idb-plus-blob-store') @@ -17,7 +19,7 @@ idb.deleteDatabase('ipfs/blocks') describe('IPFS data importing tests on the Browser', function () { before(function (done) { this.timeout(23000) - var repoData = [] + const repoData = [] repoContext.keys().forEach(function (key) { repoData.push({ key: key.replace('./', ''), diff --git a/tests/buffer-test.js b/test/buffer-test.js similarity index 92% rename from tests/buffer-test.js rename to test/buffer-test.js index 5259ebdc..097e2458 100644 --- a/tests/buffer-test.js +++ b/test/buffer-test.js @@ -1,4 +1,6 @@ /* eslint-env mocha */ +'use strict' + const importer = require('./../src') const BlockService = require('ipfs-blocks').BlockService const DAGService = require('ipfs-merkle-dag').DAGService @@ -17,9 +19,9 @@ module.exports = function (repo) { describe('layout: importer', function () { it('import a small buffer', function (done) { // this is just like "import a small file" - var bs = new BlockService(repo) - var ds = new DAGService(bs) - var buf = smallBuf + const bs = new BlockService(repo) + const ds = new DAGService(bs) + const buf = smallBuf importer.import(buf, ds, function (err, stat) { expect(err).to.not.exist ds.get(stat.Hash, function (err, node) { @@ -35,9 +37,9 @@ module.exports = function (repo) { it('import a big buffer', function (done) { // this is just like "import a big file" - var buf = bigBuf - var bs = new BlockService(repo) - var ds = new DAGService(bs) + const buf = bigBuf + const bs = new BlockService(repo) + const ds = new DAGService(bs) importer.import(buf, ds, function (err, stat) { expect(err).to.not.exist ds.get(stat.Hash, function (err, node) { @@ -61,7 +63,7 @@ module.exports = function (repo) { expect(err).to.not.exist const leaf = new DAGNode() - var marbuf2 = bigLink + const marbuf2 = bigLink leaf.unMarshal(marbuf2) expect(node.links).to.deep.equal(leaf.links) expect(node.links.length).to.equal(0) diff --git a/tests/index.js b/test/node.js similarity index 81% rename from tests/index.js rename to test/node.js index 640b4108..4fa6eb66 100644 --- a/tests/index.js +++ b/test/node.js @@ -6,10 +6,11 @@ const fs = require('fs') const ncp = require('ncp').ncp const rimraf = require('rimraf') const expect = require('chai').expect +const path = require('path') describe('core', () => { - const repoExample = process.cwd() + '/tests/repo-example' - const repoTests = process.cwd() + '/tests/repo-tests' + Date.now() + const repoExample = path.join(process.cwd(), '/test/repo-example') + const repoTests = path.join(process.cwd(), '/test/repo-tests' + Date.now()) before((done) => { ncp(repoExample, repoTests, (err) => { @@ -35,9 +36,9 @@ describe('core', () => { file === 'buffer-test.js' || file.indexOf('repo-tests') > -1) { return false - } else { - return true } + + return true }).forEach((file) => { require('./' + file) }) diff --git a/tests/repo-example/blocks/1220120f/1220120f6af601d46e10b2d2e11ed71c55d25f3042c22501e41d1246e7a1e9d3d8ec.data b/test/repo-example/blocks/1220120f/1220120f6af601d46e10b2d2e11ed71c55d25f3042c22501e41d1246e7a1e9d3d8ec.data similarity index 100% rename from tests/repo-example/blocks/1220120f/1220120f6af601d46e10b2d2e11ed71c55d25f3042c22501e41d1246e7a1e9d3d8ec.data rename to test/repo-example/blocks/1220120f/1220120f6af601d46e10b2d2e11ed71c55d25f3042c22501e41d1246e7a1e9d3d8ec.data diff --git a/tests/repo-example/blocks/122031d6/122031d6da265092f1b03fec969243fdcf095c1d219356cdf538ffce705a52d5738d.data b/test/repo-example/blocks/122031d6/122031d6da265092f1b03fec969243fdcf095c1d219356cdf538ffce705a52d5738d.data similarity index 100% rename from tests/repo-example/blocks/122031d6/122031d6da265092f1b03fec969243fdcf095c1d219356cdf538ffce705a52d5738d.data rename to test/repo-example/blocks/122031d6/122031d6da265092f1b03fec969243fdcf095c1d219356cdf538ffce705a52d5738d.data diff --git a/tests/repo-example/blocks/122031e7/122031e7a41c15d03feb8cd793c3348ea3b310512d7767a9abfbd7a928a85e977173.data b/test/repo-example/blocks/122031e7/122031e7a41c15d03feb8cd793c3348ea3b310512d7767a9abfbd7a928a85e977173.data similarity index 100% rename from tests/repo-example/blocks/122031e7/122031e7a41c15d03feb8cd793c3348ea3b310512d7767a9abfbd7a928a85e977173.data rename to test/repo-example/blocks/122031e7/122031e7a41c15d03feb8cd793c3348ea3b310512d7767a9abfbd7a928a85e977173.data diff --git a/tests/repo-example/blocks/12203628/12203628a4a19525dd84bbbffe132ec0b0d3be3528fbbcc814feb7f2fbf71ca06162.data b/test/repo-example/blocks/12203628/12203628a4a19525dd84bbbffe132ec0b0d3be3528fbbcc814feb7f2fbf71ca06162.data similarity index 100% rename from tests/repo-example/blocks/12203628/12203628a4a19525dd84bbbffe132ec0b0d3be3528fbbcc814feb7f2fbf71ca06162.data rename to test/repo-example/blocks/12203628/12203628a4a19525dd84bbbffe132ec0b0d3be3528fbbcc814feb7f2fbf71ca06162.data diff --git a/tests/repo-example/blocks/12204a5a/12204a5a95586f52e25811cf214677160e64383755a8c5163ba3c053c3b65777ed16.data b/test/repo-example/blocks/12204a5a/12204a5a95586f52e25811cf214677160e64383755a8c5163ba3c053c3b65777ed16.data similarity index 100% rename from tests/repo-example/blocks/12204a5a/12204a5a95586f52e25811cf214677160e64383755a8c5163ba3c053c3b65777ed16.data rename to test/repo-example/blocks/12204a5a/12204a5a95586f52e25811cf214677160e64383755a8c5163ba3c053c3b65777ed16.data diff --git a/tests/repo-example/blocks/12205200/12205200cc6b6f79e1588480d9f9016ccadfda3d8bc7d2f8cdf302aa51dae8dae9da.data b/test/repo-example/blocks/12205200/12205200cc6b6f79e1588480d9f9016ccadfda3d8bc7d2f8cdf302aa51dae8dae9da.data similarity index 100% rename from tests/repo-example/blocks/12205200/12205200cc6b6f79e1588480d9f9016ccadfda3d8bc7d2f8cdf302aa51dae8dae9da.data rename to test/repo-example/blocks/12205200/12205200cc6b6f79e1588480d9f9016ccadfda3d8bc7d2f8cdf302aa51dae8dae9da.data diff --git a/tests/repo-example/blocks/122052c6/122052c63c7775396b3f82c639977a7223c2d96a9f70b5fd8b1d513f8c5b69dcaed4.data b/test/repo-example/blocks/122052c6/122052c63c7775396b3f82c639977a7223c2d96a9f70b5fd8b1d513f8c5b69dcaed4.data similarity index 100% rename from tests/repo-example/blocks/122052c6/122052c63c7775396b3f82c639977a7223c2d96a9f70b5fd8b1d513f8c5b69dcaed4.data rename to test/repo-example/blocks/122052c6/122052c63c7775396b3f82c639977a7223c2d96a9f70b5fd8b1d513f8c5b69dcaed4.data diff --git a/tests/repo-example/blocks/12205994/122059948439065f29619ef41280cbb932be52c56d99c5966b65e0111239f098bbef.data b/test/repo-example/blocks/12205994/122059948439065f29619ef41280cbb932be52c56d99c5966b65e0111239f098bbef.data similarity index 100% rename from tests/repo-example/blocks/12205994/122059948439065f29619ef41280cbb932be52c56d99c5966b65e0111239f098bbef.data rename to test/repo-example/blocks/12205994/122059948439065f29619ef41280cbb932be52c56d99c5966b65e0111239f098bbef.data diff --git a/tests/repo-example/blocks/122062ce/122062ce1f2c91a13a97b596e873b5a3346a644605d7614dca53cd3a59f7385a8abb.data b/test/repo-example/blocks/122062ce/122062ce1f2c91a13a97b596e873b5a3346a644605d7614dca53cd3a59f7385a8abb.data similarity index 100% rename from tests/repo-example/blocks/122062ce/122062ce1f2c91a13a97b596e873b5a3346a644605d7614dca53cd3a59f7385a8abb.data rename to test/repo-example/blocks/122062ce/122062ce1f2c91a13a97b596e873b5a3346a644605d7614dca53cd3a59f7385a8abb.data diff --git a/tests/repo-example/blocks/12206781/122067817186b8ff365c758f387e3ae7f28fa9367ee167c312e6d65a2e02e81ab815.data b/test/repo-example/blocks/12206781/122067817186b8ff365c758f387e3ae7f28fa9367ee167c312e6d65a2e02e81ab815.data similarity index 100% rename from tests/repo-example/blocks/12206781/122067817186b8ff365c758f387e3ae7f28fa9367ee167c312e6d65a2e02e81ab815.data rename to test/repo-example/blocks/12206781/122067817186b8ff365c758f387e3ae7f28fa9367ee167c312e6d65a2e02e81ab815.data diff --git a/tests/repo-example/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data b/test/repo-example/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data similarity index 100% rename from tests/repo-example/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data rename to test/repo-example/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data diff --git a/tests/repo-example/blocks/1220709b/1220709b2dcc5f6a90ad64d6fe3a5d202a72b057d1c7f2e682d0776a5363e2cca974.data b/test/repo-example/blocks/1220709b/1220709b2dcc5f6a90ad64d6fe3a5d202a72b057d1c7f2e682d0776a5363e2cca974.data similarity index 100% rename from tests/repo-example/blocks/1220709b/1220709b2dcc5f6a90ad64d6fe3a5d202a72b057d1c7f2e682d0776a5363e2cca974.data rename to test/repo-example/blocks/1220709b/1220709b2dcc5f6a90ad64d6fe3a5d202a72b057d1c7f2e682d0776a5363e2cca974.data diff --git a/tests/repo-example/blocks/12207fb8/12207fb898b5d7be46d85feb75d894e16cfa9a7ae5533f8e997cdab2ebadd7506340.data b/test/repo-example/blocks/12207fb8/12207fb898b5d7be46d85feb75d894e16cfa9a7ae5533f8e997cdab2ebadd7506340.data similarity index 100% rename from tests/repo-example/blocks/12207fb8/12207fb898b5d7be46d85feb75d894e16cfa9a7ae5533f8e997cdab2ebadd7506340.data rename to test/repo-example/blocks/12207fb8/12207fb898b5d7be46d85feb75d894e16cfa9a7ae5533f8e997cdab2ebadd7506340.data diff --git a/tests/repo-example/blocks/12208b87/12208b872ca4ee517608331696dd6b3e5cf3497a7845ee8f94456ccf4d1d2f6602b5.data b/test/repo-example/blocks/12208b87/12208b872ca4ee517608331696dd6b3e5cf3497a7845ee8f94456ccf4d1d2f6602b5.data similarity index 100% rename from tests/repo-example/blocks/12208b87/12208b872ca4ee517608331696dd6b3e5cf3497a7845ee8f94456ccf4d1d2f6602b5.data rename to test/repo-example/blocks/12208b87/12208b872ca4ee517608331696dd6b3e5cf3497a7845ee8f94456ccf4d1d2f6602b5.data diff --git a/tests/repo-example/blocks/122090c0/122090c07a7795c1193510a696d1fdfc0f1e4947cff8e422610996e609dbcb976598.data b/test/repo-example/blocks/122090c0/122090c07a7795c1193510a696d1fdfc0f1e4947cff8e422610996e609dbcb976598.data similarity index 100% rename from tests/repo-example/blocks/122090c0/122090c07a7795c1193510a696d1fdfc0f1e4947cff8e422610996e609dbcb976598.data rename to test/repo-example/blocks/122090c0/122090c07a7795c1193510a696d1fdfc0f1e4947cff8e422610996e609dbcb976598.data diff --git a/tests/repo-example/blocks/1220929a/1220929a303c39da8a0b67c09697462f687a00c638bcb580feae06452e0c1f20b4.data b/test/repo-example/blocks/1220929a/1220929a303c39da8a0b67c09697462f687a00c638bcb580feae06452e0c1f20b4.data similarity index 100% rename from tests/repo-example/blocks/1220929a/1220929a303c39da8a0b67c09697462f687a00c638bcb580feae06452e0c1f20b4.data rename to test/repo-example/blocks/1220929a/1220929a303c39da8a0b67c09697462f687a00c638bcb580feae06452e0c1f20b4.data diff --git a/tests/repo-example/blocks/1220933b/1220933b41d37fd4508cdff45930dff56baef91c7dc345e73d049ab570abe10dfbb9.data b/test/repo-example/blocks/1220933b/1220933b41d37fd4508cdff45930dff56baef91c7dc345e73d049ab570abe10dfbb9.data similarity index 100% rename from tests/repo-example/blocks/1220933b/1220933b41d37fd4508cdff45930dff56baef91c7dc345e73d049ab570abe10dfbb9.data rename to test/repo-example/blocks/1220933b/1220933b41d37fd4508cdff45930dff56baef91c7dc345e73d049ab570abe10dfbb9.data diff --git a/tests/repo-example/blocks/1220a52c/1220a52c3602030cb912edfe4de97002fdadf9d45666c3be122a2efb5db93c1d5fa6.data b/test/repo-example/blocks/1220a52c/1220a52c3602030cb912edfe4de97002fdadf9d45666c3be122a2efb5db93c1d5fa6.data similarity index 100% rename from tests/repo-example/blocks/1220a52c/1220a52c3602030cb912edfe4de97002fdadf9d45666c3be122a2efb5db93c1d5fa6.data rename to test/repo-example/blocks/1220a52c/1220a52c3602030cb912edfe4de97002fdadf9d45666c3be122a2efb5db93c1d5fa6.data diff --git a/tests/repo-example/blocks/1220c0fc/1220c0fc6b49543d7bf04e83d2a5a7cbe72a83e80f9c7bca1abcaa42298a57a33ff5.data b/test/repo-example/blocks/1220c0fc/1220c0fc6b49543d7bf04e83d2a5a7cbe72a83e80f9c7bca1abcaa42298a57a33ff5.data similarity index 100% rename from tests/repo-example/blocks/1220c0fc/1220c0fc6b49543d7bf04e83d2a5a7cbe72a83e80f9c7bca1abcaa42298a57a33ff5.data rename to test/repo-example/blocks/1220c0fc/1220c0fc6b49543d7bf04e83d2a5a7cbe72a83e80f9c7bca1abcaa42298a57a33ff5.data diff --git a/tests/repo-example/blocks/1220e3b0/1220e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.data b/test/repo-example/blocks/1220e3b0/1220e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.data similarity index 100% rename from tests/repo-example/blocks/1220e3b0/1220e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.data rename to test/repo-example/blocks/1220e3b0/1220e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.data diff --git a/tests/repo-example/blocks/1220e605/1220e605408ac3f78113ac9a7fd486441317afc9f967abe2aa05e7c641f7bbe98a37.data b/test/repo-example/blocks/1220e605/1220e605408ac3f78113ac9a7fd486441317afc9f967abe2aa05e7c641f7bbe98a37.data similarity index 100% rename from tests/repo-example/blocks/1220e605/1220e605408ac3f78113ac9a7fd486441317afc9f967abe2aa05e7c641f7bbe98a37.data rename to test/repo-example/blocks/1220e605/1220e605408ac3f78113ac9a7fd486441317afc9f967abe2aa05e7c641f7bbe98a37.data diff --git a/tests/repo-example/blocks/1220e6a0/1220e6a045864ff8569e43e4866c0af807def07b0db2f018808620eb30b980e94011.data b/test/repo-example/blocks/1220e6a0/1220e6a045864ff8569e43e4866c0af807def07b0db2f018808620eb30b980e94011.data similarity index 100% rename from tests/repo-example/blocks/1220e6a0/1220e6a045864ff8569e43e4866c0af807def07b0db2f018808620eb30b980e94011.data rename to test/repo-example/blocks/1220e6a0/1220e6a045864ff8569e43e4866c0af807def07b0db2f018808620eb30b980e94011.data diff --git a/tests/repo-example/blocks/1220ec5b/1220ec5b533a3218991f4377b8b8c2538b95dd29d31eac6433af0fb6fcd83dd80778.data b/test/repo-example/blocks/1220ec5b/1220ec5b533a3218991f4377b8b8c2538b95dd29d31eac6433af0fb6fcd83dd80778.data similarity index 100% rename from tests/repo-example/blocks/1220ec5b/1220ec5b533a3218991f4377b8b8c2538b95dd29d31eac6433af0fb6fcd83dd80778.data rename to test/repo-example/blocks/1220ec5b/1220ec5b533a3218991f4377b8b8c2538b95dd29d31eac6433af0fb6fcd83dd80778.data diff --git a/tests/repo-example/config b/test/repo-example/config similarity index 100% rename from tests/repo-example/config rename to test/repo-example/config diff --git a/tests/repo-example/datastore/000002.ldb b/test/repo-example/datastore/000002.ldb similarity index 100% rename from tests/repo-example/datastore/000002.ldb rename to test/repo-example/datastore/000002.ldb diff --git a/tests/repo-example/datastore/000005.ldb b/test/repo-example/datastore/000005.ldb similarity index 100% rename from tests/repo-example/datastore/000005.ldb rename to test/repo-example/datastore/000005.ldb diff --git a/tests/repo-example/datastore/CURRENT b/test/repo-example/datastore/CURRENT similarity index 100% rename from tests/repo-example/datastore/CURRENT rename to test/repo-example/datastore/CURRENT diff --git a/tests/repo-example/datastore/LOCK b/test/repo-example/datastore/LOCK similarity index 100% rename from tests/repo-example/datastore/LOCK rename to test/repo-example/datastore/LOCK diff --git a/tests/repo-example/datastore/LOG b/test/repo-example/datastore/LOG similarity index 100% rename from tests/repo-example/datastore/LOG rename to test/repo-example/datastore/LOG diff --git a/tests/repo-example/datastore/LOG.old b/test/repo-example/datastore/LOG.old similarity index 100% rename from tests/repo-example/datastore/LOG.old rename to test/repo-example/datastore/LOG.old diff --git a/tests/repo-example/datastore/MANIFEST-000007 b/test/repo-example/datastore/MANIFEST-000007 similarity index 100% rename from tests/repo-example/datastore/MANIFEST-000007 rename to test/repo-example/datastore/MANIFEST-000007 diff --git a/tests/repo-example/version b/test/repo-example/version similarity index 100% rename from tests/repo-example/version rename to test/repo-example/version diff --git a/test/repo-tests1457120896998/blocks/1220120f/1220120f6af601d46e10b2d2e11ed71c55d25f3042c22501e41d1246e7a1e9d3d8ec.data b/test/repo-tests1457120896998/blocks/1220120f/1220120f6af601d46e10b2d2e11ed71c55d25f3042c22501e41d1246e7a1e9d3d8ec.data new file mode 100644 index 00000000..389e1117 --- /dev/null +++ b/test/repo-tests1457120896998/blocks/1220120f/1220120f6af601d46e10b2d2e11ed71c55d25f3042c22501e41d1246e7a1e9d3d8ec.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/repo-tests1457120896998/blocks/122031d6/122031d6da265092f1b03fec969243fdcf095c1d219356cdf538ffce705a52d5738d.data b/test/repo-tests1457120896998/blocks/122031d6/122031d6da265092f1b03fec969243fdcf095c1d219356cdf538ffce705a52d5738d.data new file mode 100644 index 00000000..5ea0edda Binary files /dev/null and b/test/repo-tests1457120896998/blocks/122031d6/122031d6da265092f1b03fec969243fdcf095c1d219356cdf538ffce705a52d5738d.data differ diff --git a/test/repo-tests1457120896998/blocks/122031e7/122031e7a41c15d03feb8cd793c3348ea3b310512d7767a9abfbd7a928a85e977173.data b/test/repo-tests1457120896998/blocks/122031e7/122031e7a41c15d03feb8cd793c3348ea3b310512d7767a9abfbd7a928a85e977173.data new file mode 100644 index 00000000..ecce1053 --- /dev/null +++ b/test/repo-tests1457120896998/blocks/122031e7/122031e7a41c15d03feb8cd793c3348ea3b310512d7767a9abfbd7a928a85e977173.data @@ -0,0 +1,4 @@ +5 +" ���׾F�_�uؔ�l��z�S?��|ڲ��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 new file mode 100644 index 00000000..bbe6bda7 Binary files /dev/null and b/test/repo-tests1457120896998/blocks/12203628/12203628a4a19525dd84bbbffe132ec0b0d3be3528fbbcc814feb7f2fbf71ca06162.data differ diff --git a/test/repo-tests1457120896998/blocks/12204a5a/12204a5a95586f52e25811cf214677160e64383755a8c5163ba3c053c3b65777ed16.data b/test/repo-tests1457120896998/blocks/12204a5a/12204a5a95586f52e25811cf214677160e64383755a8c5163ba3c053c3b65777ed16.data new file mode 100644 index 00000000..41456196 --- /dev/null +++ b/test/repo-tests1457120896998/blocks/12204a5a/12204a5a95586f52e25811cf214677160e64383755a8c5163ba3c053c3b65777ed16.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/repo-tests1457120896998/blocks/12205200/12205200cc6b6f79e1588480d9f9016ccadfda3d8bc7d2f8cdf302aa51dae8dae9da.data b/test/repo-tests1457120896998/blocks/12205200/12205200cc6b6f79e1588480d9f9016ccadfda3d8bc7d2f8cdf302aa51dae8dae9da.data new file mode 100644 index 00000000..10aa2ae4 Binary files /dev/null and b/test/repo-tests1457120896998/blocks/12205200/12205200cc6b6f79e1588480d9f9016ccadfda3d8bc7d2f8cdf302aa51dae8dae9da.data differ diff --git a/test/repo-tests1457120896998/blocks/122052c6/122052c63c7775396b3f82c639977a7223c2d96a9f70b5fd8b1d513f8c5b69dcaed4.data b/test/repo-tests1457120896998/blocks/122052c6/122052c63c7775396b3f82c639977a7223c2d96a9f70b5fd8b1d513f8c5b69dcaed4.data new file mode 100644 index 00000000..951bfe04 --- /dev/null +++ b/test/repo-tests1457120896998/blocks/122052c6/122052c63c7775396b3f82c639977a7223c2d96a9f70b5fd8b1d513f8c5b69dcaed4.data @@ -0,0 +1,23 @@ + +�� 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 new file mode 100644 index 00000000..9553a942 --- /dev/null +++ b/test/repo-tests1457120896998/blocks/12205994/122059948439065f29619ef41280cbb932be52c56d99c5966b65e0111239f098bbef.data @@ -0,0 +1,2 @@ + + \ No newline at end of file diff --git a/test/repo-tests1457120896998/blocks/122062ce/122062ce1f2c91a13a97b596e873b5a3346a644605d7614dca53cd3a59f7385a8abb.data b/test/repo-tests1457120896998/blocks/122062ce/122062ce1f2c91a13a97b596e873b5a3346a644605d7614dca53cd3a59f7385a8abb.data new file mode 100644 index 00000000..2dd80560 --- /dev/null +++ b/test/repo-tests1457120896998/blocks/122062ce/122062ce1f2c91a13a97b596e873b5a3346a644605d7614dca53cd3a59f7385a8abb.data @@ -0,0 +1,114 @@ + +� � # 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 new file mode 100644 index 00000000..a8f98693 Binary files /dev/null and b/test/repo-tests1457120896998/blocks/12206781/122067817186b8ff365c758f387e3ae7f28fa9367ee167c312e6d65a2e02e81ab815.data differ diff --git a/test/repo-tests1457120896998/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data b/test/repo-tests1457120896998/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data new file mode 100644 index 00000000..74de75af Binary files /dev/null and b/test/repo-tests1457120896998/blocks/12207028/122070286b9afa6620a66f715c7020d68af3d10e1a497971629c07606bfdb812303d.data differ diff --git a/test/repo-tests1457120896998/blocks/1220709b/1220709b2dcc5f6a90ad64d6fe3a5d202a72b057d1c7f2e682d0776a5363e2cca974.data b/test/repo-tests1457120896998/blocks/1220709b/1220709b2dcc5f6a90ad64d6fe3a5d202a72b057d1c7f2e682d0776a5363e2cca974.data new file mode 100644 index 00000000..3a99c365 --- /dev/null +++ b/test/repo-tests1457120896998/blocks/1220709b/1220709b2dcc5f6a90ad64d6fe3a5d202a72b057d1c7f2e682d0776a5363e2cca974.data @@ -0,0 +1,3 @@ +4 +" Y��9_)a���˹2�R�m�Ŗke�9�� 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 new file mode 100644 index 00000000..ee87b9db --- /dev/null +++ b/test/repo-tests1457120896998/blocks/12207fb8/12207fb898b5d7be46d85feb75d894e16cfa9a7ae5533f8e997cdab2ebadd7506340.data @@ -0,0 +1,4 @@ +0 +" ��,��Qv3��k>\�IzxEEl�M/f�LICENSE�1 +" JZ�XoR�X�!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 new file mode 100644 index 00000000..3da92595 --- /dev/null +++ b/test/repo-tests1457120896998/blocks/12208b87/12208b872ca4ee517608331696dd6b3e5cf3497a7845ee8f94456ccf4d1d2f6602b5.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/repo-tests1457120896998/blocks/122090c0/122090c07a7795c1193510a696d1fdfc0f1e4947cff8e422610996e609dbcb976598.data b/test/repo-tests1457120896998/blocks/122090c0/122090c07a7795c1193510a696d1fdfc0f1e4947cff8e422610996e609dbcb976598.data new file mode 100644 index 00000000..71be805f --- /dev/null +++ b/test/repo-tests1457120896998/blocks/122090c0/122090c07a7795c1193510a696d1fdfc0f1e4947cff8e422610996e609dbcb976598.data @@ -0,0 +1,9 @@ + +��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 new file mode 100644 index 00000000..62d1c297 --- /dev/null +++ b/test/repo-tests1457120896998/blocks/1220929a/1220929a303c39da8a0b67c09697462f687a00c638bcb580feae06452e0c1f20b4.data @@ -0,0 +1,8 @@ + +��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 new file mode 100644 index 00000000..d899663b Binary files /dev/null and b/test/repo-tests1457120896998/blocks/1220933b/1220933b41d37fd4508cdff45930dff56baef91c7dc345e73d049ab570abe10dfbb9.data differ diff --git a/test/repo-tests1457120896998/blocks/1220a52c/1220a52c3602030cb912edfe4de97002fdadf9d45666c3be122a2efb5db93c1d5fa6.data b/test/repo-tests1457120896998/blocks/1220a52c/1220a52c3602030cb912edfe4de97002fdadf9d45666c3be122a2efb5db93c1d5fa6.data new file mode 100644 index 00000000..627ffcdf --- /dev/null +++ b/test/repo-tests1457120896998/blocks/1220a52c/1220a52c3602030cb912edfe4de97002fdadf9d45666c3be122a2efb5db93c1d5fa6.data @@ -0,0 +1,55 @@ + +� � + 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 new file mode 100644 index 00000000..c9885c45 Binary files /dev/null and b/test/repo-tests1457120896998/blocks/1220c0fc/1220c0fc6b49543d7bf04e83d2a5a7cbe72a83e80f9c7bca1abcaa42298a57a33ff5.data differ diff --git a/tests/test-data/empty.txt b/test/repo-tests1457120896998/blocks/1220e3b0/1220e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.data similarity index 100% rename from tests/test-data/empty.txt rename to test/repo-tests1457120896998/blocks/1220e3b0/1220e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855.data diff --git a/test/repo-tests1457120896998/blocks/1220e605/1220e605408ac3f78113ac9a7fd486441317afc9f967abe2aa05e7c641f7bbe98a37.data b/test/repo-tests1457120896998/blocks/1220e605/1220e605408ac3f78113ac9a7fd486441317afc9f967abe2aa05e7c641f7bbe98a37.data new file mode 100644 index 00000000..b6539897 Binary files /dev/null and b/test/repo-tests1457120896998/blocks/1220e605/1220e605408ac3f78113ac9a7fd486441317afc9f967abe2aa05e7c641f7bbe98a37.data differ diff --git a/test/repo-tests1457120896998/blocks/1220e6a0/1220e6a045864ff8569e43e4866c0af807def07b0db2f018808620eb30b980e94011.data b/test/repo-tests1457120896998/blocks/1220e6a0/1220e6a045864ff8569e43e4866c0af807def07b0db2f018808620eb30b980e94011.data new file mode 100644 index 00000000..6860441a --- /dev/null +++ b/test/repo-tests1457120896998/blocks/1220e6a0/1220e6a045864ff8569e43e4866c0af807def07b0db2f018808620eb30b980e94011.data @@ -0,0 +1,3 @@ +/ +" g�q���6\u�8~:��6~�g���Z.��direct�T2 +" 6(���%݄���.��Ӿ5(���������ab recursive�T \ No newline at end of file diff --git a/test/repo-tests1457120896998/blocks/1220ec5b/1220ec5b533a3218991f4377b8b8c2538b95dd29d31eac6433af0fb6fcd83dd80778.data b/test/repo-tests1457120896998/blocks/1220ec5b/1220ec5b533a3218991f4377b8b8c2538b95dd29d31eac6433af0fb6fcd83dd80778.data new file mode 100644 index 00000000..7b58d6c8 --- /dev/null +++ b/test/repo-tests1457120896998/blocks/1220ec5b/1220ec5b533a3218991f4377b8b8c2538b95dd29d31eac6433af0fb6fcd83dd80778.data @@ -0,0 +1,3 @@ +/ +" �@������ԆD���g����A���7direct�T2 +" �;A��P���Y0��k��}�E�=��p�� �� recursive�T \ No newline at end of file diff --git a/test/repo-tests1457120896998/config b/test/repo-tests1457120896998/config new file mode 100644 index 00000000..cbcdfe3b --- /dev/null +++ b/test/repo-tests1457120896998/config @@ -0,0 +1 @@ +{"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 new file mode 100644 index 00000000..fc04d660 Binary files /dev/null and b/test/repo-tests1457120896998/datastore/000002.ldb differ diff --git a/test/repo-tests1457120896998/datastore/000005.ldb b/test/repo-tests1457120896998/datastore/000005.ldb new file mode 100644 index 00000000..63d9d260 Binary files /dev/null and b/test/repo-tests1457120896998/datastore/000005.ldb differ diff --git a/test/repo-tests1457120896998/datastore/CURRENT b/test/repo-tests1457120896998/datastore/CURRENT new file mode 100644 index 00000000..875cf233 --- /dev/null +++ b/test/repo-tests1457120896998/datastore/CURRENT @@ -0,0 +1 @@ +MANIFEST-000007 diff --git a/test/repo-tests1457120896998/datastore/LOCK b/test/repo-tests1457120896998/datastore/LOCK new file mode 100644 index 00000000..e69de29b diff --git a/test/repo-tests1457120896998/datastore/LOG b/test/repo-tests1457120896998/datastore/LOG new file mode 100644 index 00000000..863b68fd --- /dev/null +++ b/test/repo-tests1457120896998/datastore/LOG @@ -0,0 +1,10 @@ +=============== 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 new file mode 100644 index 00000000..708351e7 --- /dev/null +++ b/test/repo-tests1457120896998/datastore/LOG.old @@ -0,0 +1,10 @@ +=============== 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 new file mode 100644 index 00000000..6af3b545 Binary files /dev/null and b/test/repo-tests1457120896998/datastore/MANIFEST-000007 differ diff --git a/test/repo-tests1457120896998/version b/test/repo-tests1457120896998/version new file mode 100644 index 00000000..00750edc --- /dev/null +++ b/test/repo-tests1457120896998/version @@ -0,0 +1 @@ +3 diff --git a/tests/test-data/1.2MiB.txt b/test/test-data/1.2MiB.txt similarity index 100% rename from tests/test-data/1.2MiB.txt rename to test/test-data/1.2MiB.txt diff --git a/tests/test-data/1.2MiB.txt.block b/test/test-data/1.2MiB.txt.block similarity index 100% rename from tests/test-data/1.2MiB.txt.block rename to test/test-data/1.2MiB.txt.block diff --git a/tests/test-data/1.2MiB.txt.link-block0 b/test/test-data/1.2MiB.txt.link-block0 similarity index 100% rename from tests/test-data/1.2MiB.txt.link-block0 rename to test/test-data/1.2MiB.txt.link-block0 diff --git a/tests/test-data/1.2MiB.txt.link-block1 b/test/test-data/1.2MiB.txt.link-block1 similarity index 100% rename from tests/test-data/1.2MiB.txt.link-block1 rename to test/test-data/1.2MiB.txt.link-block1 diff --git a/tests/test-data/1.2MiB.txt.link-block2 b/test/test-data/1.2MiB.txt.link-block2 similarity index 100% rename from tests/test-data/1.2MiB.txt.link-block2 rename to test/test-data/1.2MiB.txt.link-block2 diff --git a/tests/test-data/1.2MiB.txt.link-block3 b/test/test-data/1.2MiB.txt.link-block3 similarity index 100% rename from tests/test-data/1.2MiB.txt.link-block3 rename to test/test-data/1.2MiB.txt.link-block3 diff --git a/tests/test-data/1.2MiB.txt.link-block4 b/test/test-data/1.2MiB.txt.link-block4 similarity index 100% rename from tests/test-data/1.2MiB.txt.link-block4 rename to test/test-data/1.2MiB.txt.link-block4 diff --git a/tests/test-data/1.2MiB.txt.unixfs-file b/test/test-data/1.2MiB.txt.unixfs-file similarity index 100% rename from tests/test-data/1.2MiB.txt.unixfs-file rename to test/test-data/1.2MiB.txt.unixfs-file diff --git a/tests/test-data/1.2MiB.txt.unixfs-raw0 b/test/test-data/1.2MiB.txt.unixfs-raw0 similarity index 100% rename from tests/test-data/1.2MiB.txt.unixfs-raw0 rename to test/test-data/1.2MiB.txt.unixfs-raw0 diff --git a/tests/test-data/1.2MiB.txt.unixfs-raw1 b/test/test-data/1.2MiB.txt.unixfs-raw1 similarity index 100% rename from tests/test-data/1.2MiB.txt.unixfs-raw1 rename to test/test-data/1.2MiB.txt.unixfs-raw1 diff --git a/tests/test-data/1.2MiB.txt.unixfs-raw2 b/test/test-data/1.2MiB.txt.unixfs-raw2 similarity index 100% rename from tests/test-data/1.2MiB.txt.unixfs-raw2 rename to test/test-data/1.2MiB.txt.unixfs-raw2 diff --git a/tests/test-data/1.2MiB.txt.unixfs-raw3 b/test/test-data/1.2MiB.txt.unixfs-raw3 similarity index 100% rename from tests/test-data/1.2MiB.txt.unixfs-raw3 rename to test/test-data/1.2MiB.txt.unixfs-raw3 diff --git a/tests/test-data/1.2MiB.txt.unixfs-raw4 b/test/test-data/1.2MiB.txt.unixfs-raw4 similarity index 100% rename from tests/test-data/1.2MiB.txt.unixfs-raw4 rename to test/test-data/1.2MiB.txt.unixfs-raw4 diff --git a/tests/test-data/1MiB.txt b/test/test-data/1MiB.txt similarity index 100% rename from tests/test-data/1MiB.txt rename to test/test-data/1MiB.txt diff --git a/tests/test-data/200Bytes.txt b/test/test-data/200Bytes.txt similarity index 100% rename from tests/test-data/200Bytes.txt rename to test/test-data/200Bytes.txt diff --git a/tests/test-data/200Bytes.txt.block b/test/test-data/200Bytes.txt.block similarity index 100% rename from tests/test-data/200Bytes.txt.block rename to test/test-data/200Bytes.txt.block diff --git a/tests/test-data/200Bytes.txt.unixfs-file b/test/test-data/200Bytes.txt.unixfs-file similarity index 100% rename from tests/test-data/200Bytes.txt.unixfs-file rename to test/test-data/200Bytes.txt.unixfs-file diff --git a/tests/test-data/dir-big.block b/test/test-data/dir-big.block similarity index 100% rename from tests/test-data/dir-big.block rename to test/test-data/dir-big.block diff --git a/tests/test-data/dir-big.unixfs-dir b/test/test-data/dir-big.unixfs-dir similarity index 100% rename from tests/test-data/dir-big.unixfs-dir rename to test/test-data/dir-big.unixfs-dir diff --git a/tests/test-data/dir-big/1.2MiB.txt b/test/test-data/dir-big/1.2MiB.txt similarity index 100% rename from tests/test-data/dir-big/1.2MiB.txt rename to test/test-data/dir-big/1.2MiB.txt diff --git a/tests/test-data/dir-nested.block b/test/test-data/dir-nested.block similarity index 100% rename from tests/test-data/dir-nested.block rename to test/test-data/dir-nested.block diff --git a/tests/test-data/dir-nested/200Bytes.txt b/test/test-data/dir-nested/200Bytes.txt similarity index 100% rename from tests/test-data/dir-nested/200Bytes.txt rename to test/test-data/dir-nested/200Bytes.txt diff --git a/tests/test-data/dir-nested/level-1/200Bytes.txt b/test/test-data/dir-nested/level-1/200Bytes.txt similarity index 100% rename from tests/test-data/dir-nested/level-1/200Bytes.txt rename to test/test-data/dir-nested/level-1/200Bytes.txt diff --git a/tests/test-data/dir-small.block b/test/test-data/dir-small.block similarity index 100% rename from tests/test-data/dir-small.block rename to test/test-data/dir-small.block diff --git a/tests/test-data/dir-small.unixfs-dir b/test/test-data/dir-small.unixfs-dir similarity index 100% rename from tests/test-data/dir-small.unixfs-dir rename to test/test-data/dir-small.unixfs-dir diff --git a/tests/test-data/dir-small/200Bytes.txt b/test/test-data/dir-small/200Bytes.txt similarity index 100% rename from tests/test-data/dir-small/200Bytes.txt rename to test/test-data/dir-small/200Bytes.txt diff --git a/test/test-data/empty.txt b/test/test-data/empty.txt new file mode 100644 index 00000000..e69de29b diff --git a/tests/test-data/test-file.txt b/test/test-data/test-file.txt similarity index 100% rename from tests/test-data/test-file.txt rename to test/test-data/test-file.txt diff --git a/tests/test-data/test-file.txt.link-block0 b/test/test-data/test-file.txt.link-block0 similarity index 100% rename from tests/test-data/test-file.txt.link-block0 rename to test/test-data/test-file.txt.link-block0 diff --git a/test/test-fixed-size-chunker.js b/test/test-fixed-size-chunker.js new file mode 100644 index 00000000..2cc0ccac --- /dev/null +++ b/test/test-fixed-size-chunker.js @@ -0,0 +1,65 @@ +/* eslint-env mocha */ +'use strict' + +const FixedSizeChunker = require('./../src/chunker-fixed-size') +const fs = require('fs') +const expect = require('chai').expect +const stringToStream = require('string-to-stream') +const through = require('through2') +const path = require('path') +const isNode = !global.window + +let fileStream +if (isNode) { + fileStream = function () { + return fs.createReadStream(path.join(__dirname, '/test-data/1MiB.txt')) + } +} else { + const myFile = require('buffer!./test-data/1MiB.txt') + fileStream = function () { + return stringToStream(myFile) + } +} + +describe('chunker: fixed size', function () { + it('256 Bytes chunks', function (done) { + fileStream() + .pipe(FixedSizeChunker(256)) + .pipe(through((chunk, enc, cb) => { + expect(chunk.length).to.equal(256) + cb() + }, () => { + done() + })) + }) + + it('256 KiB chunks', function (done) { + const KiB256 = 262144 + fileStream() + .pipe(FixedSizeChunker(KiB256)) + .pipe(through((chunk, enc, cb) => { + expect(chunk.length).to.equal(KiB256) + cb() + }, () => { + done() + })) + }) + + it('256 KiB chunks of non scalar filesize', function (done) { + let counter = 0 + const KiB256 = 262144 + fileStream() + .pipe(FixedSizeChunker(KiB256)) + .pipe(through((chunk, enc, cb) => { + if (chunk.length < KiB256) { + expect(counter).to.be.below(2) + counter += 1 + return cb() + } + expect(chunk.length).to.equal(KiB256) + cb() + }, () => { + done() + })) + }) +}) diff --git a/tests/test-import.js b/test/test-import.js similarity index 91% rename from tests/test-import.js rename to test/test-import.js index 4d2f0142..6efd93bc 100644 --- a/tests/test-import.js +++ b/test/test-import.js @@ -1,4 +1,6 @@ /* eslint-env mocha */ +'use strict' + const importer = require('./../src') const expect = require('chai').expect const IPFSRepo = require('ipfs-repo') @@ -31,7 +33,7 @@ describe('layout: importer', function () { } }) - var ds + let ds it('start dag service', function (done) { const options = { @@ -45,8 +47,8 @@ describe('layout: importer', function () { version: fsBlobStore } } - var repo = new IPFSRepo(process.env.IPFS_PATH, options) - var bs = new BlockService(repo) + const repo = new IPFSRepo(process.env.IPFS_PATH, options) + const bs = new BlockService(repo) ds = new DAGService(bs) expect(bs).to.exist expect(ds).to.exist @@ -66,7 +68,7 @@ describe('layout: importer', function () { ds.get(stat.Hash, (err, node) => { expect(err).to.not.exist const smallDAGNode = new DAGNode() - var buf = fs.readFileSync(small + '.block') + const buf = fs.readFileSync(small + '.block') smallDAGNode.unMarshal(buf) expect(node.size()).to.equal(smallDAGNode.size()) expect(node.multihash()).to.deep.equal(smallDAGNode.multihash()) @@ -82,7 +84,7 @@ describe('layout: importer', function () { expect(err).to.not.exist const bigDAGNode = new DAGNode() - var buf = fs.readFileSync(big + '.block') + const buf = fs.readFileSync(big + '.block') bigDAGNode.unMarshal(buf) expect(node.size()).to.equal(bigDAGNode.size()) expect(node.links).to.deep.equal(bigDAGNode.links) @@ -100,7 +102,7 @@ describe('layout: importer', function () { ds.get(node.links[0].hash, (err, node) => { expect(err).to.not.exist const leaf = new DAGNode() - var buf2 = fs.readFileSync(big + '.link-block0') + const buf2 = fs.readFileSync(big + '.link-block0') leaf.unMarshal(buf2) expect(node.links).to.deep.equal(leaf.links) expect(node.links.length).to.equal(0) @@ -129,7 +131,7 @@ describe('layout: importer', function () { ds.get(stats.Hash, (err, node) => { expect(err).to.not.exist const dirSmallNode = new DAGNode() - var buf = fs.readFileSync(dirSmall + '.block') + const buf = fs.readFileSync(dirSmall + '.block') dirSmallNode.unMarshal(buf) expect(node.links).to.deep.equal(dirSmallNode.links) @@ -156,7 +158,7 @@ describe('layout: importer', function () { ds.get(stats.Hash, (err, node) => { expect(err).to.not.exist const dirNode = new DAGNode() - var buf = fs.readFileSync(dirBig + '.block') + const buf = fs.readFileSync(dirBig + '.block') dirNode.unMarshal(buf) expect(node.links).to.deep.equal(dirNode.links) @@ -186,7 +188,7 @@ describe('layout: importer', function () { expect(node.links.length).to.equal(3) const dirNode = new DAGNode() - var buf = fs.readFileSync(dirNested + '.block') + const buf = fs.readFileSync(dirNested + '.block') dirNode.unMarshal(buf) expect(node.links).to.deep.equal(dirNode.links) expect(node.data).to.deep.equal(dirNode.data) @@ -197,13 +199,13 @@ describe('layout: importer', function () { it('import a small buffer', (done) => { // this is just like "import a small file" - var buf = fs.readFileSync(path.join(__dirname, '/test-data/200Bytes.txt')) + const buf = fs.readFileSync(path.join(__dirname, '/test-data/200Bytes.txt')) importer.import(buf, ds, function (err, stat) { expect(err).to.not.exist ds.get(stat.Hash, (err, node) => { expect(err).to.not.exist const smallDAGNode = new DAGNode() - var marbuf = fs.readFileSync(small + '.block') + const marbuf = fs.readFileSync(small + '.block') smallDAGNode.unMarshal(marbuf) expect(node.size()).to.equal(smallDAGNode.size()) expect(node.multihash()).to.deep.equal(smallDAGNode.multihash()) @@ -214,14 +216,14 @@ describe('layout: importer', function () { it('import a big buffer', (done) => { // this is just like "import a big file" - var buf = fs.readFileSync(path.join(__dirname, '/test-data/1.2MiB.txt')) + const buf = fs.readFileSync(path.join(__dirname, '/test-data/1.2MiB.txt')) importer.import(buf, ds, function (err, stat) { expect(err).to.not.exist ds.get(stat.Hash, (err, node) => { expect(err).to.not.exist const bigDAGNode = new DAGNode() - var marbuf = fs.readFileSync(big + '.block') + const marbuf = fs.readFileSync(big + '.block') bigDAGNode.unMarshal(marbuf) expect(node.size()).to.equal(bigDAGNode.size()) expect(node.links).to.deep.equal(bigDAGNode.links) @@ -240,7 +242,7 @@ describe('layout: importer', function () { expect(err).to.not.exist const leaf = new DAGNode() - var marbuf2 = fs.readFileSync(big + '.link-block0') + const marbuf2 = fs.readFileSync(big + '.link-block0') leaf.unMarshal(marbuf2) expect(node.links).to.deep.equal(leaf.links) expect(node.links.length).to.equal(0) @@ -266,7 +268,7 @@ describe('layout: importer', function () { it.skip('export a file by hash', (done) => { // TODO Create tests and function for exporting data - var hash = 'QmW7BDxEbGqxxSYVtn3peNPQgdDXbWkoQ6J1EFYAEuQV3Q' + const hash = 'QmW7BDxEbGqxxSYVtn3peNPQgdDXbWkoQ6J1EFYAEuQV3Q' importer.export({ hash: hash, dagService: ds @@ -276,4 +278,3 @@ describe('layout: importer', function () { }) }) }) -