commit 4ddba01133b33581cece43cc9c51400ca4a203e0 parent 78a38b5749091df3ce2b4118986413c5d56688ab Author: Dominik Schmidt <das1993@hotmail.com> Date: Mon, 22 Feb 2016 23:22:23 +0100 Add a small readme Diffstat:
README.md | | | 27 | +++++++++++++++++++++++++++ |
1 file changed, 27 insertions(+), 0 deletions(-)
diff --git a/README.md b/README.md @@ -0,0 +1,27 @@ +DFortune +=========== +A small and somewhat primitive library to parse unix fortunecookie files. + +It parses the file and then provides a random access range to the cookies, +which get red lazily. + +Encoding +-------- +The encoding isn't considered at all. The library-user has to know in what +encoding the fortunefile is saved, and handle it accordingly. + + +Example +------- +The library should be fairly self-explanatory. + +```D +Fortune f; +f.open("/path/to/file"); +scope(exit)f.close(); + +writeln(f.strings.joiner("\n")); +writeln(f.range.filter!(a=>a.size>300).map!(a=>f.read(a)).joiner("\n")); +``` + +Note that both `/path/to/file` and `/path/to/file.dat` have to exist.