Skip to content

expected behaviour of fs.constants.W_OK #17508

Closed
@ahmadnassri

Description

  • Version: tested on 7.x, 8.x, 9.x

according to the documentation:

fs.constants.W_OK - path can be written by the calling process

the description text reads as agnostic to the behaviour of the path existing or not, however in practice, this only works if the path exists:

const fs = require('fs')

fs.access('my-test-file', fs.constants.W_OK, console.log)

results in:

{ Error: ENOENT: no such file or directory, access 'my-test-file'  errno: -2,  code: 'ENOENT',  syscall: 'access',  path: 'my-test-file' }

I am not certain if the intended functionality is what's accurately described, meaning this is a technical bug, or if the description is lacking in clarity.

Happy to help address either through PR, I believe this is a documentation problem, so wanted to be sure before.

Metadata

Assignees

No one assigned

    Labels

    fsIssues and PRs related to the fs subsystem / file system.good first issueIssues that are suitable for first-time contributors.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions