> ## Documentation Index
> Fetch the complete documentation index at: https://loadwise.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# same-file-stream-truncation

> Connected Node read and write streams use the same file with truncating flags.

## What it flags

Two directly connected Node filesystem streams open the same proven path. The reader uses default read options or a known literal encoding. The destination uses the default truncating mode or explicitly sets `w` or `w+`. It can discard the source before the read finishes.

## How to review or fix

Write to a distinct temporary file and replace the source after the operation succeeds. Choose naming, permissions and replacement behavior for your application.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.