Skip to content

Commit

Permalink
Merge pull request #13 from ipfs/dignified
Browse files Browse the repository at this point in the history
Setup dignified.js
  • Loading branch information
daviddias committed Apr 11, 2016
2 parents efa0dcb + 9ef6028 commit ab15916
Show file tree
Hide file tree
Showing 103 changed files with 425 additions and 92 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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
54 changes: 0 additions & 54 deletions karma.conf.js

This file was deleted.

19 changes: 10 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,20 @@
"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",
"test"
],
"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"
Expand All @@ -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",
Expand All @@ -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",
Expand Down
4 changes: 3 additions & 1 deletion src/chunker-fixed-size.js
Original file line number Diff line number Diff line change
@@ -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 })
Expand Down
3 changes: 3 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use strict'

const debug = require('debug')
const log = debug('importer')
log.err = debug('importer:error')
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion tests/browser.js → test/browser.js
Original file line number Diff line number Diff line change
@@ -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')
Expand All @@ -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('./', ''),
Expand Down
16 changes: 9 additions & 7 deletions tests/buffer-test.js → test/buffer-test.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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)
Expand Down
9 changes: 5 additions & 4 deletions tests/index.js → test/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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)
})
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -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
�
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
5
" ���׾F�_�uؔ�l��z�S?��|ڲ��Pc@ js-ipfs-repo�


Binary file not shown.
Original file line number Diff line number Diff line change
@@ -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
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -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.
�
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@


Loading

0 comments on commit ab15916

Please sign in to comment.