Skip to content
master
Go to file
Code

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 

README.md

TGStore

PkgGoDev

An encrypted object storage system with unlimited space backed by Telegram.

Please only upload what you really need to upload, don't abuse any system.

Features

  • Unlimited storage space
  • Up to 50 TiB or more (depending on the tgstore.TGStore.MaxFileBytes) per object
  • Crazy upload and download speed (try concurrency to make it happen)

Installation

Open your terminal and execute

$ go get golang.design/x/tgstore

done.

The only requirement is the Go, at least v1.13.

Hello, 世界

Create a file named hello.go

package main

import (
	"context"
	"crypto/rand"
	"fmt"
	"io/ioutil"
	"log"
	"strings"
	"time"

	"golang.design/x/tgstore"
	"golang.org/x/crypto/chacha20poly1305"
)

func main() {
	tgs := tgstore.New()
	tgs.BotToken = "<your-telegram-bot-token"
	tgs.ChatID = 1234567890

	objectKey := make([]byte, chacha20poly1305.KeySize)
	if _, err := rand.Read(objectKey); err != nil {
		log.Fatal(err)
	}

	startTime := time.Now()

	object, err := tgs.Upload(
		context.TODO(),
		objectKey,
		strings.NewReader("Hello, 世界"),
	)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("Upload time:", time.Since(startTime))

	startTime = time.Now()

	downloadedObject, err := tgs.Download(
		context.TODO(),
		object.ID,
		objectKey,
	)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("Download time:", time.Since(startTime))

	startTime = time.Now()

	rc, err := downloadedObject.NewReader(context.TODO())
	if err != nil {
		log.Fatal(err)
	}
	defer rc.Close()

	b, err := ioutil.ReadAll(rc)
	if err != nil {
		log.Fatal(err)
	}

	fmt.Println("Read time:", time.Since(startTime))

	fmt.Println("Content:", string(b))
}

and run it

$ go run hello.go

then check what your terminal outputs.

Community

If you want to discuss TGStore, or ask questions about it, simply post questions or ideas here.

Contributing

If you want to help build TGStore, simply follow this to send pull requests here.

License

This project is licensed under the MIT License.

License can be found here.

About

An encrypted object storage system with unlimited space backed by Telegram.

Topics

Resources

License

Packages

No packages published

Languages