Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

golang.design/x/tgstore

Package Overview
Dependencies
Alerts
File Explorer
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

golang.design/x/tgstore

  • v0.2.1
  • Go
  • Socket score

Version published
Created
Source

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

Installation

Open your terminal and execute

$ go get golang.design/x/tgstore

done.

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

Hello, 世界

Create a file named hello.go

package main

import (
	"context"
	"crypto/rand"
	"fmt"
	"io"
	"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

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

	startTime := time.Now()

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

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

	startTime = time.Now()

	objectReader, err := tgs.Download(
		context.TODO(),
		objectSecretKey,
		objectID,
	)
	if err != nil {
		log.Fatal(err)
	}

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

	startTime = time.Now()

	b, err := io.ReadAll(objectReader)
	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.

FAQs

Package last updated on 05 Mar 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc