bulkIt

package module
v1.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2022 License: MIT Imports: 12 Imported by: 0

README

bulkIt GoDoc

About The Package

A Go package that allows you to download multiple files concurrently.

Get Files, One Goroutine at a time

Import package
go get github.com/colt005/bulkIt
import "github.com/colt005/bulkIt"

Usage

    c := &http.Client{}
    maxThreads := 50
    b := bulkIt.NewBulkIt(c,maxThreads)

Example

package main

import (
	"net/http"

	"github.com/colt005/bulkIt"
)

func main() {
	c := &http.Client{}
	maxThreads := 10
	b := bulkIt.NewBulkIt(c, maxThreads)

	b.SaveFilesByUrls([]string{"https://www.sample-videos.com/img/Sample-jpg-image-1mb.jpg"}, "./")
}

Functions

func func bulkIt.NewBulkIt(c *http.Client, maxThreads int) *bulkIt.bulkItClient

Create a new bulkItClient.

  • Params
    • c - The bulkIt package's http client for sending out http requests.If you specify nil, the package will utilise the default http client.
    • maxThreads - The maximum number of go routines that may be executed simultaneously to send out http requests. If the value is sepcified as 0, It will default to 30.
func (*bulkItClient) SaveFilesByUrls(urls []string,path string)

SaveFilesByUrls takes slice of urls and the path where the files need to be saved.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBulkIt

func NewBulkIt(c *http.Client, maxThreads int) *bulkItClient

/ Create an FileSave object which takes in an http Client to make requests and an integer value which controls the number of threads to be fired. If `c` is nil, default http.Client will be assigned. If `maxThreads` is 0 then `maxThreads` will default to 30

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL