Documentation
¶
Overview ¶
Package tlcsv provides adapters to read and write GTFS from CSV format files.
Index ¶
- Variables
- func GetString(ent tt.Entity, key string) (string, error)
- func ReadEntities[T any](reader *Reader, efn string) chan T
- func ReadRows(in io.Reader, cb func(Row)) error
- func ReadRowsHeader(in io.Reader, cb func(Row)) ([]string, error)
- func ReadRowsIter(in io.Reader, optFns ...csvOptFn) iter.Seq2[Row, error]
- func SetString(ent tt.Entity, key string, value string) error
- type Adapter
- type DirAdapter
- func (adapter *DirAdapter) AddFile(filename string, reader io.Reader) error
- func (adapter *DirAdapter) Close() error
- func (adapter *DirAdapter) CloseFiles() error
- func (adapter *DirAdapter) DirSHA1() (string, error)
- func (adapter *DirAdapter) Exists() bool
- func (adapter *DirAdapter) FileInfos() ([]os.FileInfo, error)
- func (adapter *DirAdapter) Open() error
- func (adapter *DirAdapter) OpenFile(filename string, cb func(io.Reader)) error
- func (adapter *DirAdapter) Path() string
- func (adapter *DirAdapter) ReadRows(filename string, cb func(Row)) error
- func (adapter *DirAdapter) SHA1() (string, error)
- func (adapter *DirAdapter) SetStandardizedSortOptions(opts adapters.StandardizedSortOptions)
- func (adapter *DirAdapter) StandardizedSortCSVFiles() error
- func (adapter *DirAdapter) String() string
- func (adapter *DirAdapter) WriteFeatures(filename string, features []*geojson.Feature) error
- func (adapter *DirAdapter) WriteRows(filename string, rows [][]string) error
- type GeoJSONFeatureParser
- type GeoJSONFeatureWriter
- type OverlayAdapter
- func (adapter OverlayAdapter) Close() error
- func (adapter OverlayAdapter) CreateZip(outfile string) error
- func (adapter OverlayAdapter) DirSHA1() (string, error)
- func (adapter OverlayAdapter) Exists() bool
- func (adapter OverlayAdapter) Files() ([]string, error)
- func (adapter OverlayAdapter) Open() error
- func (adapter OverlayAdapter) OpenFile(filename string, cb func(io.Reader)) error
- func (adapter OverlayAdapter) Path() string
- func (adapter OverlayAdapter) ReadRows(filename string, cb func(Row)) error
- func (adapter OverlayAdapter) SHA1() (string, error)
- func (adapter OverlayAdapter) String() string
- type Reader
- func (reader *Reader) Agencies() (out chan gtfs.Agency)
- func (reader *Reader) Areas() (out chan gtfs.Area)
- func (reader *Reader) Attributions() (out chan gtfs.Attribution)
- func (reader *Reader) BookingRules() (out chan gtfs.BookingRule)
- func (reader *Reader) CalendarDates() (out chan gtfs.CalendarDate)
- func (reader *Reader) Calendars() (out chan gtfs.Calendar)
- func (reader *Reader) ContainsFile(filename string) bool
- func (reader *Reader) FareAttributes() (out chan gtfs.FareAttribute)
- func (reader *Reader) FareLegJoinRules() (out chan gtfs.FareLegJoinRule)
- func (reader *Reader) FareLegRules() (out chan gtfs.FareLegRule)
- func (reader *Reader) FareMedia() (out chan gtfs.FareMedia)
- func (reader *Reader) FareProducts() (out chan gtfs.FareProduct)
- func (reader *Reader) FareRules() (out chan gtfs.FareRule)
- func (reader *Reader) FareTransferRules() (out chan gtfs.FareTransferRule)
- func (reader *Reader) FeedInfos() (out chan gtfs.FeedInfo)
- func (reader *Reader) Frequencies() (out chan gtfs.Frequency)
- func (reader *Reader) GetAllowPartial() bool
- func (reader *Reader) Levels() (out chan gtfs.Level)
- func (reader *Reader) LocationGroupStops() (out chan gtfs.LocationGroupStop)
- func (reader *Reader) LocationGroups() (out chan gtfs.LocationGroup)
- func (reader *Reader) Locations() (out chan gtfs.Location)
- func (reader *Reader) Networks() (out chan gtfs.Network)
- func (reader *Reader) Pathways() (out chan gtfs.Pathway)
- func (reader *Reader) ReadEntities(c interface{}) error
- func (reader *Reader) RiderCategories() (out chan gtfs.RiderCategory)
- func (reader *Reader) RouteNetworks() (out chan gtfs.RouteNetwork)
- func (reader *Reader) Routes() (out chan gtfs.Route)
- func (reader *Reader) SetAllowPartial(v bool)
- func (reader *Reader) Shapes() chan gtfs.Shape
- func (reader *Reader) ShapesByShapeID(shapeIDs ...string) chan []gtfs.Shape
- func (reader *Reader) StopAreas() (out chan gtfs.StopArea)
- func (reader *Reader) StopTimes() (out chan gtfs.StopTime)
- func (reader *Reader) StopTimesByTripID(tripIDs ...string) chan []gtfs.StopTime
- func (reader *Reader) Stops() (out chan gtfs.Stop)
- func (reader *Reader) String() string
- func (reader *Reader) Timeframes() (out chan gtfs.Timeframe)
- func (reader *Reader) Transfers() (out chan gtfs.Transfer)
- func (reader *Reader) Translations() (out chan gtfs.Translation)
- func (reader *Reader) Trips() (out chan gtfs.Trip)
- func (reader *Reader) TripsWithStopTimes(ids ...string) chan gtfs.TripStopTimes
- func (reader *Reader) ValidateStructure() []error
- type Row
- type URLAdapter
- type Writer
- func (writer *Writer) AddEntities(ents []tt.Entity) ([]string, error)
- func (writer *Writer) AddEntity(ent tt.Entity) (string, error)
- func (writer *Writer) Create() error
- func (writer *Writer) Delete() error
- func (writer *Writer) NewReader() (adapters.Reader, error)
- func (writer *Writer) SetStandardizedSortOptions(opts adapters.StandardizedSortOptions)
- func (writer *Writer) String() string
- func (writer *Writer) WriteExtraColumns(val bool)
- type WriterAdapter
- type ZipAdapter
- func (adapter *ZipAdapter) Close() error
- func (adapter *ZipAdapter) DirSHA1() (string, error)
- func (adapter *ZipAdapter) Exists() bool
- func (adapter *ZipAdapter) FileInfos() ([]os.FileInfo, error)
- func (adapter *ZipAdapter) Open() error
- func (adapter *ZipAdapter) OpenFile(filename string, cb func(io.Reader)) error
- func (adapter *ZipAdapter) Path() string
- func (adapter *ZipAdapter) ReadRows(filename string, cb func(Row)) error
- func (adapter *ZipAdapter) SHA1() (string, error)
- func (adapter *ZipAdapter) String() string
- type ZipReaderAdapter
- func (adapter *ZipReaderAdapter) Close() error
- func (adapter *ZipReaderAdapter) DirSHA1() (string, error)
- func (adapter *ZipReaderAdapter) Exists() bool
- func (adapter *ZipReaderAdapter) FileInfos() ([]os.FileInfo, error)
- func (adapter *ZipReaderAdapter) Open() error
- func (adapter *ZipReaderAdapter) OpenFile(filename string, cb func(io.Reader)) error
- func (adapter *ZipReaderAdapter) Path() string
- func (adapter *ZipReaderAdapter) ReadRows(filename string, cb func(Row)) error
- func (adapter *ZipReaderAdapter) SHA1() (string, error)
- func (adapter *ZipReaderAdapter) String() string
- type ZipWriterAdapter
Constants ¶
This section is empty.
Variables ¶
var MapperCache = tags.NewCache(reflectx.NewMapperFunc("csv", tags.ToSnakeCase))
Functions ¶
func ReadEntities ¶ added in v0.11.0
func ReadRowsHeader ¶ added in v1.4.0
ReadRowsHeader iterates through csv rows with callback and returns the header row. The callback is only invoked for rows after the header, so this is the only way to see a file that has no data rows.
func ReadRowsIter ¶ added in v1.0.0
Types ¶
type Adapter ¶
type Adapter interface {
OpenFile(string, func(io.Reader)) error
ReadRows(string, func(Row)) error
Open() error
Close() error
Exists() bool
Path() string
SHA1() (string, error)
DirSHA1() (string, error)
String() string
}
Adapter provides an interface for working with various kinds of GTFS sources: zip, directory, url.
func NewAdapter ¶ added in v0.10.1
NewAdapter returns a basic adapter for the given URL. Use NewURLAdapter() to provide additional options.
type DirAdapter ¶
type DirAdapter struct {
// contains filtered or unexported fields
}
DirAdapter supports plain directories of CSV files.
func NewDirAdapter ¶
func NewDirAdapter(path string) *DirAdapter
NewDirAdapter returns an initialized DirAdapter.
func (*DirAdapter) AddFile ¶ added in v0.8.5
func (adapter *DirAdapter) AddFile(filename string, reader io.Reader) error
AddFile directly adds a file to this directory. Useful for manual feed operations.
func (*DirAdapter) Close ¶
func (adapter *DirAdapter) Close() error
Close the adapter. Flushes any buffered GeoJSON files before closing.
func (*DirAdapter) CloseFiles ¶ added in v1.3.3
func (adapter *DirAdapter) CloseFiles() error
CloseFiles closes all open file handles.
func (*DirAdapter) DirSHA1 ¶
func (adapter *DirAdapter) DirSHA1() (string, error)
DirSHA1 returns the SHA1 of all the .txt files in the main directory, sorted, and concatenated.
func (*DirAdapter) Exists ¶
func (adapter *DirAdapter) Exists() bool
Exists checks if the specified directory exists.
func (*DirAdapter) FileInfos ¶
func (adapter *DirAdapter) FileInfos() ([]os.FileInfo, error)
FileInfos returns a list of os.FileInfo for all top-level .txt files.
func (*DirAdapter) Open ¶
func (adapter *DirAdapter) Open() error
Open the adapter. Return an error if the directory does not exist.
func (*DirAdapter) OpenFile ¶
func (adapter *DirAdapter) OpenFile(filename string, cb func(io.Reader)) error
OpenFile opens a file in the directory. Returns an error if the file cannot be read.
func (*DirAdapter) ReadRows ¶
func (adapter *DirAdapter) ReadRows(filename string, cb func(Row)) error
ReadRows opens the file and runs the callback for each row. An error is returned if the file cannot be read.
func (*DirAdapter) SetStandardizedSortOptions ¶ added in v1.3.3
func (adapter *DirAdapter) SetStandardizedSortOptions(opts adapters.StandardizedSortOptions)
func (*DirAdapter) StandardizedSortCSVFiles ¶ added in v1.3.3
func (adapter *DirAdapter) StandardizedSortCSVFiles() error
StandardizedSortCSVFiles sorts every registered .txt file in place.
TODO: this loads each file fully into memory (csv.ReadAll + in-memory sort.SliceStable + truncate-and-rewrite). For large feeds, files like stop_times.txt and shapes.txt can be tens of millions of rows and will drive RSS up accordingly. The feature is opt-in, so the cost is only paid when callers ask for it. A streaming external-merge replacement is possible (write sorted runs to temp files, then k-way merge), but the same memory pressure is reachable through other endpoints, so a caller-bounded fix here can be defeated by an attacker who simply hits a different code path. Revisit alongside any general resource-limit work, not as a one-off.
func (*DirAdapter) WriteFeatures ¶ added in v1.3.1
func (adapter *DirAdapter) WriteFeatures(filename string, features []*geojson.Feature) error
WriteFeatures buffers GeoJSON features to be written when the adapter is closed.
type GeoJSONFeatureParser ¶ added in v1.3.0
GeoJSONFeatureParser is a callback function for parsing a GeoJSON feature into a GTFS entity. It receives the feature and should return the parsed entity and whether it was successfully parsed.
type GeoJSONFeatureWriter ¶ added in v1.3.1
GeoJSONFeatureWriter is a callback function for converting a GTFS entity into a GeoJSON feature. It receives the entity and should return the feature and whether it was successfully converted.
type OverlayAdapter ¶
type OverlayAdapter struct {
// contains filtered or unexported fields
}
OverlayAdapter searches a specified list of directories for the specified file. Used for reducing the complexity of writing tests.
func NewOverlayAdapter ¶
func NewOverlayAdapter(paths ...string) OverlayAdapter
NewOverlayAdapter returns a new OverlayAdapter.
func (OverlayAdapter) Close ¶
func (adapter OverlayAdapter) Close() error
Close implements CSV Adapter.Close.
func (OverlayAdapter) CreateZip ¶ added in v0.8.5
func (adapter OverlayAdapter) CreateZip(outfile string) error
func (OverlayAdapter) DirSHA1 ¶
func (adapter OverlayAdapter) DirSHA1() (string, error)
DirSHA1 returns the SHA1 of all the .txt files in the main directory, sorted, and concatenated.
func (OverlayAdapter) Exists ¶
func (adapter OverlayAdapter) Exists() bool
Exists implements CSV Adapter.Exists.
func (OverlayAdapter) Files ¶ added in v0.8.5
func (adapter OverlayAdapter) Files() ([]string, error)
func (OverlayAdapter) Open ¶
func (adapter OverlayAdapter) Open() error
Open implements CSV Adapter Open.
func (OverlayAdapter) OpenFile ¶
func (adapter OverlayAdapter) OpenFile(filename string, cb func(io.Reader)) error
OpenFile searches paths until it finds the specified file.
func (OverlayAdapter) Path ¶
func (adapter OverlayAdapter) Path() string
Path implements CSV Adapter.Path.
func (OverlayAdapter) ReadRows ¶
func (adapter OverlayAdapter) ReadRows(filename string, cb func(Row)) error
ReadRows implements CSV Adapter ReadRows.
func (OverlayAdapter) SHA1 ¶
func (adapter OverlayAdapter) SHA1() (string, error)
SHA1 is an alias for DirSHA1
func (OverlayAdapter) String ¶ added in v0.11.0
func (adapter OverlayAdapter) String() string
type Reader ¶
type Reader struct {
Adapter
// contains filtered or unexported fields
}
Reader reads GTFS entities from CSV files.
func NewReaderFromAdapter ¶ added in v0.10.1
func (*Reader) Attributions ¶ added in v0.10.0
func (reader *Reader) Attributions() (out chan gtfs.Attribution)
func (*Reader) BookingRules ¶ added in v1.3.0
func (reader *Reader) BookingRules() (out chan gtfs.BookingRule)
func (*Reader) CalendarDates ¶
func (reader *Reader) CalendarDates() (out chan gtfs.CalendarDate)
func (*Reader) ContainsFile ¶
ContainsFile checks if filename is present and contains a readable row.
func (*Reader) FareAttributes ¶
func (reader *Reader) FareAttributes() (out chan gtfs.FareAttribute)
func (*Reader) FareLegJoinRules ¶ added in v1.4.0
func (reader *Reader) FareLegJoinRules() (out chan gtfs.FareLegJoinRule)
func (*Reader) FareLegRules ¶ added in v0.11.0
func (reader *Reader) FareLegRules() (out chan gtfs.FareLegRule)
func (*Reader) FareProducts ¶ added in v0.11.0
func (reader *Reader) FareProducts() (out chan gtfs.FareProduct)
func (*Reader) FareTransferRules ¶ added in v0.11.0
func (reader *Reader) FareTransferRules() (out chan gtfs.FareTransferRule)
func (*Reader) Frequencies ¶
func (*Reader) GetAllowPartial ¶ added in v1.4.0
GetAllowPartial reports whether partial mode is enabled.
func (*Reader) LocationGroupStops ¶ added in v1.3.0
func (reader *Reader) LocationGroupStops() (out chan gtfs.LocationGroupStop)
func (*Reader) LocationGroups ¶ added in v1.3.0
func (reader *Reader) LocationGroups() (out chan gtfs.LocationGroup)
func (*Reader) ReadEntities ¶
ReadEntities provides a generic interface for reading entities.
func (*Reader) RiderCategories ¶ added in v0.11.0
func (reader *Reader) RiderCategories() (out chan gtfs.RiderCategory)
func (*Reader) RouteNetworks ¶ added in v1.0.0
func (reader *Reader) RouteNetworks() (out chan gtfs.RouteNetwork)
func (*Reader) SetAllowPartial ¶ added in v1.4.0
SetAllowPartial enables partial mode: read what we can, skipping the required-files check.
func (*Reader) ShapesByShapeID ¶ added in v1.0.0
ShapesByShapeID yields each shape's points grouped into one []gtfs.Shape, in shapes.txt order. A grouped file (each shape_id's rows contiguous) streams in a single pass; otherwise points are chunked under chunkSize by first-appearance order — the same order-preserving scheme as TripsWithStopTimes. With shapeIDs, only those shapes are yielded.
func (*Reader) StopTimesByTripID ¶
StopTimesByTripID sends StopTimes for selected trips.
func (*Reader) Timeframes ¶ added in v1.0.0
func (*Reader) Translations ¶ added in v0.10.0
func (reader *Reader) Translations() (out chan gtfs.Translation)
func (*Reader) TripsWithStopTimes ¶ added in v1.3.4
func (reader *Reader) TripsWithStopTimes(ids ...string) chan gtfs.TripStopTimes
TripsWithStopTimes yields every trip with its StopTimes attached, buffering at most chunkSize stop_times at a time (configurable via TL_GTFS_CHUNKSIZE) so memory stays bounded regardless of feed size. It satisfies the copier's trip+stop_time streaming contract: trips are yielded in stop_times.txt first-appearance order (a deterministic order that order-sensitive validators like block-overlap can rely on), with trips that have no stop_times trailing in trips.txt order; for a duplicate trip_id the first occurrence carries the stop_times and later ones are empty; and stop_times whose trip_id is absent from trips.txt are yielded as invalid entries (Valid = false) so their reference can still be validated.
Using stop_times order (rather than trips.txt order) is what lets the grouped fast path below stream a sorted stop_times.txt in a single pass while producing output identical to the chunked path. If ids are given, only those trip_ids are yielded.
func (*Reader) ValidateStructure ¶
ValidateStructure checks the feed's structure: that the source opens and that each expected file is present, has a header with its required columns (no duplicates), and has at least one data row. It reads only the header and first data row of each file, so it verifies file presence and shape, not full readability — a file that opens cleanly but hits a read error partway through is caught during the actual data pass, not here.
type URLAdapter ¶
type URLAdapter struct {
ZipAdapter
// contains filtered or unexported fields
}
URLAdapter downloads a GTFS URL to a temporary file, and removes the file when it is closed.
func NewURLAdapter ¶ added in v0.10.1
func NewURLAdapter(address string, opts ...request.RequestOption) *URLAdapter
func (*URLAdapter) Open ¶
func (adapter *URLAdapter) Open() error
Open the adapter, and download the provided URL to a temporary file.
func (*URLAdapter) String ¶ added in v0.11.0
func (adapter *URLAdapter) String() string
type Writer ¶
type Writer struct {
WriterAdapter
// contains filtered or unexported fields
}
Writer implements a GTFS Writer that supports both CSV and GeoJSON file formats. The format is automatically determined by the entity's Filename() method.
func (*Writer) AddEntities ¶
AddEntities writes entities to the output.
func (*Writer) SetStandardizedSortOptions ¶ added in v1.3.3
func (writer *Writer) SetStandardizedSortOptions(opts adapters.StandardizedSortOptions)
func (*Writer) WriteExtraColumns ¶ added in v0.11.0
type WriterAdapter ¶
type WriterAdapter interface {
WriteRows(string, [][]string) error
WriteFeatures(string, []*geojson.Feature) error
Adapter
}
WriterAdapter provides a writing interface.
type ZipAdapter ¶
type ZipAdapter struct {
// contains filtered or unexported fields
}
ZipAdapter supports reading from zip archives.
func NewStoreAdapter ¶ added in v0.18.0
func NewStoreAdapter(ctx context.Context, storage string, key string, fragment string) (*ZipAdapter, error)
NewStoreAdapter is a convenience method for getting a GTFS Zip reader from the store.
func NewTmpZipAdapterFromReader ¶ added in v0.12.0
func NewTmpZipAdapterFromReader(reader io.Reader, fragment string) (*ZipAdapter, error)
func NewZipAdapter ¶
func NewZipAdapter(path string) *ZipAdapter
NewZipAdapter returns an initialized zip adapter.
func (*ZipAdapter) DirSHA1 ¶
func (adapter *ZipAdapter) DirSHA1() (string, error)
DirSHA1 returns the SHA1 of all the .txt files in the main directory, sorted, and concatenated.
func (*ZipAdapter) Exists ¶
func (adapter *ZipAdapter) Exists() bool
Exists returns if the zip file exists.
func (*ZipAdapter) FileInfos ¶
func (adapter *ZipAdapter) FileInfos() ([]os.FileInfo, error)
FileInfos returns a list of os.FileInfo for all .txt files.
func (*ZipAdapter) Open ¶
func (adapter *ZipAdapter) Open() error
Open the adapter. Return an error if the file does not exist.
func (*ZipAdapter) OpenFile ¶
func (adapter *ZipAdapter) OpenFile(filename string, cb func(io.Reader)) error
OpenFile opens the file inside the archive and passes it to the provided callback.
func (*ZipAdapter) Path ¶
func (adapter *ZipAdapter) Path() string
Path returns the path to the zip file.
func (*ZipAdapter) ReadRows ¶
func (adapter *ZipAdapter) ReadRows(filename string, cb func(Row)) error
ReadRows opens the specified file and runs the callback on each Row. An error is returned if the file cannot be read.
func (*ZipAdapter) SHA1 ¶
func (adapter *ZipAdapter) SHA1() (string, error)
SHA1 returns the SHA1 checksum of the zip archive.
func (*ZipAdapter) String ¶ added in v0.11.0
func (adapter *ZipAdapter) String() string
type ZipReaderAdapter ¶ added in v1.4.0
type ZipReaderAdapter struct {
// contains filtered or unexported fields
}
ZipReaderAdapter reads a GTFS zip from memory (any io.ReaderAt) instead of a path on disk, decompressing each file on demand. Use it when the archive bytes are already in memory (e.g. an upload) and there is no usable filesystem — notably under js/wasm, where the path-based ZipAdapter cannot create temp files.
func NewZipReaderAdapter ¶ added in v1.4.0
func NewZipReaderAdapter(r io.ReaderAt, size int64) (*ZipReaderAdapter, error)
NewZipReaderAdapter builds an adapter over a zip read from r (size bytes). The source must stay valid for the adapter's lifetime (it is read lazily).
func NewZipReaderAdapterFromBytes ¶ added in v1.4.0
func NewZipReaderAdapterFromBytes(b []byte) (*ZipReaderAdapter, error)
NewZipReaderAdapterFromBytes builds an adapter over raw zip bytes. The slice is retained (read lazily), so the caller must not mutate it.
func (*ZipReaderAdapter) Close ¶ added in v1.4.0
func (adapter *ZipReaderAdapter) Close() error
func (*ZipReaderAdapter) DirSHA1 ¶ added in v1.4.0
func (adapter *ZipReaderAdapter) DirSHA1() (string, error)
func (*ZipReaderAdapter) Exists ¶ added in v1.4.0
func (adapter *ZipReaderAdapter) Exists() bool
Exists reports whether the archive parsed and holds any entries.
func (*ZipReaderAdapter) FileInfos ¶ added in v1.4.0
func (adapter *ZipReaderAdapter) FileInfos() ([]os.FileInfo, error)
FileInfos returns an os.FileInfo for each top-level .txt file (under the internal feed-root prefix), so file-info stats can be computed straight from an in-memory archive — mirroring ZipAdapter.FileInfos, but over the already-parsed in-memory zip rather than reopening a file on disk. Call after Open so the internal prefix is resolved.
func (*ZipReaderAdapter) Open ¶ added in v1.4.0
func (adapter *ZipReaderAdapter) Open() error
Open auto-discovers the internal feed-root prefix (the directory containing stops.txt), mirroring ZipAdapter.
func (*ZipReaderAdapter) OpenFile ¶ added in v1.4.0
func (adapter *ZipReaderAdapter) OpenFile(filename string, cb func(io.Reader)) error
OpenFile streams the named entry's decompressed bytes to cb, decompressing on demand. Each call opens a fresh reader, so a file may be read multiple times.
func (*ZipReaderAdapter) Path ¶ added in v1.4.0
func (adapter *ZipReaderAdapter) Path() string
func (*ZipReaderAdapter) ReadRows ¶ added in v1.4.0
func (adapter *ZipReaderAdapter) ReadRows(filename string, cb func(Row)) error
func (*ZipReaderAdapter) SHA1 ¶ added in v1.4.0
func (adapter *ZipReaderAdapter) SHA1() (string, error)
SHA1 hashes the whole archive, streamed from the source.
func (*ZipReaderAdapter) String ¶ added in v1.4.0
func (adapter *ZipReaderAdapter) String() string
type ZipWriterAdapter ¶
type ZipWriterAdapter struct {
DirAdapter
// contains filtered or unexported fields
}
ZipWriterAdapter functions the same as DirAdapter, but writes to a temporary directory, and creates a zip archive when closed.
func NewZipWriterAdapter ¶
func NewZipWriterAdapter(path string) *ZipWriterAdapter
NewZipWriterAdapter returns a new ZipWriterAdapter.
func (*ZipWriterAdapter) Close ¶
func (adapter *ZipWriterAdapter) Close() error
Close creates a zip archive of all the written files at the specified destination.