fs: make `dirent.path` writable · nodejs/node@f628fc4 · GitHub
Skip to content

Commit f628fc4

Browse files
aduh95RafaelGSS
authored andcommitted
fs: make dirent.path writable
PR-URL: #55547 Refs: #55538 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: LiviaMedeiros <livia@cirno.name> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com> Reviewed-By: Chemi Atlow <chemi@atlow.co.il>
1 parent fa61dce commit f628fc4

3 files changed

Lines changed: 20 additions & 1 deletion

File tree

doc/api/fs.md

Lines changed: 4 additions & 1 deletion

lib/internal/fs/utils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ const {
4949
once,
5050
deprecate,
5151
isWindows,
52+
setOwnProperty,
5253
} = require('internal/util');
5354
const { toPathIfFileURL } = require('internal/url');
5455
const {
@@ -214,6 +215,9 @@ ObjectDefineProperty(Dirent.prototype, 'path', {
214215
get: deprecate(function() {
215216
return this.parentPath;
216217
}, 'dirent.path is deprecated in favor of dirent.parentPath', 'DEP0178'),
218+
set(value) {
219+
setOwnProperty(this, 'path', value);
220+
},
217221
configurable: true,
218222
enumerable: false,
219223
});

test/parallel/test-fs-utils-get-dirents.js

Lines changed: 12 additions & 0 deletions

0 commit comments

Comments
 (0)