[node-core-library] Add createReadStream/createWriteStream to FileSystem#5757
Merged
iclanton merged 7 commits intomicrosoft:mainfrom Apr 8, 2026
Merged
[node-core-library] Add createReadStream/createWriteStream to FileSystem#5757iclanton merged 7 commits intomicrosoft:mainfrom
iclanton merged 7 commits intomicrosoft:mainfrom
Conversation
…rary and update consumers to use FileSystem instead of fs directly Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/5ad20d4d-c9a4-4855-bb13-8dd9e2c1350b Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/rushstack/sessions/199d4b3e-1f3f-44e1-9fc6-7b4a0e027c7e Co-authored-by: iclanton <5010588+iclanton@users.noreply.github.com>
…ore-library and update consumers to use FileSystem instead of fs directly Wrap FileSystem stream methods in _wrapException for consistent error handling
…ore-library and update consumers to use FileSystem instead of fs directly
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
dmichon-msft
approved these changes
Apr 8, 2026
Contributor
dmichon-msft
left a comment
There was a problem hiding this comment.
Few suggestions for readability and consistency.
…teration Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add
FileSystem.createReadStream()andFileSystem.createWriteStream()/createWriteStreamAsync()APIs to@rushstack/node-core-library, allowing consumers to use theFileSystemabstraction instead of importingfsdirectly for stream operations. Also extract a sharedIFileSystemWriteFileOptionsBaseinterface and add anensureFolderExistsoption tocreateWriteStream.Details
FileSystem.createReadStream(filePath)— wrapsfs.createReadStream()with Rush Stack's standard error handling via_wrapException.FileSystem.createWriteStream(filePath, options?)andFileSystem.createWriteStreamAsync(filePath, options?)— wrapsfs.createWriteStream()with support for theensureFolderExistsoption to automatically create the parent directory.IFileSystemWriteFileOptionsBasewith the sharedensureFolderExistsproperty, used byIFileSystemWriteBinaryFileOptions,IFileSystemMoveOptions, and the newIFileSystemCreateWriteStreamOptions.FileSystemReadStreamandFileSystemWriteStreamso consumers don't need to importfsfor stream types.How it was tested
Added unit tests covering:
createReadStream: reading file content via stream, error on nonexistent filecreateWriteStream: writing data to a file, error when parent folder is missing, auto-creation of parent folder withensureFolderExists: truecreateWriteStreamAsync: writing data to a file, auto-creation of parent folder withensureFolderExists: trueAll 248 tests pass in the
node-core-librarypackage (7 new tests added).