Skip to content
This repository was archived by the owner on Aug 12, 2020. It is now read-only.

Commit ab15916

Browse files
committed
Merge pull request #13 from ipfs/dignified
Setup dignified.js
2 parents efa0dcb + 9ef6028 commit ab15916

File tree

103 files changed

+425
-92
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+425
-92
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,6 @@ build/Release
2929
# Dependency directory
3030
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
3131
node_modules
32+
33+
dist
34+
lib

karma.conf.js

-54
This file was deleted.

package.json

+10-9
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,20 @@
44
"description": "JavaScript implementation of the layout and chunking mechanisms used by IPFS",
55
"main": "src/index.js",
66
"scripts": {
7-
"lint": "standard",
8-
"test": "npm run test:node && npm run test:browser",
9-
"test:node": "mocha tests/index.js",
10-
"test:browser": "karma start karma.conf.js"
7+
"lint": "dignified-lint",
8+
"build": "dignified-build",
9+
"test": "dignified-test",
10+
"test:node": "dignified-test node",
11+
"test:browser": "dignified-test browser",
12+
"release": "dignified-release"
1113
},
1214
"pre-commit": [
1315
"lint",
1416
"test"
1517
],
1618
"repository": {
1719
"type": "git",
18-
"url": "git+https://github.com/diasdavid/js-ipfs-data-importing.git"
20+
"url": "git+https://github.com/ipfs/js-ipfs-data-importing.git"
1921
},
2022
"keywords": [
2123
"IPFS"
@@ -28,9 +30,11 @@
2830
"homepage": "https://github.com/diasdavid/js-ipfs-data-importing#readme",
2931
"devDependencies": {
3032
"brfs": "^1.4.3",
33+
"block-stream2": "^1.1.0",
3134
"bs58": "^3.0.0",
3235
"buffer-loader": "0.0.1",
3336
"chai": "^3.4.1",
37+
"dignified.js": "^1.0.0",
3438
"fs-blob-store": "^5.2.1",
3539
"highland": "^2.7.1",
3640
"idb-plus-blob-store": "^1.0.0",
@@ -50,10 +54,7 @@
5054
"pre-commit": "^1.1.2",
5155
"raw-loader": "^0.5.1",
5256
"rimraf": "^2.5.1",
53-
"standard": "^6.0.8",
54-
"string-to-stream": "^1.0.1",
55-
"transform-loader": "^0.2.3",
56-
"webpack": "^2.0.7-beta"
57+
"string-to-stream": "^1.0.1"
5758
},
5859
"dependencies": {
5960
"async": "^1.5.2",

src/chunker-fixed-size.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
var chunker = require('block-stream2')
1+
'use strict'
2+
3+
const chunker = require('block-stream2')
24

35
exports = module.exports = function (size) {
46
return chunker({ size: size, zeroPadding: false })

src/index.js

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
'use strict'
2+
13
const debug = require('debug')
24
const log = debug('importer')
35
log.err = debug('importer:error')
@@ -7,6 +9,7 @@ const FixedSizeChunker = require('./chunker-fixed-size')
79
const through2 = require('through2')
810
const UnixFS = require('ipfs-unixfs')
911
const async = require('async')
12+
1013
exports = module.exports
1114

1215
const CHUNK_SIZE = 262144

tests/browser.js renamed to test/browser.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/* eslint-env mocha */
2+
'use strict'
3+
24
const tests = require('./buffer-test')
35
const async = require('async')
46
const store = require('idb-plus-blob-store')
@@ -17,7 +19,7 @@ idb.deleteDatabase('ipfs/blocks')
1719
describe('IPFS data importing tests on the Browser', function () {
1820
before(function (done) {
1921
this.timeout(23000)
20-
var repoData = []
22+
const repoData = []
2123
repoContext.keys().forEach(function (key) {
2224
repoData.push({
2325
key: key.replace('./', ''),

tests/buffer-test.js renamed to test/buffer-test.js

+9-7
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
/* eslint-env mocha */
2+
'use strict'
3+
24
const importer = require('./../src')
35
const BlockService = require('ipfs-blocks').BlockService
46
const DAGService = require('ipfs-merkle-dag').DAGService
@@ -17,9 +19,9 @@ module.exports = function (repo) {
1719
describe('layout: importer', function () {
1820
it('import a small buffer', function (done) {
1921
// this is just like "import a small file"
20-
var bs = new BlockService(repo)
21-
var ds = new DAGService(bs)
22-
var buf = smallBuf
22+
const bs = new BlockService(repo)
23+
const ds = new DAGService(bs)
24+
const buf = smallBuf
2325
importer.import(buf, ds, function (err, stat) {
2426
expect(err).to.not.exist
2527
ds.get(stat.Hash, function (err, node) {
@@ -35,9 +37,9 @@ module.exports = function (repo) {
3537

3638
it('import a big buffer', function (done) {
3739
// this is just like "import a big file"
38-
var buf = bigBuf
39-
var bs = new BlockService(repo)
40-
var ds = new DAGService(bs)
40+
const buf = bigBuf
41+
const bs = new BlockService(repo)
42+
const ds = new DAGService(bs)
4143
importer.import(buf, ds, function (err, stat) {
4244
expect(err).to.not.exist
4345
ds.get(stat.Hash, function (err, node) {
@@ -61,7 +63,7 @@ module.exports = function (repo) {
6163
expect(err).to.not.exist
6264
const leaf = new DAGNode()
6365

64-
var marbuf2 = bigLink
66+
const marbuf2 = bigLink
6567
leaf.unMarshal(marbuf2)
6668
expect(node.links).to.deep.equal(leaf.links)
6769
expect(node.links.length).to.equal(0)

tests/index.js renamed to test/node.js

+5-4
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,11 @@ const fs = require('fs')
66
const ncp = require('ncp').ncp
77
const rimraf = require('rimraf')
88
const expect = require('chai').expect
9+
const path = require('path')
910

1011
describe('core', () => {
11-
const repoExample = process.cwd() + '/tests/repo-example'
12-
const repoTests = process.cwd() + '/tests/repo-tests' + Date.now()
12+
const repoExample = path.join(process.cwd(), '/test/repo-example')
13+
const repoTests = path.join(process.cwd(), '/test/repo-tests' + Date.now())
1314

1415
before((done) => {
1516
ncp(repoExample, repoTests, (err) => {
@@ -35,9 +36,9 @@ describe('core', () => {
3536
file === 'buffer-test.js' ||
3637
file.indexOf('repo-tests') > -1) {
3738
return false
38-
} else {
39-
return true
4039
}
40+
41+
return true
4142
}).forEach((file) => {
4243
require('./' + file)
4344
})
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
��Hello and Welcome to IPFS!
3+
4+
██╗██████╗ ███████╗███████╗
5+
██║██╔══██╗██╔════╝██╔════╝
6+
██║██████╔╝█████╗ ███████╗
7+
██║██╔═══╝ ██╔══╝ ╚════██║
8+
██║██║ ██║ ███████║
9+
╚═╝╚═╝ ╚═╝ ╚══════╝
10+
11+
If you're seeing this, you have successfully installed
12+
IPFS and are now interfacing with the ipfs merkledag!
13+
14+
-------------------------------------------------------
15+
| Warning: |
16+
| This is alpha software. Use at your own discretion! |
17+
| Much is missing or lacking polish. There are bugs. |
18+
| Not yet secure. Read the security notes for more. |
19+
-------------------------------------------------------
20+
21+
Check out some of the other files in this directory:
22+
23+
./about
24+
./help
25+
./quick-start <-- usage examples
26+
./readme <-- this file
27+
./security-notes
28+
�
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
5
2+
" ���׾F�_�uؔ�l��z�S?��|ڲ��Pc@ js-ipfs-repo�
3+
4+

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
ys# js-ipfs-repo
3+
Implementation of the IPFS repo spec (https://github.com/ipfs/specs/tree/master/repo) in JavaScript
4+
s
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
�� IPFS Alpha Security Notes
3+
4+
We try hard to ensure our system is safe and robust, but all software
5+
has bugs, especially new software. This distribution is meant to be an
6+
alpha preview, don't use it for anything mission critical.
7+
8+
Please note the following:
9+
10+
- This is alpha software and has not been audited. It is our goal
11+
to conduct a proper security audit once we close in on a 1.0 release.
12+
13+
- ipfs is a networked program, and may have serious undiscovered
14+
vulnerabilities. It is written in Go, and we do not execute any
15+
user provided data. But please point any problems out to us in a
16+
github issue, or email [email protected] privately.
17+
18+
- ipfs uses encryption for all communication, but it's NOT PROVEN SECURE
19+
YET! It may be totally broken. For now, the code is included to make
20+
sure we benchmark our operations with encryption in mind. In the future,
21+
there will be an "unsafe" mode for high performance intranet apps.
22+
If this is a blocking feature for you, please contact us.
23+
�
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
2+


0 commit comments

Comments
 (0)