https://github.com/hugojosefson/sponge
Reimplementation of sponge from moreutils, for Deno.
https://github.com/hugojosefson/sponge
deno moreutils sponge typescript
Last synced: 13 days ago
JSON representation
Reimplementation of sponge from moreutils, for Deno.
- Host: GitHub
- URL: https://github.com/hugojosefson/sponge
- Owner: hugojosefson
- License: mit
- Created: 2024-06-11T18:02:10.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-11T23:18:05.000Z (almost 2 years ago)
- Last Synced: 2025-07-12T23:42:11.422Z (11 months ago)
- Topics: deno, moreutils, sponge, typescript
- Language: TypeScript
- Homepage: https://jsr.io/@moreutils/sponge
- Size: 26.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sponge
Reimplementation of `sponge(1)` from
[moreutils](https://joeyh.name/code/moreutils/), for Deno.
[](https://jsr.io/@moreutils/sponge)
[](https://github.com/hugojosefson/sponge/actions/workflows/deno.yaml)
## Requirements
Requires [Deno](https://deno.land/) v1.44.1 or later.
## Usage
### Soak up stdin, write to stdout
```sh
deno run jsr:@moreutils/sponge
```
### Soak up stdin, write to a file
```sh
deno run --allow-write=file.txt jsr:@moreutils/sponge file.txt
```
### Soak up stdin, append to a file
```sh
deno run --allow-write=file.txt jsr:@moreutils/sponge -a file.txt
```
## Example usage
Given 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`:
```sh
cat file.txt |
sed -e 's/foo/bar/' |
deno run --allow-write=file.txt jsr:@moreutils/sponge file.txt
```