| title | save |
|---|---|
| categories | filesystem |
| version | 0.106.0 |
| filesystem | Save a file. |
| usage | Save a file. |
| editLink | false |
| contributors | false |
save for filesystem
Save a file.
> save {flags} (filename)
--stderr, -e {path}: the filename used to save stderr, only works with-rflag--raw, -r: save file as raw binary--append, -a: append input to the end of the file--prepend, -P: prepend input to the beginning of the file--force, -f: overwrite the destination--progress, -p: enable progress bar
filename: The filename to use.
| input | output |
|---|---|
| any | nothing |
Save a string to foo.txt in the current directory
> 'save me' | save foo.txt
Append a string to the end of foo.txt
> 'append me' | save --append foo.txt
Prepend a string to the beginning of foo.txt
> 'prepend me' | save --prepend foo.txt
Save a record to foo.json in the current directory
> { a: 1, b: 2 } | save foo.json
Save a running program's stderr to foo.txt
> do -i {} | save foo.txt --stderr foo.txt
Save a running program's stderr to separate file
> do -i {} | save foo.txt --stderr bar.txt
Show the extensions for which the save command will automatically serialize
> scope commands
| where name starts-with "to "
| insert extension { get name | str replace -r "^to " "" | $"*.($in)" }
| select extension name
| rename extension command