iopipe: Writing output to std.io File

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


Just as I'm hitting send the part I'm missing clicked:

I needed to add the text encoding because my buffer is `char` but 
File writes `ubyte`

```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
         .encodeText // Missing This part
         .outputPipe(output());
}
```




More information about the Digitalmars-d-learn mailing list