|Did you know ...||Search Documentation:|
library(memfile) provides an alternative to
temporary files, intended for temporary buffering of data. Memory files
in general are faster than temporary files and do not suffer from
security risks or naming conflicts associated with temporary-file
There is no limit to the number of memory streams, nor the size of them. However, a single memory file cannot have multiple streams at the same time, i.e., a memory file cannot be opened multiple times, not even for reading. Memory files are thread-safe and subject to (atom) garbage collection.
insert. The resulting Stream must be closed using close/1. When opened for
insert, the current location is initialized at the start of the data and can be modified using seek/2 or set_stream_position/2. In
updatemode, existing content is replaced, while the size is enlarged after hitting the end of the data. In
insertmode, the new data is inserted at the current point.
octet, turning the memoryfile into binary mode. Please study SWI-Prolog Unicode and encoding issues before using this option.
falseand the memory file is opened for reading, discard the file (see free_memory_file/1) if the input is closed. This is used to realise open_chars_stream/2 in library(charsio).
writeyields a permission error.
utf8. Currently only supported if Encoding is one of
octed(the same as
utf8. Use with another encoding raises a domain error.