`ctxio` gives `io.copy` operations the ability to cancel with context and retrieve progress data.

ctxio

The ctxio package gives golang io.copy operations the ability to terminate with context and retrieve progress data.

Install

  go get github.com/binalyze/ctxio

Usage

Here is an example to use ctxio with io.copy operation. You can find more examples in test files.

Writer

srcFile, err := os.Open("sourcefile.log")
dstFile, err := os.Create("destinationFile.log")

progressFn := func(n int64) {
    // Here you can send progress to API etc.
}

w := NewWriter(ctx, dstFile, progressFn)

written, err := io.Copy(w, file)

Roadmap

  • Add io.Reader support just like io.Writer

Related Projects

Owner
Binalyze
Incident Response re-imagined!
Binalyze
Similar Resources

Best simple, lightweight, powerful and really fast Api with Golang (Fiber, REL, Dbmate) PostgreSqL Database and Clean Architecture

GOLANG FIBER API (CLEAN ARCHITECTURE) Best simple, lightweight, powerful and really fast Api with Golang (Fiber, REL, Dbmate) PostgreSqLDatabase using

Sep 2, 2022

Flexible E-Commerce Framework on top of Flamingo. Used to build E-Commerce "Portals" and connect it with the help of individual Adapters to other services.

Flamingo Commerce With "Flamingo Commerce" you get your toolkit for building fast and flexible commerce experience applications. A demoshop using the

Dec 31, 2022

gin auto binding,grpc, and annotated route,gin 注解路由, grpc,自动参数绑定工具

gin auto binding,grpc, and annotated route,gin 注解路由, grpc,自动参数绑定工具

中文文档 Automatic parameter binding base on go-gin doc Golang gin automatic parameter binding Support for RPC automatic mapping Support object registrati

Jan 3, 2023

A quick and easy way to setup a RESTful JSON API

Go-Json-Rest A quick and easy way to setup a RESTful JSON API Go-Json-Rest is a thin layer on top of net/http that helps building RESTful JSON APIs ea

Jan 3, 2023

A small and evil REST framework for Go

go-rest A small and evil REST framework for Go Reflection, Go structs, and JSON marshalling FTW! go get github.com/ungerik/go-rest import "github.com/

Dec 6, 2022

hiboot is a high performance web and cli application framework with dependency injection support

Hiboot - web/cli application framework About Hiboot is a cloud native web and cli application framework written in Go. Hiboot is not trying to reinven

Nov 20, 2022

Package macaron is a high productive and modular web framework in Go.

Package macaron is a high productive and modular web framework in Go.

Macaron Package macaron is a high productive and modular web framework in Go. Getting Started The minimum requirement of Go is 1.6. To install Macaron

Jan 2, 2023

Mango is a modular web-application framework for Go, inspired by Rack, and PEP333.

Mango Mango is a modular web-application framework for Go, inspired by Rack and PEP333. Note: Not actively maintained. Overview Mango is most of all a

Nov 17, 2022
Related tags
Go-context - A simply tryout of how contexts work in golang

go-context A simply tryout of how contexts work in golang The example here execu

Apr 7, 2022
TeslaMateApi is a RESTful API to get data collected by self-hosted data logger TeslaMate in JSON

TeslaMateApi is a RESTful API to get data collected by self-hosted data logger TeslaMate in JSON.

Dec 10, 2022
A very basic REST service for JSON data - enough for prototyping and MVPs!

caffeine - minimum viable backend A very basic REST service for JSON data - enough for prototyping and MVPs! Features: no need to set up a database, a

Dec 24, 2022
Example of REST API to collect simple data

Statistics Collector An example of REST API to collect views statistics How to build There is Docker file you can set TARGET_OS and TARGET_ARCH to com

Dec 6, 2021
Data injection wrapper for values maintained in a GCP Secret Manager document.

injector The injector is a utility that retrieves a GCP Secret Manager document which contains an HJSON or JSON object with an embedded top-level envi

Jan 19, 2022
GoAdmin Instruction - A golang framework help gopher quickly build a data visualization platform

GoAdmin Instruction - A golang framework help gopher quickly build a data visualization platform

Jan 21, 2022
Go-userapi-rest - Build a RESTful API that can get/create/update/delete user data from a persistence database

GO ASSIGNMENT Overview of the Task Context Build a RESTful API that can get/crea

Sep 6, 2022
REST api using fiber framework written in golang and using firebase ecosystem to authentication, storage and firestore as a db and use clean architecture as base
REST api using fiber framework written in golang and using firebase ecosystem to authentication, storage and firestore as a db and use clean architecture as base

Backend API Example FiberGo Framework Docs : https://github.com/gofiber Info This application using firebase ecosystem Firebase Auth Cloud Storage Fir

May 31, 2022
Flamingo Framework and Core Library. Flamingo is a go based framework for pluggable web projects. It is used to build scalable and maintainable (web)applications.
Flamingo Framework and Core Library. Flamingo is a go based framework for pluggable web projects. It is used to build scalable and maintainable (web)applications.

Flamingo Framework Flamingo is a web framework based on Go. It is designed to build pluggable and maintainable web projects. It is production ready, f

Jan 5, 2023
Dec 28, 2022