Skip to content
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

feat: add glob-source from js-ipfs so it can be shared with the http client #9

Merged
merged 6 commits into from
Sep 4, 2019

Conversation

achingbrain
Copy link
Member

The business of turning a path and pattern into an iterator of files is duplicated between js-ipfs and js-ipfs-http-client so moving it here to aid deduplication.

@achingbrain achingbrain force-pushed the add-glob-source branch 3 times, most recently from 4e4fcf0 to ab8edd2 Compare September 3, 2019 14:49
src/files/glob-source.js Show resolved Hide resolved
src/files/glob-source.js Show resolved Hide resolved
Copy link
Member

@hugomrdias hugomrdias left a comment

Choose a reason for hiding this comment

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

Can you add a test for multiple paths please?

test/files/glob-source.spec.js Outdated Show resolved Hide resolved
* @param {Boolean} [options.followSymlinks] follow symlinks
* @yields {Object} File objects in the form `{ path: String, content: AsyncIterator<Buffer> }`
*/
module.exports = async function * globSource (...args) {
Copy link
Member

Choose a reason for hiding this comment

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

can't the arguments be function(Array<string> paths, Object options) ? instead of multiple paths as arguments?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's just been ported as-is from js-ipfs

test/files/glob-source.spec.js Outdated Show resolved Hide resolved
@achingbrain
Copy link
Member Author

Can you add a test for multiple paths please?

Done

@hugomrdias
Copy link
Member

ready to merge ?

@achingbrain
Copy link
Member Author

I'm starting to think you're right about the function signature. Having an iterable as the first argument would let us stream stuff into this function.

@alanshaw
Copy link
Member

alanshaw commented Sep 4, 2019

Who would even build a stupid API like that?

Oh...

Screenshot 2019-09-04 at 10 06 44

@alanshaw
Copy link
Member

alanshaw commented Sep 4, 2019

Merge and release please 🙏

@hugomrdias
Copy link
Member

can you fix the conflicts please?

achingbrain and others added 6 commits September 4, 2019 10:42
The business of turning a path and pattern into an iterator of files is
duplicated between js-ipfs and js-ipfs-http-client so moving it here to
aid deduplication.
Fix typo

Co-Authored-By: Hugo Dias <hugomrdias@gmail.com>
@achingbrain
Copy link
Member Author

Who would even build a stupid API like that?

I had this exact experience while looking at pointless mfs tests that don't assert anything in ipfs-http-client the other day.

Who wrote this garbage? Oh, it was me.

@hugomrdias hugomrdias merged commit 0a95ef8 into master Sep 4, 2019
@hugomrdias hugomrdias deleted the add-glob-source branch September 4, 2019 09:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants