Skip to content

Async Crypto Endeavour #12

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Nov 3, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,12 @@
},
"homepage": "https://github.com/ipfs/js-ipfs-unixfs#readme",
"devDependencies": {
"aegir": "^2.1.1",
"aegir": "^8.1.2",
"chai": "^3.5.0",
"pre-commit": "^1.1.2"
"pre-commit": "^1.1.3"
},
"dependencies": {
"protocol-buffers": "^3.1.5"
"protocol-buffers": "^3.1.6"
},
"pre-commit": [
"lint",
Expand Down
18 changes: 0 additions & 18 deletions protos/unixfs.proto

This file was deleted.

5 changes: 1 addition & 4 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
'use strict'

const fs = require('fs')
const path = require('path')
const protobuf = require('protocol-buffers')
const schema = fs.readFileSync(path.resolve(__dirname, '../protos/unixfs.proto'))
const pb = protobuf(schema)
const pb = protobuf(require('./unixfs.proto'))
// encode/decode
const unixfsData = pb.Data
// const unixfsMetadata = pb.MetaData // encode/decode
Expand Down
21 changes: 21 additions & 0 deletions src/unixfs.proto.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
'use strict'

module.exports = new Buffer(`message Data {
enum DataType {
Raw = 0;
Directory = 1;
File = 2;
Metadata = 3;
Symlink = 4;
}

required DataType Type = 1;
optional bytes Data = 2;
optional uint64 filesize = 3;
repeated uint64 blocksizes = 4;
}

message Metadata {
required string MimeType = 1;
}
`)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK, the protobuf module actually takes up a string. If we are going to move this forward, better return a string than a Buffer

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure I don't mind, going to check the source to see what it needs

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's move to a string, it gets converted directly to a string anyway in the module https://github.com/mafintosh/protocol-buffers-schema/blob/master/parse.js#L529