I believe .pak are 'just' zip files. So have a search on torry.

If you want to write your own fileformat, a word of warning: storing multiple files in one archive file just is not easy.

You might want to take a look at my nvfs project: http://www.noeska.net/projects/nvfs/ it is available under the mpl license. A word of warning here also it has no compression (yet) and it needs documentation and examples.