Skip to content

Clarify "fs.readFile", "fs.appendFile", "fs.writeFile" documentation regarding closing #7560

@kibertoad

Description

@kibertoad

"https://nodejs.org/api/fs.html#fs_fs_readfile_file_options_callback" states that

Note: Specified file descriptors will not be closed automatically.

This is confusing for new users, because it implies that opened file should always be manually closed, leading to questions like this - http://stackoverflow.com/questions/21523890/close-file-after-fs-readfile-nulling

It should be mentioned that if "file" is specified as a filename, it will, indeed, be closed automatically.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docIssues and PRs related to the documentations.fsIssues and PRs related to the fs subsystem / file system.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions