Skip to content
tecnolgdPublic

Repository files navigation

libcvault

libcvault is a C++ library for static file metadata analysis. It is intended to provide reusable functions for another C++ program(as of now) rather than operate as a standalone executable.


Warning

libcvault is currently undergoing active refactor and API updates. Please make sure to use the v2.1.0-beta version for required applications.

API Summary

  • populateData() — scan a directory and load regular file metadata
  • getTotalBytes() — compute the total byte size of loaded files
  • getFileCount() — return the number of loaded files
  • sortFileOnByte() — sort files by size
  • maxFile() - return the largest file size
  • sortFileOnName()— sort files by name
  • searchFile() - search by filename
  • lineCount() — count lines in a text file
  • getFileName() - returns the name of the file present at a given index
  • getFileSize() - returns the size(bytes) of the file present at a given index
  • getFiles() - returns a raw pointer to the internal memory buffer of the file list

Quick Run

Prerequisites

  • C++17-compatible compiler
  • Standard library support for <filesystem>

Build Instructions

git clone https://github.com/tecnolgd/libcvault
cd libcvault
  • Manual Build

    • Create the object file(libcvault.o)
      g++ -std=c++17 -c main.cpp -o libcvault.o
    • Link with the source code(my_app.cpp)
      g++ -std=c++17 my_app.cpp libcvault.o -o my_app

Running the application

After building, run the application

./my_app

Example Usage

#include "head.hpp"
#include <iostream>

int main() {
    if (populateData(".") != 0) {
        std::cerr << "Directory scan failed\n";
        return 1;
    }

    std::cout << "Files found: " << getFileCount() << "\n";
    std::cout << "Total bytes: " << getTotalBytes() << "\n";
    std::cout << "Lines in head.hpp: " << lineCount("head.hpp") << "\n";

    return 0;
}

Output

Files found: 233
Total bytes: 585441
Lines in head.hpp: 38

Documentation

Support This Project

If libcvault has positively impacted your workflow, consider:

  • Starring this repository
  • Forking the project
  • Sharing feedback and suggestions
  • Contributing to the codebase

License

MIT