4 ms·
> about as popular as "prepend the contents of file A to file B" I've never understood why filesystems don't easily support prepending data, or to truncate the
by magicalhippo 2y ago
> about as popular as "prepend the contents of file A to file B"
I've never understood why filesystems don't easily support prepending data, or to truncate the start of a file.
It should be, as far as I can see, about as trivial to support as appending and truncating the end, and is something that comes up quite often in application code. Even if it is a bit more tricky, I think the benefits would be great in the cases where it's needed.
Instead applications are left having to rewrite the contents.
- kbolino 2y agoA queue is simpler to implement than a deque and the same is true of a file system: supporting growing the file in both directions is more complicated than supporting growing the file in one direction. In practice, append is much more common than prepend, so the extra bookkeeping and code doesn't seem to be worth it in general.
- o11c 2y agoThat's much less of a concern ever since everybody switched to extent-based filesystems. The real concern is block alignment.