- [Instructor] In this movie, we're going to learn…how you would read or write…an entire file at once.…So far, we've just been working…with individual lines on a file.…And, most of the time, that's the technique…you're going to want to use.…But sometimes it's useful to be able…to work with an entire file.…And if you want to do that,…you can use File.read…and provide it a filepath.…Notice that I'm not providing any access mode…because it's presumed that I'm using…read-only mode for this…and the instance does not need to be closed,…like when we're working with New or Open.…So, Read will just open the file,…read its contents in,…and then close it automatically for me.…
One nice, easy step.…There's one big problem though, with Read.…And that problem is,…that it's really only useful…with small data files.…Because all of the file data…is going to be stored in memory.…You want to be careful using Read with large files,…especially if you're looping through them.…Because, very quickly, you're going to run out of memory…by reading in all of those files.…
- File system basics
- Writing to and reading from files
- Renaming, deleting, and copying files
- Creating and editing directories
- Working with common data formats
- ERB templating
Skill Level Beginner
Ruby on Rails 5 Essential Trainingwith Kevin Skoglund10h 21m Beginner
1. The File System
2. Work with Files
3. Work with Directories
4. Common Data Formats
5. ERB Templating
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.