github.com/vchain-us/vcn@v0.9.11-0.20210921212052-a2484d23c0b3/pkg/extractor/file/executable.go (about) 1 /* 2 * Copyright (c) 2018-2020 vChain, Inc. All Rights Reserved. 3 * This software is released under GPL3. 4 * The full license information can be found under: 5 * https://www.gnu.org/licenses/gpl-3.0.en.html 6 * 7 */ 8 9 package file 10 11 import ( 12 "os" 13 "strings" 14 15 "github.com/vchain-us/vcn/pkg/api" 16 "github.com/vchain-us/vcn/pkg/extractor/file/internal/sniff" 17 ) 18 19 func xInfo(file *os.File, contentType *string) (bool, api.Metadata, error) { 20 if strings.HasPrefix(*contentType, "application/") { 21 d, err := sniff.File(file) 22 if err != nil { 23 return false, nil, err 24 } 25 *contentType = d.ContentType() 26 return true, api.Metadata{ 27 "architecture": strings.ToLower(d.Arch), 28 "platform": d.Platform, 29 "file": d, 30 }, nil 31 } 32 return false, nil, nil 33 }