mediatype

package
v1.2.14 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2025 License: MIT Imports: 2 Imported by: 3

Documentation

Overview

Package mediatype provides tools to work with Media Types and Content Types

Index

Constants

View Source
const (
	// JupyterNotebookMediaType is the local IANA compliant mimetype to indicate a python notebook
	// using this because it is mentioned here: https://discourse.jupyter.org/t/i-cant-download-my-notebook-as-ipynb-anymore-it-saves-as-json/7043/4
	// Another common media type is application/x-ipynb+json
	JupyterNotebookMediaType = "application/x.jupyter.notebook+json"

	// JupyterNotebookExtension indicates an interactive python notebook
	JupyterNotebookExtension = ".ipynb"
)
View Source
const (
	// MediaTypeBottleConfig is the media type string for bottle configuration json
	MediaTypeBottleConfig = "application/vnd.act3-ace.bottle.config.v1+json"

	// MediaTypeLayerTarZstd is the media type string for tar+zstd layers
	MediaTypeLayerTarZstd = "application/vnd.act3-ace.bottle.layer.v1.tar+zstd"

	// MediaTypeLayerTarGzip is the media type string for tar+gzip layers
	MediaTypeLayerTarGzip = "application/vnd.act3-ace.bottle.layer.v1.tar+gzip"

	// MediaTypeLayerTar is the media type string for tar layers.  This is often used when a directory's tar archive does not compress well.
	MediaTypeLayerTar = "application/vnd.act3-ace.bottle.layer.v1.tar"

	// MediaTypeLayerZstd is the media type string for zstd compressed files
	MediaTypeLayerZstd = "application/vnd.act3-ace.bottle.layer.v1+zstd"

	// MediaTypeLayer is the media type string for general binary data (i.e., raw files).
	MediaTypeLayer = "application/vnd.act3-ace.bottle.layer.v1"
)
View Source
const (
	// MediaTypeLayerTarZstdOld is the media type string for tar+zstd archives.  This is older format where the part name was in the archive.
	MediaTypeLayerTarZstdOld = "application/vnd.act3-ace.bottle.layer.v1+tar+zstd"

	// TarGzipMediaType is the media type string for tar+gzip archives.  This is older format where the part name was in the archive.
	MediaTypeLayerTarGzipOld = "application/vnd.act3-ace.bottle.layer.v1+tar+gzip"

	// TarMediaType is the media type string for tar archives.  This is older format where the part name was in the archive.
	MediaTypeLayerTarOld = "application/vnd.act3-ace.bottle.layer.v1+tar"

	// MediaTypeLayerRaw is a raw binary media type that (no tar or compression).  This is often used when a file cannot be compressed.
	MediaTypeLayerRawOld = "application/vnd.act3-ace.bottle.layer.v1+raw"
)

Still in use but should not be used to create new bottles

View Source
const (
	// MediaTypeBottleConfigLegacy is the media type string for the bottle configuration json
	MediaTypeBottleConfigLegacy = "application/vnd.act3-ace.dataset.config.v1+json"

	// MediaTypeLayerTarZstdLegacy is the media type string for tar+zstd archives
	MediaTypeLayerTarZstdLegacy = "application/vnd.act3-ace.dataset.layer.v1+tar+zstd"

	// MediaTypeLayerTarGzipLegacy is the media type string for tar+gzip archives
	MediaTypeLayerTarGzipLegacy = "application/vnd.act3-ace.dataset.layer.v1+tar+gzip"

	// MediaTypeLayerTarLegacy is the media type string for tar archives
	MediaTypeLayerTarLegacy = "application/vnd.act3-ace.dataset.layer.v1+tar"

	// MediaTypeLayerZstdLegacy is the media type string for zstd compressed files
	MediaTypeLayerZstdLegacy = "application/vnd.act3-ace.dataset.layer.v1+zstd"

	// MediaTypeLayerRawLegacy is a binary media type that indicates a compressed or noisy format that can't be compressed
	MediaTypeLayerRawLegacy = "application/vnd.act3-ace.dataset.layer.v1+raw"
)

Obsolete media types TODO should we drop support for these in v1.0

View Source
const MediaTypeBottle = "application/vnd.act3-ace.bottle"

MediaTypeBottle is the MediaType for the bottle as a whole

Variables

This section is empty.

Functions

func DetermineType

func DetermineType(path string) string

DetermineType read the file extension of the file, and returns a type to be included when creating a public artifact

func IsArchived

func IsArchived(mediaType string) bool

IsArchived returns true if the format is a known archive format

func IsBottleConfig

func IsBottleConfig(mediaType string) bool

IsBottleConfig returns true if the provided media type matches a known bottle config media type

func IsCompressed

func IsCompressed(mediaType string) bool

IsCompressed returns true if the format is a known compressed format, or incompressible data

func IsLayer

func IsLayer(mediaType string) bool

IsLayer returns true for valid media types for layers

func IsRaw

func IsRaw(mediaType string) bool

IsRaw returns true if the format indicates that no processing should be done on the file

Types

This section is empty.

Jump to

Keyboard shortcuts

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