Skip to content

Conversation

@dsherret
Copy link
Contributor

The file would remain open on a readAll exception.

if (stats.size < maxbuffer) {
const buffer = await readAll(file);
file.close();
const buffer = await Deno.readFile(path);
Copy link
Contributor Author

@dsherret dsherret Nov 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of handling closing the file on readAll, we can just use the readFile api directly and remove the readAll dependency (I think the code should also work faster or have the potential to be faster by doing this too)

Copy link
Collaborator

@kitsonk kitsonk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kitsonk kitsonk merged commit 13f0295 into oakserver:main Nov 22, 2024
5 checks passed
@dsherret dsherret deleted the fix_close_file_on_read_exception branch November 22, 2024 20:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants