Skip to content

Implement Directory Pagination and fix listing limits#19

Closed
jojomueller05 wants to merge 52 commits intoardean:masterfrom
jojomueller05:fix-directory-pagination
Closed

Implement Directory Pagination and fix listing limits#19
jojomueller05 wants to merge 52 commits intoardean:masterfrom
jojomueller05:fix-directory-pagination

Conversation

@jojomueller05
Copy link
Copy Markdown

This PR fixes an issue where directory listings were truncated because only the first batch of files was being returned. I have updated src/client/Directory.ts to handle paginated responses from the SMB server.

Changes:

  • Pagination Logic: Replaced the single QueryDirectory request in read() with a while loop.

  • Buffer Handling: Updated the request to use the wildcard "*" only on the first call and an empty buffer for subsequent calls, as per SMB2 protocol requirements.

  • Graceful Termination: Added a try/catch block to specifically handle STATUS_NO_MORE_FILES (0x80000006), allowing the loop to exit cleanly when the end of the directory is reached.

  • Code Formatting: Applied minor linting/formatting fixes (constructor shorthand and indentation) for better readability.

Related Issues

Fixes #9

miguel-cagide and others added 22 commits January 4, 2024 13:44
* feature: basic readStream

* fix: remove unneccesary return

* fix: remove unused buffer variable

* feature: createFileReadableStream on tree

* feature: working read/write streams

---------

Co-authored-by: Miguel Angel Cagide Fagin <miguelacfa@ext.inditex.com>
* feature: subchunks on writefilestream when chunk is bigger than "maxWriteChunkLength"
fix: "close" event on readfilestream

* chore: version bump, doc update
* stop emit error on close

* version

* fix: fixed subarray positions when chunk bigger than maxWriteChunkLength

---------

Co-authored-by: Andy Wooldridge <99414101+awo00@users.noreply.github.com>
fix: remove miguel-cagide changes
fix: added missing new line
…-streams

Feature: file read/write streams
Fix for error STATUS_USER_SESSION_DELETED
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.

4 participants