iopipe: Writing output to std.io File

Jesse Phillips Jesse.K.Phillips+D at gmail.com
Mon Jan 27 01:44:59 UTC 2020


I'd like to start utilizing IOPipe[1] more. Right now I have an 
interest in utilizing it for buffering output (actually I don't 
have a need for buffering, I just want to utilize iopipe)

Looking through some different examples[2][3] I thought I would 
have something with this:

```dlang
/+ dub.sdl:
     name "iobuftofile"
     dependency "iopipe" version="~>0.1.7"
     dependency "io" version="~>0.2.4"
+/

void main() {
     import iopipe.valve;
     import iopipe.textpipe;
     import iopipe.bufpipe;
     import iopipe.buffer;
     import std.io;
     import std.typecons;
     auto output() {
         return std.io.File("somefile.txt", mode!"w").refCounted;
     }
     auto outputBuffered = bufd!char
         .outputPipe(output());
}
```

1. https://code.dlang.org/packages/iopipe
2. 
https://github.com/schveiguy/iopipe/blob/master/examples/convert/convert.d#L13
3. https://youtu.be/9fzttyj4JCs?t=1210


More information about the Digitalmars-d-learn mailing list