-
-
Notifications
You must be signed in to change notification settings - Fork 51
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
Lists only 16 or less files when a glob string including no globstar. #112
Comments
@sttk if this is the full example, you've forgotten to create a Writeable stream, so it never sinks and you hit the highWaterMark |
Nvm, I see the writeable stream is fs |
However, I'm very confused because I was 99% sure that you aren't allowed to use an object stream with fs writeStream. It's a text based stream. |
@phated This cause is that https://github.com/isaacs/node-glob/blob/3bfec21dd180ddf4672880176ad33af6296a167e/glob.js#L360 |
|
The following is the logs of
And the logs when a glob string is
|
I noticed this issue when I run the test of |
https://github.com/isaacs/node-glob/blob/3bfec21dd180ddf4672880176ad33af6296a167e/glob.js#L412-L432 To skip this part lists all files even if a glob string includes no globstar. |
The following code which uses
The following code which also uses
And the following code which also uses
|
@phated I suspect that this issue is due to |
This issue is not due to
|
That means you aren't draining the streams correctly. |
I'm having a similar issue when trying to create a simple writable stream with a listener to the 'data' event. Only 16 results are read before the process completes. Could you provide a simple example where a large directory is globbed, Here is an example where only the first 16 data events are called. // 16 results
glob_stream(join(process.cwd(), '*'))
.on('data', data=>console.info(data))
.on('end', ()=>console.info('done'))
// 16 results
glob_stream(join(process.cwd(), '*')).pipe(new Writable({
objectMode: true,
write(chunk, _encoding, next) {
console.debug(chunk)
next()
}
})) I also tried using the Even piping to process.stdout throws an error since this library streams objects. This seems very basic, but I can't find any examples of consuming streaming objects properly for any library. Hopefully this thread to serve posterity by resulting with a simple example of properly consuming an object stream. // TypeError [ERR_INVALID_ARG_TYPE]: The "chunk" argument must be of type string or an instance of Buffer or Uint8Array. Received an instance of Object
glob_stream(join(dir_path, '*')).pipe(process.stdout) |
This comment was marked as off-topic.
This comment was marked as off-topic.
I've added 2 tests for this at 790c0cb |
What were you expecting to happen?
Lists more than 16 files in a directory.
What actually happened?
Lists only 16 files with a glob including no globstar.
Please give us a sample
Terminal output / screenshots
Please provide the following information:
node -v
): v16.15.0, v10.23.0npm -v
): 8.5.5Additional information
When replaces the above glob string to
'./in/**/*.txt'
, the result was as follows:The text was updated successfully, but these errors were encountered: