Skip to content

File viewer for large text files. Consumes a small amount of RAM.

Notifications You must be signed in to change notification settings

hgv79116/large-file-viewer

Repository files navigation

LFV - Large file viewer

File editors often load the whole file into memory to display it. This approach does not work well with large text files, especially when your RAM is limited. This terminal-based file viewer lets you view large text files (up to 4GB) using O(1) memory. The file viewer also supports efficient text searching (O(pattern length + number of occurrences) memory).

Screen Shot 2024-02-17 at 7 41 59 am

Opening the file viewer

After building the project, head to your terminal and run

${executable} ${file_path}

The file path can be relative or absolute.

How to use

The file viewer has two modes: view mode (default) and command mode. To turn on command mode, type "/". To go back to view mode, press Escape.

In view mode, you scroll up and down the document around your current position.

Command mode

Once you are in command mode, you can enter the following commands

/jump ${position}                          # Jumps to a position (in bytes from the start of the file)
/search ${pattern} -f ${from} -t ${to}     # Launch a search in the background for ${pattern} from ${from} to ${to}. The last two parameters are optional and default to the file's beginning and end.
/cancel                                    # Cancel the current search in the background if there is one.
/exit                                      # Exit the file viewer

Note:

  • Due to memory limit, the searches are currently limited to $5*10^6$ first occurrences of the pattern starting from ${from}
  • To search for the previous/next matches, press Shift+Tab and Tab.
  • You can iterate through matches in both modes.

About

File viewer for large text files. Consumes a small amount of RAM.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published