Handling Files and the Filesystem

In this chapter, we will cover the following recipes:

  • Working with text files
  • Handling bytes
  • Working with binary files
  • Compressing and decompressing data
  • Traversing the filesystem
  • Finding files with glob patterns

Introduction

In these times of big data, machine learning, and cloud services, you cannot rely on having all of your data always in memory. Rather, you need to be able to effectively inspect and traverse the filesystem and manipulate its content at your leisure.

Examples of things you will be able to do after reading this chapter include configuring files in subdirectories with different naming variations, saving your data in efficient binary formats, reading protocols generated by other programs, ...

Get Rust Standard Library Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.