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

add documentation for file read/write #405

Open
AAATechGuy opened this issue Oct 14, 2021 · 1 comment
Open

add documentation for file read/write #405

AAATechGuy opened this issue Oct 14, 2021 · 1 comment

Comments

@AAATechGuy
Copy link

AAATechGuy commented Oct 14, 2021

Hi, is there a way to use this library to read from file and write to file to boost performance? Can you help with an example - difficult to understand interface?

I was trying to use one of following libraries... it seems using IBufferReader

For serialize, interfaces as follows,

void Serialize<T>(IBufferWriter<byte> writer, T value);
void Serialize<T>(Stream stream, T value); 

For deserialize, interfaces as follows,

T Deserialize<T>(ReadOnlyMemory<byte> buffer);
T Deserialize<T>(Stream stream);
T Deserialize<T>(ReadOnlySequence<byte> byteSequence);

Context: we were trying to serialize/deserialize large files/.net objects for which IBuffer* handling is best.

@AArnott
Copy link
Collaborator

AArnott commented Oct 15, 2021

This library isn't targeting making reading/writing to files on disk faster. But it does offer adapters between Stream and PipeReader/PipeWriter. Given a FileStream (which you carefully open with useAsync: true as a parameter!) then you could use UsePipe to to acquire a PipeReader/PipeWriter to write to that file. I would suggest though that you peruse Microsoft's own documentation for these types as to how to best use them, since this library didn't invent them--it merely adapts one to the other.

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

No branches or pull requests

2 participants