Results for “File operations & integrity”
Small, practical examples. Search by task or narrow things down below.
Read a JSON file
Load a JSON document from disk into Python objects using an explicitly selected text encoding.
json✓ Tested
Read a secret from a mounted file
Docker / Compose: Compose secrets make a file available under /run/secrets.
Docker / Compose✓ Tested
Read a text file
Open a UTF-8 text file and read its contents. A context manager closes the file automatically, even if reading fails.
file✓ Tested
Read a text file
Load a small text file into a C# string.
C#✓ Tested
Read a UTF-8 file
Read a small UTF-8 file into a Java string.
Java✓ Tested
Read a UTF-8 file
Read a small file as text using Node.js.
JavaScript✓ Tested
Read a whole text file
Load text as one string instead of one item per line.
Get-Content✓ Tested
Read buffered lines from a file
Read buffered lines from a file in a complete Rust program using the standard library.
Rust✓ Tested
Read bytes from a chosen file offset
C: Check fseek before reading so an unsupported or invalid seek is not ignored.
C✓ Tested
Read commit subjects affecting one file
Git: Place the path after -- so Git limits history to the selected file.
Git✓ Tested
Read file metadata without reading its contents
Read file metadata without reading its contents in a complete Rust program using the standard library.
Rust✓ Tested
Read from a dedicated file descriptor
Bash Scripts: An explicitly opened descriptor keeps the script’s ordinary standard input available.
Bash Scripts✓ Tested