Skip to content

r-lyeh-archived/flow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

flow

  • Flow is a lightweight network downloader with native fallbacks. Aimed to gamedev.
  • Flow is non-blocking friendly. Support for sync/async requests.
  • Flow is tiny. Single header and source files.
  • Flow is zlib/libpng licensed.

sample

#include <cassert>
#include <iostream>
#include <string>

#include "flow.hpp"

int main( int argc, const char **argv ) {
    auto prompt = []() {
        std::string prompt;
        while( prompt.empty() ) {
            std::cout << "url> ";
            std::getline( std::cin, prompt );
        }
        return prompt;
    };

    for( ;; ) {
        std::string url;
        url = prompt();

        // sync test
        flow::status status = flow::download(url);
        std::cout << "sync: "<< status.url << ";ok=" << status.ok << "," << status.data.size() << " bytes;" << status.code << std::endl;

        // async test
        flow::download_async(url, []( flow::status &status ) {
            std::cout << "async: "<< status.url << ";ok=" << status.ok << "," << status.data.size() << " bytes;" << status.code << std::endl;
        } );
    }

        return 0;
}

About

🎈 Lightweight C++ network downloader with native fallbacks. Aimed to gamedev.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages