Home

Published

- 1 min read

golang check file extension

img of golang check file extension

The solution for this is noted below

golang check file extension

Solution

   import (
	"fmt"
	"path/filepath"
 )

func main(){
	path := "/media/godfather.mp4"

	fileExtension := filepath.Ext(path)

	fmt.Println("File extension ", fileExtension)

  }

Try other methods by searching on the site. That is if this doesn’t work