fix: drop fs-extra for native fs/promises#950
Merged
ferhatelmas merged 1 commit intomasterfrom Mar 30, 2026
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
This PR refactors filesystem usage to remove the fs-extra dependency and rely on Node’s native fs/promises, adding small internal helper wrappers to cover common fs-extra conveniences.
Changes:
- Removed
fs-extra(and its types) from dependencies. - Added
@internal/fshelpers (ensureDir,ensureFile,pathExists,removePath) and migrated storage code to use them. - Updated file-backend tests and TUS file-store integration to use native
fs/promisesplus the new helpers.
Reviewed changes
Copilot reviewed 5 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| src/test/file-backend.test.ts | Replaces fs-extra usage with node:fs/promises and removePath for cleanup. |
| src/storage/protocols/tus/file-store.ts | Uses ensureFile helper instead of fs-extra.ensureFile. |
| src/storage/backend/file.ts | Migrates most fs-extra operations to native fsp + @internal/fs wrappers. |
| src/internal/fs.ts | Introduces internal replacements for a subset of fs-extra functionality. |
| package.json | Drops fs-extra and @types/fs-extra dependencies. |
| package-lock.json | Removes fs-extra and @types/fs-extra entries. |
Comments suppressed due to low confidence (1)
src/storage/backend/file.ts:233
deleteObjectnow usesremovePath(), which callsfs.rm(..., { force: true })and therefore will not throwENOENTfor missing paths. The special-caseENOENThandling in thiscatchblock is now effectively dead code; consider simplifying the error handling (or switching to a non-forceremoval if you want missing files to still surface here).
async deleteObject(bucket: string, key: string, version: string | undefined): Promise<void> {
try {
const file = this.resolveSecurePath(withOptionalVersion(`${bucket}/${key}`, version))
await removePath(file)
// Clean up empty parent directories
await this.cleanupEmptyDirectories(path.dirname(file))
} catch (e) {
if (e instanceof Error && 'code' in e) {
if ((e as any).code === 'ENOENT') {
return
}
throw e
}
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
3b4488c to
b2ba23a
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 5 out of 6 changed files in this pull request and generated no new comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Pull Request Test Coverage Report for Build 23749420723Details
💛 - Coveralls |
TylerHillery
approved these changes
Mar 30, 2026
https://github.com/es-tooling/module-replacements/blob/main/docs/modules/fs-extra.md Signed-off-by: ferhat elmas <elmas.ferhat@gmail.com>
b2ba23a to
8a08928
Compare
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.
What kind of change does this PR introduce?
Refactor
What is the current behavior?
fs-extra is used for promise based fs API.
What is the new behavior?
Use native fs/promises and drop fs-extra.
Additional context
Docs