Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

File I/O #139

Merged
merged 12 commits into from
May 15, 2024
Merged

File I/O #139

merged 12 commits into from
May 15, 2024

Conversation

kciesielski
Copy link
Member

Closes #137

@kciesielski kciesielski requested a review from adamw May 14, 2024 12:24
@kciesielski kciesielski marked this pull request as ready for review May 15, 2024 07:46
doc/index.md Outdated Show resolved Hide resolved
@kciesielski kciesielski changed the title File IO File I/O May 15, 2024
doc/flake.nix Outdated Show resolved Hide resolved
@kciesielski kciesielski requested a review from adamw May 15, 2024 09:22
@adamw adamw merged commit 19b9c96 into master May 15, 2024
5 checks passed
@adamw adamw deleted the file-io branch May 15, 2024 09:40
@adamw
Copy link
Member

adamw commented May 15, 2024

Thanks :)

*/
def fromFile(path: Path, chunkSize: Int = 1024)(using Ox): Source[Chunk[Byte]] =
if Files.isDirectory(path) then throw new IOException(s"Path $path is a directory")
val chunks = StageCapacity.newChannel[Chunk[Byte]]
Copy link
Member

Choose a reason for hiding this comment

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

btw @kciesielski here we could have an implicit StageCapacity as well

chunks.done()
false
else if readBytes == 0 then
chunks.send(Chunk.empty)
Copy link
Member

Choose a reason for hiding this comment

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

and re-reading this, is there any point in sending empty chunks? ;)

Copy link
Member Author

Choose a reason for hiding this comment

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

Right, no point :)

Copy link
Member Author

Choose a reason for hiding this comment

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

@adamw PR with fixes to this #143

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.

Add Source.fromFile and source.toFile
2 participants