Skip to content
This repository has been archived by the owner on Mar 10, 2020. It is now read-only.

Adds wiring for a progress bar #596

Closed
wants to merge 1 commit into from

Conversation

bmordan
Copy link

@bmordan bmordan commented Sep 6, 2017

Passes the 'progress bar' option for transfers over ipfs-api (http). Progress is shown for your payload being streamed up to the server.

There is a pause.

Then you get your response (list of files).

progress-ipfs-api-folder

This example shows a folder of movie clips being added via ipfs-api with the daemon running.

Passes the progress bar option for tranfers over http. Progress is shown for your payload being streamed upto the server. There is a pause. Then you get your list of files.
@@ -73,6 +73,15 @@ describe('.files (the MFS API part)', function () {
})
})

it.only('files.add with progress options', (done) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

only needs to be removed.

stream.pipe(progressStream).pipe(req)
} else {
stream.pipe(req)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

@Kubuxu how does go-ipfs tell the CLI how much 'data' was ingested files? Isn't it returning a ndjson update?

Copy link

Choose a reason for hiding this comment

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

I am not sure but I am not sure what exactly you are asking for.

how much 'data' was ingested files?

Copy link
Contributor

Choose a reason for hiding this comment

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

@Kubuxu when running a ipfs add BIGFILE, how does the CLI know how much data has been processed by go-ipfs?

Copy link

Choose a reason for hiding this comment

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

Following object is being set by the daemon to the CLI as file is being digested:

type AddedObject struct {
	Name  string
	Hash  string `json:",omitempty"`
	Bytes int64  `json:",omitempty"`
	Size  string `json:",omitempty"`
}

It causes update of the progress bar.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just confirmed with @whyrusleeping, go-ipfs http-api does indeed send a ndjson stream of updates when adding files if --progress is passed.

We can support streaming both in node and in the browser with stream-http (like we already do).

@bmordan your PR needs to change to capture that and instead of measuring on bytes sent, measure on bytes reported back. Could you change to that, please?

Copy link
Author

Choose a reason for hiding this comment

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

@diasdavid OK I'm having a look at this.

@dryajov dryajov mentioned this pull request Oct 2, 2017
@daviddias
Copy link
Contributor

continues here: #604

@daviddias daviddias closed this Oct 6, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants