Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/wfercanas/files-handling

Exercises on files manipulation: reading, writing and creating files in Go.
https://github.com/wfercanas/files-handling

files golang

Last synced: 2 days ago
JSON representation

Exercises on files manipulation: reading, writing and creating files in Go.

Awesome Lists containing this project

README

        

# Files Handling

## Project Description

This project contains some exercises to practice Reading, Writing, Creating, Copying, and some more use cases when handling files with Go.

## Key scenarios

1. **pathExists/**: Check if a given path truly exists.
2. **isFile/**: Check if a given path is a regular file.
3. **isDirectory/**: Check if a given path is a directory.
4. **readFull/**: Read a complete file at once .
5. **readByLine/**: Read a file line by line.
6. **readByWord/**: Read a file word by word.
7. **readByChar/**: Read a file character by character.
8. **createFile/**: Program for creating a new file.
9. **copyFile/**: Program to create a new file as a copy of another one.
10. **writeFile/**: Program for creating a file and writing some data within.
11. **appendData/**: Program for adding some new data in an existing file.
12. **catData/**: Program for printing on the terminal the content of a file.

## Accessories

You can always use the _./tmp/data.txt_ file when testing the programs.

## Recommendations

If you are beginning to learn Go, I recommend you to first check the basic Golang repos I have built to lay the foundation. Then come back and check these programs:

- [Basic Go - I](https://github.com/wfercanas/Basic-Golang-I)
- [Basic Go - II](https://github.com/wfercanas/Basic-Golang-II)

## Acknowledgements

Thanks to Linode for the amazing article explaining these exercises. You can check the article [here](https://www.linode.com/docs/guides/creating-reading-and-writing-files-in-go-a-tutorial/).