Hi everyone,

This is my first message on this list so please apologize if this 
discussion has already showed up in the past.

What I'm trying to do is quite simple.

I do have a directory with files I want to share to a friend from my 
workstation.
I would like him to:
1. point his web browser to an URL
2. be prompted for credentials (basic auth' is ok for my use-case)
3. get a prompt to download a TAR archive that contains my workstation's 
directory and files structure.

My question is about the third point.

I do not want the TAR archive to be built on my workstation and then be 
sent over HTTP once the archive contains all the files.
Sometimes, my workstation does not have enough free disk space to store the 
temporary TAR archive and then send it.
I would like the TAR archive to be generated on the fly and *streamed over 
HTTP* without any storage on my workstation disk.

I've written a simple code here <https://github.com/riton/go-http-tar-dir> 
that does what I want.
Everything seems to work.

The code is written in hurry and I've used

exec.Command

to spawn the subprocess "tar cf -".
I would like to avoid using the external tar util.

I'm just starting in GoLang but I know that there is a package *archive/tar* 
that allows to create TAR archives.

I can't figure out how *archive/tar* can be used in my use case (i.e not 
generating the full TAR archive on my workstation and only then send it 
once the archive is generated).

If someone has already played with the *archive/tar* package and sees how I 
can use it to achieve what I want, any help would be appreciated in order 
to improve my GoLang skills

Thanks !

Cheers

Rémi



-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to