archive

package module
v0.0.0-...-c706584 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 10, 2017 License: GPL-3.0 Imports: 15 Imported by: 0

README

archive

GitHub Slack License GoDoc

Archive is a golang package for creating/working with warc & cdxj archives.

Copyright (C) 2017 Data Together

This program is free software: you can redistribute it and/or modify it under the terms of the GNU AFFERO General Public License as published by the Free Software Foundation, version 3.0.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

See the LICENSE file for details.

Getting Involved

We would love involvement from more people! If you notice any errors or would like to submit changes, please see our Contributing Guidelines.

We use GitHub issues for tracking bugs and feature requests and Pull Requests (PRs) for submitting changes

Installation

Use in any golang package with:

import "github.com/datatogether/archive"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ArchiveUrl

func ArchiveUrl(req *http.Request, rw *rewrite.WarcRecordRewriter, records warc.Records) (addRecords warc.Records, err error)

func DoRequest

func DoRequest(req *http.Request, records warc.Records) (reqr, resr *warc.Record, err error)

DoRequest performs an archival HTTP request, adding request & response records to the given records pointer, returning the response record & a list of all dependant resources

func HttpResponseRecord

func HttpResponseRecord(res *http.Response) (*warc.Record, error)

HttpResponseRecord creates a record from an HTTP response

func PackagePathName

func PackagePathName(rawurl string) string

func PackageRecords

func PackageRecords(urls []string, records warc.Records) (*memfs.Memdir, error)

func RenderIndexTemplate

func RenderIndexTemplate(w io.Writer, urls []string, records warc.Records) error

func RequestRecord

func RequestRecord(req *http.Request) *warc.Record

func SanitizeResponse

func SanitizeResponse(res *http.Response) (raw, sanitized []byte, mimetype string, err error)

Types

type TemplateData

type TemplateData struct {
	Title     string
	Datestamp string
	Records   []*TemplateRecord
}

func NewTemplateData

func NewTemplateData(title string, urls []string, records warc.Records) *TemplateData

type TemplateRecord

type TemplateRecord struct {
	Path      string
	Url       string
	Datestamp time.Time
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL