writer

package
v1.7.7 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2017 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Writer

type Writer interface {
	Head(path string, scanned, created time.Time, version [3]int, ids [][2]string, fields [][]string, hh string) // 	path := filepath.Base(path)
	File(name string, sz int64, mod string, checksum []byte, err error, ids []core.Identification)               // if a directory give a negative sz
	Tail()
}

func CSV

func CSV(w io.Writer) Writer

func Droid

func Droid(w io.Writer) Writer

func JSON

func JSON(w io.Writer) Writer
Example
js := JSON(ioutil.Discard)
js.Head("", time.Time{}, time.Time{}, [3]int{}, [][2]string{{"pronom", ""}}, [][]string{makeFields()}, "")
js.(*jsonWriter).w = bufio.NewWriter(os.Stdout)
js.File("example.doc", 1, "2015-05-24T16:59:13+10:00", nil, testErr{}, []core.Identification{testID{}})
js.Tail()
Output:

{"filename":"example.doc","filesize": 1,"modified":"2015-05-24T16:59:13+10:00","errors": "mscfb: bad OLE","matches": [{"ns":"pronom","id":"fmt/43","format":"JPEG File Interchange Format","version":"1.01","mime":"image/jpeg","basis":"extension match jpg; byte match at [[[0 14]] [[75201 2]]]","warning":""}]}]}

func Null

func Null() Writer

func YAML

func YAML(w io.Writer) Writer
Example
yml := YAML(ioutil.Discard)
yml.Head("", time.Time{}, time.Time{}, [3]int{}, [][2]string{{"pronom", ""}}, [][]string{makeFields()}, "")
yml.(*yamlWriter).w = bufio.NewWriter(os.Stdout)
yml.File("example.doc", 1, "2015-05-24T16:59:13+10:00", nil, testErr{}, []core.Identification{testID{}})
yml.Tail()
Output:

---
filename : 'example.doc'
filesize : 1
modified : 2015-05-24T16:59:13+10:00
errors   : 'mscfb: bad OLE'
matches  :
  - ns      : 'pronom'
    id      : 'fmt/43'
    format  : 'JPEG File Interchange Format'
    version : '1.01'
    mime    : 'image/jpeg'
    basis   : 'extension match jpg; byte match at [[[0 14]] [[75201 2]]]'
    warning :

Jump to

Keyboard shortcuts

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