GithubHelp home page GithubHelp logo

large-file-viewer's Introduction

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.

large-file-viewer's People

Contributors

hgv79116 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.