Пример #1
0
func Folder(p string) (io.ReadCloser, error) {
	return utils.TarGzExclude(
		p,

		// Excluded files & folders
		".git",
		"node_modules",
		"bower",
		"_book",
		"book.pdf",
		"book.mobi",
		"book.epub",
	)
}
Пример #2
0
// PublishFolder packages a folder as tar.gz and uploads it to gitbook.io
func (b *Book) PublishFolder(bookId, version, bookpath string) error {
	// Build tar from folder, exclude unwanted directories
	tar, err := utils.TarGzExclude(
		bookpath,

		// Excluded files & folders
		".git",
		"node_modules",
		"bower",
		"_book",
		"book.pdf",
		"book.mobi",
		"book.epub",
	)
	if err != nil {
		return err
	}
	defer tar.Close()

	return b.PublishStream(bookId, version, tar)
}