From 8da4662f74ba953f5ec8ff367a586487d2a6f2f7 Mon Sep 17 00:00:00 2001 From: Nicolas-ggd Date: Sun, 15 Dec 2024 18:01:32 +0400 Subject: [PATCH] [UPDATE] readme doc about extension check --- README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.md b/README.md index 3f54a5e..0b1830a 100644 --- a/README.md +++ b/README.md @@ -98,6 +98,20 @@ func Upload(c *gin.Context) { c.JSON(http.StatusOK, gin.H{"message": "file chunk processed"}) } ``` + +`fstream` offers extension check, all you need is that to provide which extension do you want to allow + +```go + import( + "github.com/Nicolas-ggd/filestream" + ) + + // Declare extension slice, slice contains all file extension which is ok for you to allow in your system + var allowExtensions = []string{".jpg", ".jpeg", ".png", ".gif", ".bmp", ".webp"} + + // This function is very simple, but save your time to compare extension and current file to known if it's valid for you + fstream.IsAllowExtension(allowExtensions, "filename.png") +``` ## License FileStream is open-source software licensed under the MIT License.