Skip to content

uploaded files are not flushed to disk #1381

@uhthomas

Description

@uhthomas

It looks like multer doesn't call sync or datasync when files are closed, which can lead to data corruption.

var outStream = fs.createWriteStream(finalPath)

NodeJS does support a flush option which will ensure data is flushed to disk before closing the file. It would be great if multer could add an option to set this.

https://nodejs.org/api/fs.html#filehandlecreatewritestreamoptions

Environment information

Version:

v2.1.1

Platform:

Linux

Node.js version:

v25.8.1

Any other relevant information:

What steps will reproduce the bug?

Upload a file, and observe that in certain conditions the handler may say that the upload has completed, but in reality the data has not been written to disk and so the file is either corrupt or lost.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions