Skip to content

Latest commit

 

History

78 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

libcvault

MIT License g++ 13.3.0+ Release Docs: Available

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.

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

Requirements

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

Build Example

git clone https://github.com/tecnolgd/libcvault
cd libcvault
g++ -std=c++17 -c main.cpp -o libcvault.o
g++ -std=c++17 my_app.cpp libcvault.o -o 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

Author & License