mirror of
https://github.com/luxfi/lpm.git
synced 2026-10-30 16:20:57 +00:00
Lux Partners Limited is the Isle of Man company. Lux Industries Inc, a Delaware C corporation, is the company these sites belong to, so it is the one they name — in metadata, copyright, and the press items that record who signed. The fund site names Lux Assets Management LLC, which is its own company. Two sentences were rewritten rather than renamed, because a name was doing work a name cannot do. One claimed an Isle of Man domicile the naming entity does not have. The other said a company acts on behalf of another; with one entity left it said a company acts on behalf of itself. The Isle of Man stays everywhere it is a JURISDICTION the product supports — the regulatory package, the jurisdiction guides, the compliance tables. Only this company's own identity changed.
65 lines
1.1 KiB
Go
65 lines
1.1 KiB
Go
// Copyright (C) 2019-2025, Lux Industries Inc. All rights reserved.
|
|
// See the file LICENSE for licensing terms.
|
|
|
|
package url
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
|
|
"github.com/cavaliergopher/grab/v3"
|
|
)
|
|
|
|
var _ Client = &client{}
|
|
|
|
type Client interface {
|
|
Download(url string, path string) error
|
|
}
|
|
|
|
func NewClient() Client {
|
|
return &client{
|
|
grab.NewClient(),
|
|
}
|
|
}
|
|
|
|
type client struct {
|
|
client *grab.Client
|
|
}
|
|
|
|
func (h client) Download(url string, path string) error {
|
|
req, err := grab.NewRequest(path, url)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
fmt.Printf("Downloading %v...\n", req.URL())
|
|
resp := h.client.Do(req)
|
|
fmt.Printf("HTTP response %v\n", resp.HTTPResponse.Status)
|
|
|
|
// Start progress loop
|
|
t := time.NewTicker(1 * time.Second)
|
|
defer t.Stop()
|
|
|
|
Loop:
|
|
for {
|
|
select {
|
|
case <-t.C:
|
|
fmt.Printf(" transferred %v / %v bytes (%.2f%%)\n",
|
|
resp.BytesComplete(),
|
|
resp.Size(),
|
|
100*resp.Progress())
|
|
|
|
case <-resp.Done:
|
|
// download is complete
|
|
break Loop
|
|
}
|
|
}
|
|
|
|
// check for errors
|
|
if err := resp.Err(); err != nil {
|
|
return fmt.Errorf("Download failed: %s", err)
|
|
}
|
|
|
|
return nil
|
|
}
|