Skip to content

Commit d4f1a4f

Browse files
refactor: update deps and better browser compat
1 parent 6ef269b commit d4f1a4f

File tree

4 files changed

+25
-25
lines changed

4 files changed

+25
-25
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@
3030
},
3131
"homepage": "https://github.com/ipfs/js-ipfs-unixfs#readme",
3232
"devDependencies": {
33-
"aegir": "^2.1.1",
33+
"aegir": "^8.1.2",
3434
"chai": "^3.5.0",
35-
"pre-commit": "^1.1.2"
35+
"pre-commit": "^1.1.3"
3636
},
3737
"dependencies": {
38-
"protocol-buffers": "^3.1.5"
38+
"protocol-buffers": "^3.1.6"
3939
},
4040
"pre-commit": [
4141
"lint",

protos/unixfs.proto

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/index.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,7 @@
11
'use strict'
22

3-
const fs = require('fs')
4-
const path = require('path')
53
const protobuf = require('protocol-buffers')
6-
const schema = fs.readFileSync(path.resolve(__dirname, '../protos/unixfs.proto'))
7-
const pb = protobuf(schema)
4+
const pb = protobuf(require('./unixfs.proto'))
85
// encode/decode
96
const unixfsData = pb.Data
107
// const unixfsMetadata = pb.MetaData // encode/decode

src/unixfs.proto.js

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
'use strict'
2+
3+
module.exports = new Buffer(`message Data {
4+
enum DataType {
5+
Raw = 0;
6+
Directory = 1;
7+
File = 2;
8+
Metadata = 3;
9+
Symlink = 4;
10+
}
11+
12+
required DataType Type = 1;
13+
optional bytes Data = 2;
14+
optional uint64 filesize = 3;
15+
repeated uint64 blocksizes = 4;
16+
}
17+
18+
message Metadata {
19+
required string MimeType = 1;
20+
}
21+
`)

0 commit comments

Comments
 (0)