fs.writeFile doesn't work with non-seekable files #31926
Closed
Description
- Version: 13.7.0
- Platform: Linux
- Subsystem: fs
I see that fs.writeFile*
fails with non-seekable files, because it does a positioned write:
fs.writeFileSync('/sys/kernel/debug/tracing/trace_clock', 'mono')
openat(AT_FDCWD, "/sys/kernel/debug/tracing/trace_clock", O_WRONLY|O_CREAT|O_TRUNC|O_CLOEXEC, 0666) = 19
pwrite64(19, "mono", 4, 0) = -1 ESPIPE (Illegal seek)
fs.readFile
works correctly since it does a regular read
, and I also found that createWriteStream
was fixed to work with non-seekable files (#19329).
Is this known/intentional? If not, would a fix be accepted? (I haven't investigated further yet)
Activity