Skip to content

Commit

Permalink
fix the putContents function cannot override the file content in uv.
Browse files Browse the repository at this point in the history
  • Loading branch information
wpjscc authored Oct 20, 2024
1 parent 385933f commit 9be4cee
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Uv/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public function putContents(string $contents, int $flags = 0)
uv_fs_open(
$this->uvLoop,
$this->path . DIRECTORY_SEPARATOR . $this->name,
(($flags & \FILE_APPEND) == \FILE_APPEND) ? UV::O_RDWR | UV::O_CREAT | UV::O_APPEND : UV::O_RDWR | UV::O_CREAT,
(($flags & \FILE_APPEND) == \FILE_APPEND) ? UV::O_RDWR | UV::O_CREAT | UV::O_APPEND : UV::O_RDWR | UV::O_CREAT | UV::O_TRUNC,
0644,
function ($fileDescriptor) use ($resolve, $contents, $flags): void {
uv_fs_write($this->uvLoop, $fileDescriptor, $contents, 0, function ($fileDescriptor, int $bytesWritten) use ($resolve): void {
Expand Down

0 comments on commit 9be4cee

Please sign in to comment.