This repository was archived by the owner on Feb 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Files Quest #156
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
2bb65f6
begin files
nginnever e768675
tests
nginnever 4e5df90
new add, still needs work
nginnever f5d063d
update deps
nginnever 318fa2d
add cli does not match go
nginnever b66665e
add command works, fixed init
nginnever 72e193c
add core test
nginnever 51d7bdb
fixed single file add, added daemon checks
nginnever 8c07406
finished add, cat, get core
nginnever b68f980
repo path
nginnever 7b62937
pipe stream direct from res
nginnever 65ca444
added files add js-ipfs-api
nginnever 40df5f3
rebase
nginnever 74c3a83
push latest
nginnever 1948e6c
remove files api
nginnever 14eaeeb
remove files test
nginnever 3a708ad
fixed single file add with relative path
nginnever a5a3b80
commented out api
nginnever 430d296
removed streamifier module
nginnever 247671f
browser tests pass/cleanup
nginnever 12f5e1a
cat http-api and get api without ctl
nginnever 804147c
finished api, cli tests, js daemon fails
nginnever a00df6c
Merge branch 'master' of https://github.com/ipfs/js-ipfs into files
nginnever dbd8e61
Merge branch 'master' of https://github.com/ipfs/js-ipfs into files
nginnever 01e3b6b
finished add http, fixed cat http
nginnever File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
add command works, fixed init
- Loading branch information
commit b66665ea00f240ddc6e1d526f76a76ba4623d558
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,6 +4,10 @@ const peerId = require('peer-id') | |
| const IpfsBlocks = require('ipfs-blocks').BlockService | ||
| const IpfsDagService = require('ipfs-merkle-dag').DAGService | ||
| const path = require('path') | ||
| const glob = require("glob") | ||
| const async = require('async') | ||
| const streamifier = require('streamifier') | ||
| const fs = require('fs') | ||
|
|
||
| module.exports = (repo, opts, callback) => { | ||
| opts = opts || {} | ||
|
|
@@ -69,11 +73,37 @@ module.exports = (repo, opts, callback) => { | |
|
|
||
| const initDocsPath = path.join(__dirname, '../init-files/init-docs') | ||
|
|
||
| importer.import(initDocsPath, dag, { | ||
| recursive: true | ||
| }, doneImport) | ||
| const i = new importer(dag) | ||
| i.on('data', (file) => { | ||
| }) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why an empty listener? |
||
|
|
||
| glob(path.join(initDocsPath,'/**/*'), (err, res) => { | ||
| const index = __dirname.lastIndexOf('/') | ||
| async.eachLimit(res, 10, (element, callback) => { | ||
| const addPath = element.substring(index + 1, element.length) | ||
| if (fs.statSync(element).isDirectory()) { | ||
| callback() | ||
| } else { | ||
| const buffered = fs.readFileSync(element) | ||
| const r = streamifier.createReadStream(buffered) | ||
| const filePair = {path: addPath, stream: r} | ||
| i.write(filePair) | ||
| callback() | ||
| } | ||
| }, (err) => { | ||
| if (err) { | ||
| throw err | ||
| } | ||
| i.end() | ||
| return | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. no need for |
||
| }) | ||
| }) | ||
|
|
||
| i.on('end', () => { | ||
| doneImport(null) | ||
| }) | ||
|
|
||
| function doneImport (err, stat) { | ||
| function doneImport (err) { | ||
| if (err) { return callback(err) } | ||
|
|
||
| // All finished! | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,5 @@ | ||
| /* eslint-env mocha */ | ||
| 'use strict' | ||
|
|
||
| const bl = require('bl') | ||
| const expect = require('chai').expect | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you use backticks for these error messages, like this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I think the
Error:in the front is not needed, in go-ipfs that's just the log level