MCPcopy Create free account

hub / github.com/gabriel-vasile/mimetype / functions

Functions472 in github.com/gabriel-vasile/mimetype

↓ 20 callersMethodUint32
()
internal/scan/bytes.go:134
↓ 18 callersFunctionDetect
Detect parses raw as a CDF (OLE2) compound file and returns the document type it contains. It returns CDFTypeGeneric for input that is not a CDF file
internal/cdf/cdf.go:29
↓ 18 callersFunctionoffset
offset returns true if the provided signature can be found at offset in the raw input.
internal/magic/magic.go:26
↓ 17 callersMethodAdvance
(n int)
internal/scan/bytes.go:12
↓ 14 callersFunctionxml
xml returns true if any of the provided XML signatures matches the raw input.
internal/magic/magic.go:58
↓ 13 callersFunctionftyp
ftyp returns true if any of the FTYP signatures matches the raw input.
internal/magic/magic.go:127
↓ 12 callersFunctionByteIsWS
(b byte)
internal/scan/bytes.go:264
↓ 12 callersFunctionDetect
Detect returns the MIME type found from the provided byte slice. The result is always a valid MIME type, with "application/octet-stream" returned whe
mimetype.go:24
↓ 12 callersMethodString
String returns the string representation of the MIME type, e.g., "application/zip". String return values can change between releases, for example, whe
mime.go:34
↓ 10 callersMethodUint16
()
internal/scan/bytes.go:125
↓ 10 callersMethodconsumeAny
(b []byte, qs []query, lvl int)
internal/json/parser.go:392
↓ 9 callersMethodMatch
Match returns how many bytes were needed to match pattern p. It returns -1 if p does not match b.
internal/scan/bytes.go:198
↓ 9 callersMethodPeek
Peek one byte from b or 0x00 if b is empty.
internal/scan/bytes.go:52
↓ 9 callersFunctionshebang
A valid shebang starts with the "#!" characters, followed by any number of spaces, followed by the path to the interpreter, and, optionally, followed
internal/magic/magic.go:154
↓ 8 callersMethodLine
Line returns the first line from b and advances b with the length of the line. One new line character is trimmed after the line if it exists.
internal/scan/bytes.go:115
↓ 8 callersFunctiontestHeader
testHeader builds a 512-byte CDF header with secSize-byte sectors and 64-byte short sectors.
internal/cdf/cdf_test.go:24
↓ 7 callersFunctionDetectReader
DetectReader returns the MIME type of the provided reader. The result is always a valid MIME type, with "application/octet-stream" returned when iden
mimetype.go:45
↓ 7 callersMethodTrimLWS
TrimLWS trims whitespace from beginning of the bytes.
internal/scan/bytes.go:21
↓ 7 callersFunctionsummaryStream
summaryStream builds a minimal (Doc)SummaryInformation property-set stream containing a single NameOfApplication (0x12) property. If wide is true the
internal/cdf/cdf_test.go:83
↓ 6 callersMethodIs
Is checks whether this MIME type, or any of its [aliases], is equal to the expected MIME type. MIME type equality test is done on the "type/subtype" s
mime.go:62
↓ 6 callersFunctiondirEntryBytes
dirEntryBytes encodes a single 128-byte directory entry. The name is encoded as NUL-terminated UTF-16LE.
internal/cdf/cdf_test.go:67
↓ 6 callersFunctionidSector
idSector encodes ids as a secSize-byte sector of little-endian int32s, padding with -1 (free).
internal/cdf/cdf_test.go:46
↓ 6 callersFunctionmakeCDF
makeCDF assembles a complete single-SAT-sector CDF file with secSize-byte sectors: sector 0: SAT sector 1: directory (root entry, optional summary
internal/cdf/cdf_test.go:127
↓ 6 callersFunctionpadSector
padSector pads b with zeros to a full secSize-byte sector.
internal/cdf/cdf_test.go:59
↓ 5 callersFunctionFromPlain
FromPlain returns the charset of a plain text. It relies on BOM presence and it falls back on checking each byte in content.
internal/charset/charset.go:67
↓ 5 callersFunctionGetAnAttribute
GetAnAttribute assumes we passed over an SGML tag and extracts first attribute and its value. Initially, this code existed inside charset/charset.go,
internal/markup/markup.go:18
↓ 5 callersFunctionLookup
Lookup finds a MIME object by its string representation. The representation can be the main MIME type, or any of its aliases.
mimetype.go:122
↓ 5 callersFunctionParse
Parse will take out a parser from the pool depending on queryType and tries to parse raw bytes as JSON.
internal/json/parser.go:102
↓ 5 callersMethodPop
Pop one byte from b or 0x00 if b is empty.
internal/scan/bytes.go:60
↓ 5 callersMethodPopUntil
PopUntil will advance b until, but not including, the first occurrence of stopAt character. If no occurrence is found, then it will advance until the
internal/scan/bytes.go:82
↓ 5 callersMethodSearch
Search for occurrences of pattern p inside b at any index. It returns the index where p was found in b and how many bytes were needed for matching the
internal/scan/bytes.go:168
↓ 5 callersMethodframeBytes
frameBytes returns the size of the frame body (header + side info + audio data, excluding padding) in bytes.
internal/mp3/frame.go:133
↓ 5 callersFunctionjsonHelper
jsonHelper parses raw and tries to match the q query against it. wantToks ensures we're not wasting time parsing an input that would not pass anyway,
internal/magic/text.go:372
↓ 5 callersFunctionmatchOleClsid
Helper to match by a specific CLSID of a compound file. http://fileformats.archiveteam.org/wiki/Microsoft_Compound_File
internal/magic/ms_office.go:203
↓ 4 callersMethodExtension
Extension returns the file extension associated with the MIME type. It includes the leading dot, as in ".html". When the file format does not have an
mime.go:41
↓ 4 callersFunctionExtractFrame
(b []byte)
internal/mp3/frame.go:10
↓ 4 callersMethodParent
Parent returns the parent MIME type from the hierarchy. Each MIME type has a non-nil parent, except for the root MIME type. For example, the applicat
mime.go:52
↓ 4 callersMethodconsumeString
(b []byte)
internal/json/parser.go:146
↓ 4 callersMethoddirAt
dirAt decodes the i-th directory entry into *out. Callers must ensure i < dirLen(). The UTF-16LE name is decoded into out.name, ASCII-style, stopping
internal/cdf/cdf.go:462
↓ 4 callersMethoddirLen
dirLen returns the number of directory entries in dirRaw.
internal/cdf/cdf.go:457
↓ 4 callersMethodflatten
flatten transforms an hierarchy of MIMEs into a slice of MIMEs.
mime.go:130
↓ 4 callersFunctionmsoxml
msoxml behaves like zipHas, but it puts restrictions on what the first zip entry can be.
internal/magic/zip.go:164
↓ 4 callersMethodreset
()
internal/json/parser.go:118
↓ 3 callersMethodCountFields
CountFields reads one CSV line and counts how many records that line contained. hasMore reports whether there are more lines in the input. collectInde
internal/csv/parser.go:49
↓ 3 callersMethodExtend
Extend adds detection for a sub-format. The detector is a function returning true when the raw input file satisfies a signature. The sub-format will b
mime.go:208
↓ 3 callersFunctionFromBOM
FromBOM returns the charset declared in the BOM of content.
internal/charset/charset.go:56
↓ 3 callersFunctionNewParser
(comma, comment byte, s *scan.Bytes)
internal/csv/parser.go:18
↓ 3 callersFunctionSetLimit
SetLimit sets the maximum number of bytes read from input when detecting the MIME type. Increasing the limit provides better detection for file format
mimetype.go:109
↓ 3 callersMethodat
(i int)
internal/cdf/cdf.go:216
↓ 3 callersFunctionbuildValidMP3Header
buildValidMP3Header builds a known-good MPEG2.5 Layer3 frame header. MPEG2.5 (version=0), Layer3, bitrate index 1 (8 kbps), sample rate index 2 (8000
internal/mp3/frame_test.go:32
↓ 3 callersFunctionbytesToHeader
(b []byte)
internal/mp3/frame_test.go:24
↓ 3 callersFunctionciPrefix
ciPrefix is like prefix but the check is case insensitive.
internal/magic/magic.go:31
↓ 3 callersMethodconsumeArray
(b []byte, qs []query, lvl int)
internal/json/parser.go:252
↓ 3 callersMethodconsumeNumber
(b []byte)
internal/json/parser.go:184
↓ 3 callersMethodconsumeObject
(b []byte, qs []query, lvl int)
internal/json/parser.go:314
↓ 3 callersMethodconsumeSpace
(b []byte)
internal/json/parser.go:125
↓ 3 callersFunctionextractCharsetFromMeta
https://html.spec.whatwg.org/multipage/urls-and-fetching.html#algorithm-for-extracting-a-character-encoding-from-a-meta-element
internal/charset/charset.go:240
↓ 3 callersFunctiongetAValue
(s *scan.Bytes)
internal/markup/markup.go:57
↓ 3 callersFunctionjpeg2k
(raw []byte, sig []byte)
internal/magic/image.go:167
↓ 3 callersMethodnameBytes
nameBytes returns the decoded ASCII name without copying.
internal/cdf/cdf.go:173
↓ 3 callersFunctionnetp
(s scan.Bytes, prefixes ...string)
internal/magic/netpbm.go:72
↓ 3 callersMethodpadding
()
internal/mp3/frame.go:68
↓ 3 callersFunctionput32
(b []byte, off int, v uint32)
internal/cdf/cdf_test.go:492
↓ 3 callersMethodreadLong
readLong reads a long-sector chain starting at sid. If length > 0 the result is truncated to that many bytes. On truncation or any other failure it re
internal/cdf/cdf.go:356
↓ 3 callersFunctionreadSecID
readSecID reinterprets four little-endian bytes as a signed sector id. Every 32-bit pattern is a valid id (values >= 0 are sector numbers, negatives a
internal/cdf/cdf.go:228
↓ 3 callersMethodsector
sector returns the bytes of long sector secid. If the file is truncated inside the requested sector the result is the available bytes (no padding). If
internal/cdf/cdf.go:250
↓ 3 callersFunctiontestTruncating
Truncate inputs at each possible index and test if decoder parses the truncated part successfully.
internal/json/parser_test.go:620
↓ 3 callersMethodvalid
valid reports whether the four bytes form a syntactically valid MP3 header.
internal/mp3/frame.go:76
↓ 3 callersFunctionzipHas
(raw scan.Bytes, searchFor zipEntries, stopAfter int)
internal/magic/zip.go:147
↓ 2 callersFunctionDetectFile
DetectFile returns the MIME type of the provided file. The result is always a valid MIME type, with "application/octet-stream" returned when identifi
mimetype.go:78
↓ 2 callersFunctionDocx
Docx matches a Microsoft Word 2007 file.
internal/magic/ms_office.go:19
↓ 2 callersFunctionEqualsAny
EqualsAny reports whether s MIME type is equal to any MIME type in mimes. MIME type equality test is done on the "type/subtype" section, ignores any o
mimetype.go:92
↓ 2 callersMethodFirstNonWS
FirstNonWS returns the first non-whitespace character from b, or 0x00 if no such character is found.
internal/scan/bytes.go:40
↓ 2 callersFunctionFromHTML
FromHTML returns the charset of an HTML document. It first looks if a BOM is present and if so uses it to determine the charset. If no BOM is present,
internal/charset/charset.go:153
↓ 2 callersFunctionFromXML
FromXML returns the charset of an XML document. It relies on the XML header <?xml version="1.0" encoding="UTF-8"?> and falls back on the plain text co
internal/charset/charset.go:118
↓ 2 callersFunctionJar
Jar matches a Java archive file. There are two types of Jar files: 1. the ones that can be opened with jexec and have 0xCAFE optional flag https://sta
internal/magic/zip.go:86
↓ 2 callersFunctionPptx
Pptx matches a Microsoft PowerPoint 2007 file.
internal/magic/ms_office.go:27
↓ 2 callersMethodReadSlice
ReadSlice is the same as PopUntil, but the returned value includes stopAt as well.
internal/scan/bytes.go:97
↓ 2 callersFunctionSkipAComment
(s *scan.Bytes)
internal/markup/markup.go:96
↓ 2 callersMethodTrimRWS
TrimRWS trims whitespace from the end of the bytes.
internal/scan/bytes.go:30
↓ 2 callersFunctionXlsx
Xlsx matches a Microsoft Excel 2007 file.
internal/magic/ms_office.go:11
↓ 2 callersMethodappendPath
appendPath will append a path fragment if queries is not empty. If we don't need query functionality (just checking if a JSON is valid), then we can s
internal/json/parser.go:303
↓ 2 callersFunctionbuildFrame
buildFrame constructs a 4-byte MP3 frame header with the given parameters. version: 0=MPEG2.5, 2=MPEG2, 3=MPEG1 layer: 1=Layer3, 2=Layer2, 3=Layer1
internal/mp3/frame_test.go:15
↓ 2 callersFunctionclassOrMachOFat
Java bytecode and Mach-O binaries share the same magic number. More info here https://github.com/threatstack/libmagic/blob/master/magic/Magdir/cafebab
internal/magic/binary.go:59
↓ 2 callersMethodconsumeConst
(b, cnst []byte)
internal/json/parser.go:134
↓ 2 callersFunctioncreateZip
(files []string)
internal/magic/zip_test.go:11
↓ 2 callersFunctionfromHTML
(s scan.Bytes)
internal/charset/charset.go:163
↓ 2 callersFunctionfromXML
(s scan.Bytes)
internal/charset/charset.go:124
↓ 2 callersFunctionisDigit
(c byte)
internal/json/parser.go:449
↓ 2 callersMethodisMPEG1
()
internal/mp3/frame.go:61
↓ 2 callersFunctionisMatroskaFileTypeMatched
isMatroskaFileTypeMatched is used for webm and mkv file matching. It checks for .Eߣ sequence. If the sequence is found, then it means it is Matroska
internal/magic/video.go:40
↓ 2 callersMethodlen
()
internal/cdf/cdf.go:220
↓ 2 callersFunctionmarkup
markup returns true is any of the HTML signatures matches the raw input.
internal/magic/magic.go:85
↓ 2 callersMethodmatch
match does a depth-first search on the signature tree. It returns the deepest successful node for which all the children detection functions fail.
mime.go:104
↓ 2 callersMethodmatch
(file []byte)
internal/magic/zip.go:132
↓ 2 callersMethodnext
next extracts the name of the next zip entry.
internal/magic/zip.go:193
↓ 2 callersFunctionourLines
(data string, comma, comment byte)
internal/csv/parser_test.go:140
↓ 2 callersMethodpopLastPath
(qs []query)
internal/json/parser.go:308
↓ 2 callersFunctionput16
(b []byte, off int, v uint16)
internal/cdf/cdf_test.go:491
↓ 2 callersMethodrawBitrate
()
internal/mp3/frame.go:64
next →1–100 of 472, ranked by callers