-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Conversation
a1b56d5
to
fa9158e
Compare
fa9158e
to
200e4fb
Compare
const Path = require('path') | ||
const isString = require('lodash/isString') | ||
const pull = require('pull-stream') | ||
const glob = require('glob') |
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't we just use https://www.npmjs.com/package/fast-glob ? it's faster and supports streams so we can go directly to pull-stream
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.
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.
even using streams instead of glob events ? seems weird but if its faster like this im good with it
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.
I know weird, maybe it is the stream to pull stream conversion? Anyway even weirder is that the benchmarks for fast-glob
do not run against glob
😱 They benchmark globby
, bash-glob
, tiny-glob
and glob-stream
...but not regular glob
🙄.
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.
lol that kinda wtf and globby is based on fast-glob with some sindre sugar on top
anyway this looks fine and if your benchs show better numbers lets merge it
ca34d52
to
e24fc37
Compare
License: MIT Signed-off-by: Alan Shaw <[email protected]>
This PR adds a new method [`addFromFs`](https://github.com/ipfs/interface-ipfs-core/blob/master/SPEC/FILES.md#addfromfs) allowing users to more easily add files from their file system without having to specify every single file to add. In the browser the user will receive a "not available" error. I've pulled out a module `glob-source.js` - call it with some file paths and it returns a pull stream source that can be piped to `ipfs.addPullStream`. This PR comes with the following added benefits: * `ipfs add` on the CLI uses `glob-source.js` - **nice and DRY** * `glob-source.js` uses the events that the `glob` module provides allowing the globbing to be a `pull-pushable`, which means that matched paths can begin to be added before all the globbing is done - **faster** * `ipfs add` now supports adding multiple paths, fixes #1625 - **better** * `ipfs add --progress=false` doesn't calculate the total size of the files to be added anymore! It didn't need to do that as the total was completely discarded when progress was disabled. It means we can add BIGGER directories without running into memory issues - **stronger** License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
5d486a0
to
158d37d
Compare
License: MIT Signed-off-by: Alan Shaw <[email protected]>
License: MIT Signed-off-by: Alan Shaw <[email protected]>
@hugomrdias is this gtg now? |
This PR adds a new method
addFromFs
allowing users to more easily add files from their file system without having to specify every single file to add.In the browser the user will receive a "not available" error.
I've pulled out a module
glob-source.js
- call it with some file paths and it returns a pull stream source that can be piped toipfs.addPullStream
.This PR comes with the following added benefits:
ipfs add
on the CLI usesglob-source.js
- nice and DRYglob-source.js
uses the events that theglob
module provides allowing the globbing to be apull-pushable
, which means that matched paths can begin to be added before all the globbing is done - fasteripfs add
now supports adding multiple paths, fixes Cannot add multiple files from command line #1625 - betteripfs add --progress=false
doesn't calculate the total size of the files to be added anymore! It didn't need to do that as the total was completely discarded when progress was disabled. It means we can add BIGGER directories without running into memory issues - stronger