Skip to content

Fafnir is an library that act as an download manager with advanced features

License

Notifications You must be signed in to change notification settings

khatibomar/fafnir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Fafnir


Fafnir is a library that acts as a download manager with advanced features for your App

Usage example

package main

import (
	"sync"

	"github.com/khatibomar/fafnir"
	"github.com/khatibomar/fafnir/repository"
)

func main() {
	errChan := make(chan error, 10)
	go func() {
		for err := range errChan {
			// handle error
		}
	}()

	repo := repository.NewInMemory()

	var wg sync.WaitGroup

	cfg := &fafnir.Config{
		ErrChan:                errChan,
		MaxConcurrentDownloads: 2,
		MaxFailError:           3,
		UpdateTimeMs:           1000,
		Repo:                   repo,
		WaitGroup:              &wg,
	}
	faf, err := fafnir.New(cfg)
	if err != nil {
		// handle error
	}

	queueName := "q1"
	downloadDir := "./downloads"
	faf.Add(
		queueName,
		"https://static.wikia.nocookie.net/maid-dragon/images/f/ff/Fafnir_profile.jpg",
		downloadDir,
		"fafnir.jpg",
		"Fafnir (ファフニール Fafunīru)",
	)

	faf.Add(
		queueName,
		"https://static.wikia.nocookie.net/maid-dragon/images/5/57/Kanna_Anime.png",
		downloadDir,
		"kanna.png",
		"Kanna Kamui (カンナカムイ) ",
	)

	if err = faf.StartQueueDownload(queueName); err != nil {
		// handle error
	}
}

Showcase

Post.mp4

About

Fafnir is an library that act as an download manager with advanced features

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages