Categorygithub.com/writeas/import
modulepackage
0.2.1
Repository: https://github.com/writeas/import.git
Documentation: pkg.go.dev

# README

import

libraries for parsing and importing posts from various source files

usage

import wfimport "github.com/writeas/import"

See GoDoc for details https://godoc.org/github.com/writeas/import

# Functions

FromDirectory reads all text and markdown files in path and returns the parsed posts and an error if any.
FromDirectoryMatch reads all text and markdown files in path that match the pattern returning the parsed posts and an error if any.
FromFile reads in a file from path and returns the parsed post and an error if any.
FromZip opens a zip archive and returns a slice of *writeas.PostParams and an error if any.
FromZipByFunc opens an archive and filters the contents according to the passed ZipFunc.
FromZipDirs opens a zip archive and returns a map of post collections and an error if any.
FromZipDirsByFunc works as FromZipDirs but filtering files through f.
TextFileZipFunc parses .txt files into PostParams.
TopLevelZipFunc returns a pointer to a writeas.PostParams for any parseable zip.File that is not a directory.

# Constants

DraftsKey is the key for all parsed draft posts in a ZipCollections map.

# Variables

ErrEmptyDir is returned when the directory is empty.
ErrEmptyFile is returned when the file is empty.
ErrInvalidContentType is returned when the detected content type does not match text/* as per net/http.DetectContentType.

# Type aliases

ZipCollections holds a map of collections of post params.
ZipFunc should return a pointer to a writeas.PostParams for any zip.File that meets criteria.