Reimplementation of sponge(1) from
moreutils, for Deno.
Requires Deno v1.44.1 or later.
deno run jsr:@moreutils/spongedeno run --allow-write=file.txt jsr:@moreutils/sponge file.txtdeno run --allow-write=file.txt jsr:@moreutils/sponge -a file.txtGiven a file file.txt with the following contents:
The quick brown fox jumps over the lazy dog.
The foo bar baz.
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Running this command, will replace its contents with the same, piped through
sed:
cat file.txt |
sed -e 's/foo/bar/' |
deno run --allow-write=file.txt jsr:@moreutils/sponge file.txt