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

feat: only-hash option for add/addFromFS/addFromURL #700

Merged
merged 11 commits into from
Mar 15, 2018

Conversation

JonKrone
Copy link
Contributor

@JonKrone JonKrone commented Feb 23, 2018

This adds only-hash as a potential querystring arg for files.add, util.addFromFS, and util.addFromURL: ipfs.add(<content>, { only-hash: true }).

only-hash allows users to generate a hash for some content without actually adding the content to ipfs.

related issue: #509

needed for js-ipfs: ipfs/js-ipfs#1233

@ghost ghost assigned JonKrone Feb 23, 2018
@ghost ghost added the in progress label Feb 23, 2018
@ghost
Copy link

ghost commented Feb 23, 2018

Does this also support -n?

  -n,          --only-hash           bool   - Only chunk and hash - do not write to disk.

@JonKrone
Copy link
Contributor Author

Does this also support -n?

I was thinking that alias support like that is only available through a CLI, (js-ipfs here). Should this API also support aliases? Please explain if I'm missing something, but would you expect ipfs.add(<content>, { n: true }) to be valid?

@ghost
Copy link

ghost commented Feb 23, 2018

Ah I'm sorry, I didn't notice we're in js-ipfs-api

@JonKrone
Copy link
Contributor Author

Haha, no worries 😉. Thanks for the look-over, though.

@JonKrone
Copy link
Contributor Author

CI question: Does anyone know why ESLint finds errors but doesn't report them here? This has tricked me a few times, I think.

@ghost
Copy link

ghost commented Feb 23, 2018

Should this API also support aliases?

Actually: maybe. go-ipfs supports option aliases on the API, e.g. /api/v0/refs?r=true&arg=QmFoo (because that's where most of the CLI options eventually end up). @diasdavid's call.

@ghost
Copy link

ghost commented Feb 23, 2018

But again this is just options objects passed to an API function yeah? Then probably not.

@JonKrone
Copy link
Contributor Author

JonKrone commented Feb 26, 2018

Actually: maybe. go-ipfs supports option aliases on the API

Cool, I think js-ipfs could change that as a mild chore across the route handlers later on. Do you know why go decided to? Aliases on a CLI save time and lots of frustration but most code through an API is generated so aliases aren't nearly as helpful.

@JonKrone
Copy link
Contributor Author

CI is failing on object.patch tests: https://travis-ci.org/ipfs/js-ipfs-api/jobs/345383716#L3541

These tests do not fail locally but are also failing on VMX's most recent PR: #701.

@daviddias
Copy link
Contributor

daviddias commented Feb 26, 2018

Alias are supported for some methods (early days) but we decided to bet on the full options names for docs and tests. (Aliases mean + docs and + dup tests)

@daviddias
Copy link
Contributor

@vmx could https://github.com/ipld/js-ipld-dag-pb/releases/tag/v0.13.1 be breaking the tests? HAven't looked too much into it.

@vmx
Copy link
Contributor

vmx commented Feb 26, 2018

@diasdavid: Nope, I've just publish js-ipld-dag-pb 0.13.1 just 30mins ago.

…querystring options flatly and util/* code passes it under the 'qs' property, requiring this flattening. files/* should probably send options under 'qs'.
@JonKrone
Copy link
Contributor Author

Current status: ready for review / merge.

CI failure is pubsub multiple nodes connected: empty() list when no topics are subscribed.

The object.patch CI tests that were failing for vmx and me are passing now for both PRs.

@JonKrone JonKrone changed the title feat: only-hash feat: --only-hash through files.add, util.addFromFS, util.addFromURL Feb 26, 2018
@JonKrone JonKrone changed the title feat: --only-hash through files.add, util.addFromFS, util.addFromURL feat: only-hash option for add/addFromFS/addFromURL Feb 26, 2018
…eam' under the 'qs' key. Allows any options passed to ipfs.file|pin.add-ish to be turned into qs params instead of adding all of them individually
@daviddias
Copy link
Contributor

@JonKrone any reason why to use a different github account for your commits?

See how things are commited by @jkrone rather than @JonKrone
image

@JonKrone
Copy link
Contributor Author

JonKrone commented Mar 2, 2018

@diasdavid No reason. It is not a different Github account, just a local git config user.name setting that was set to jkrone. I've synced the names and pushed a commit that reflects it.

@JonKrone JonKrone added ready and removed in progress labels Mar 2, 2018
This was referenced Mar 6, 2018
@daviddias
Copy link
Contributor

let's get #705 by @vmx in first to that we can see CI green in every PR :)

@daviddias
Copy link
Contributor

@JonKrone please rebase master onto this branch when you have a chance.

@ghost ghost assigned daviddias Mar 15, 2018
@daviddias daviddias changed the base branch from master to only-hash March 15, 2018 15:40
@daviddias
Copy link
Contributor

@JonKrone merging this branch into a branch of the repo itself so that we can collaborate
image

@daviddias daviddias merged commit 036b0fd into ipfs-inactive:only-hash Mar 15, 2018
@ghost ghost removed the in progress label Mar 15, 2018
daviddias added a commit that referenced this pull request Mar 15, 2018
* feat: only-hash option for add/addFromFS/addFromURL (#700)

* chore: update ipfsd-ctl
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