Skip to content

Commit 0893da6

Browse files
dignifiedquiredaviddias
authored andcommitted
ready
1 parent 5f72426 commit 0893da6

13 files changed

+43
-24
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,3 @@ node_modules
3333
.node_repl_history
3434

3535
dist
36-
lib

.travis.yml

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
sudo: false
22
language: node_js
3-
node_js:
4-
- 4
5-
- 5
3+
matrix:
4+
include:
5+
- node_js: 4
6+
env: CXX=g++-4.8
7+
- node_js: 6
8+
env:
9+
- SAUCE=true
10+
- CXX=g++-4.8
11+
- node_js: stable
12+
env: CXX=g++-4.8
613

714
# Make sure we have new NPM.
815
before_install:
@@ -13,12 +20,17 @@ script:
1320
- npm test
1421
- npm run coverage
1522

16-
addons:
17-
firefox: 'latest'
18-
1923
before_script:
2024
- export DISPLAY=:99.0
2125
- sh -e /etc/init.d/xvfb start
2226

2327
after_success:
2428
- npm run coverage-publish
29+
30+
addons:
31+
firefox: 'latest'
32+
apt:
33+
sources:
34+
- ubuntu-toolchain-r-test
35+
packages:
36+
- g++-4.8

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
[![Coverage Status](https://coveralls.io/repos/github/ipfs/js-ipfs-unixfs/badge.svg?branch=master)](https://coveralls.io/github/ipfs/js-ipfs-unixfs?branch=master)
99
[![Dependency Status](https://david-dm.org/ipfs/js-ipfs-unixfs.svg?style=flat-square)](https://david-dm.org/ipfs/js-ipfs-unixfs)
1010
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
11+
![](https://img.shields.io/badge/npm-%3E%3D3.0.0-orange.svg?style=flat-square)
12+
![](https://img.shields.io/badge/Node.js-%3E%3D4.0.0-orange.svg?style=flat-square)
13+
14+
[![Sauce Test Status](https://saucelabs.com/browser-matrix/js-ipfs-unixfs.svg)](https://saucelabs.com/u/js-ipfs-unixfs)
1115

1216
> JavaScript implementation of IPFS' unixfs (a Unix FileSystem representation on top of a MerkleDAG)
1317

package.json

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@
22
"name": "ipfs-unixfs",
33
"version": "0.1.4",
44
"description": "JavaScript implementation of IPFS' unixfs (a Unix FileSystem representation on top of a MerkleDAG)",
5-
"main": "lib/index.js",
6-
"jsnext:main": "src/index.js",
5+
"main": "src/index.js",
6+
"browser": {
7+
"fs": false
8+
},
79
"scripts": {
810
"test": "aegir-test",
911
"test:node": "aegir-test node",
@@ -28,9 +30,12 @@
2830
"bugs": {
2931
"url": "https://github.com/ipfs/js-ipfs-unixfs/issues"
3032
},
33+
"engines": {
34+
"node": ">=4.0.0"
35+
},
3136
"homepage": "https://github.com/ipfs/js-ipfs-unixfs#readme",
3237
"devDependencies": {
33-
"aegir": "^8.1.2",
38+
"aegir": "^9.1.0",
3439
"chai": "^3.5.0",
3540
"pre-commit": "^1.1.3"
3641
},

src/unixfs.proto.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,4 @@ module.exports = `message Data {
1717
1818
message Metadata {
1919
required string MimeType = 1;
20-
}
21-
`
20+
}`
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.

test/unixfs-format.spec.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22
'use strict'
33

44
const expect = require('chai').expect
5-
const fs = require('fs')
6-
const path = require('path')
5+
const loadFixture = require('aegir/fixtures')
76

87
const UnixFS = require('../src')
98

9+
const raw = loadFixture(__dirname, 'fixtures/raw.unixfs')
10+
const directory = loadFixture(__dirname, 'fixtures/directory.unixfs')
11+
const file = loadFixture(__dirname, 'fixtures/file.txt.unixfs')
12+
const symlink = loadFixture(__dirname, 'fixtures/symlink.txt.unixfs')
13+
1014
describe('unixfs-format', () => {
1115
it('raw', (done) => {
1216
const data = new UnixFS('raw', new Buffer('bananas'))
@@ -93,7 +97,6 @@ describe('unixfs-format', () => {
9397

9498
describe('interop', () => {
9599
it('raw', (done) => {
96-
const raw = fs.readFileSync(path.join(__dirname, '/test-data/raw.unixfs'))
97100
const unmarsheled = UnixFS.unmarshal(raw)
98101
expect(unmarsheled.data).to.deep.equal(new Buffer('Hello UnixFS\n'))
99102
expect(unmarsheled.type).to.equal('file')
@@ -102,33 +105,30 @@ describe('unixfs-format', () => {
102105
})
103106

104107
it('directory', (done) => {
105-
const raw = fs.readFileSync(path.join(__dirname, '/test-data/directory.unixfs'))
106-
const unmarsheled = UnixFS.unmarshal(raw)
108+
const unmarsheled = UnixFS.unmarshal(directory)
107109
expect(unmarsheled.data).to.deep.equal(undefined)
108110
expect(unmarsheled.type).to.equal('directory')
109-
expect(unmarsheled.marshal()).to.deep.equal(raw)
111+
expect(unmarsheled.marshal()).to.deep.equal(directory)
110112
done()
111113
})
112114

113115
it('file', (done) => {
114-
const raw = fs.readFileSync(path.join(__dirname, '/test-data/file.txt.unixfs'))
115-
const unmarsheled = UnixFS.unmarshal(raw)
116+
const unmarsheled = UnixFS.unmarshal(file)
116117
expect(unmarsheled.data).to.deep.equal(new Buffer('Hello UnixFS\n'))
117118
expect(unmarsheled.type).to.equal('file')
118-
expect(unmarsheled.marshal()).to.deep.equal(raw)
119+
expect(unmarsheled.marshal()).to.deep.equal(file)
119120
done()
120121
})
121122

122123
it.skip('metadata', (done) => {
123124
})
124125

125126
it('symlink', (done) => {
126-
const raw = fs.readFileSync(path.join(__dirname, '/test-data/symlink.txt.unixfs'))
127-
const unmarsheled = UnixFS.unmarshal(raw)
127+
const unmarsheled = UnixFS.unmarshal(symlink)
128128
expect(unmarsheled.data).to.deep.equal(new Buffer('file.txt'))
129129
expect(unmarsheled.type).to.equal('symlink')
130130
// TODO: waiting on https://github.com/ipfs/js-ipfs-data-importing/issues/3#issuecomment-182440079
131-
// expect(unmarsheled.marshal()).to.deep.equal(raw)
131+
// expect(unmarsheled.marshal()).to.deep.equal(symlink)
132132
done()
133133
})
134134
})

0 commit comments

Comments
 (0)