{"id":13412786,"url":"https://github.com/xis/baraka","last_synced_at":"2026-02-24T01:46:04.620Z","repository":{"id":45645343,"uuid":"279154663","full_name":"xis/baraka","owner":"xis","description":"a tool for handling file uploads simple","archived":false,"fork":false,"pushed_at":"2022-09-30T18:10:43.000Z","size":81,"stargazers_count":53,"open_issues_count":2,"forks_count":7,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-07-31T20:51:25.740Z","etag":null,"topics":["api","baraka","contributions-welcome","file","file-upload","filtering","filters","go","golang","help-wanted","http","images","multipart","multipart-uploads","parser","simple","upload","upload-file"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-12T21:56:50.000Z","updated_at":"2024-05-27T18:45:08.000Z","dependencies_parsed_at":"2022-08-01T01:39:07.055Z","dependency_job_id":null,"html_url":"https://github.com/xis/baraka","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/xis/baraka","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xis%2Fbaraka","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xis%2Fbaraka/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xis%2Fbaraka/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xis%2Fbaraka/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xis","download_url":"https://codeload.github.com/xis/baraka/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xis%2Fbaraka/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29767484,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-24T01:40:24.820Z","status":"ssl_error","status_checked_at":"2026-02-24T01:39:15.130Z","response_time":90,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","baraka","contributions-welcome","file","file-upload","filtering","filters","go","golang","help-wanted","http","images","multipart","multipart-uploads","parser","simple","upload","upload-file"],"created_at":"2024-07-30T20:01:29.184Z","updated_at":"2026-02-24T01:46:04.605Z","avatar_url":"https://github.com/xis.png","language":"Go","readme":"\n\u003cdiv align=\"center\"\u003e\n\t\u003cpre\u003e                         \n ▄▄▄▄    ▄▄▄       ██▀███   ▄▄▄       ██ ▄█▀▄▄▄      \n▓█████▄ ▒████▄    ▓██ ▒ ██▒▒████▄     ██▄█▒▒████▄    \n▒██▒ ▄██▒██  ▀█▄  ▓██ ░▄█ ▒▒██  ▀█▄  ▓███▄░▒██  ▀█▄  \n▒██░█▀  ░██▄▄▄▄██ ▒██▀▀█▄  ░██▄▄▄▄██ ▓██ █▄░██▄▄▄▄██ \n░▓█  ▀█▓ ▓█   ▓██▒░██▓ ▒██▒ ▓█   ▓██▒▒██▒ █▄▓█   ▓██▒\n░▒▓███▀▒ ▒▒   ▓▒█░░ ▒▓ ░▒▓░ ▒▒   ▓▒█░▒ ▒▒ ▓▒▒▒   ▓▒█░\n▒░▒   ░   ▒   ▒▒ ░  ░▒ ░ ▒░  ▒   ▒▒ ░░ ░▒ ▒░ ▒   ▒▒ ░\n ░    ░   ░   ▒     ░░   ░   ░   ▒   ░ ░░ ░  ░   ▒   \n ░            ░  ░   ░           ░  ░░  ░        ░  ░\n      ░                                              \n\t\u003c/pre\u003e\n  \n[![Go Report Card](https://goreportcard.com/badge/github.com/xis/baraka)](https://goreportcard.com/report/github.com/xis/baraka)\n[![codecov](https://codecov.io/gh/xis/baraka/branch/master/graph/badge.svg)](https://codecov.io/gh/xis/baraka)\n[![Build Status](https://travis-ci.org/xis/baraka.svg?branch=master)](https://travis-ci.org/xis/baraka) \n[![go.dev reference](https://img.shields.io/badge/go.dev-reference-007d9c?logo=go\u0026logoColor=white\u0026style=flat-square)](https://pkg.go.dev/github.com/xis/baraka/v2)\n  \na tool for handling file uploads for http servers\n\nmakes it easier to make operations with files from the http request.\n\u003c/div\u003e\n\n## Contents\n - [Install](#Install)\n - [Simple Usage](#Simple-Usage)\n - [Filtering Parts](#Filtering-Parts)\n - [More](#More)\n - [Contribute](#Contribute)\n - [License](#License)\n\n## Install\n```bash\ngo get github.com/xis/baraka/v2\n```\n\n## Simple Usage\n```go\nfunc main() {\n\t// create a parser\n\tparser := baraka.NewParser(baraka.ParserOptions{\n\t\tMaxFileSize:   5 \u003c\u003c 20,\n\t\tMaxFileCount:  5,\n\t\tMaxParseCount: 5,\n\t})\n\n\tstore := baraka.NewFilesystemStorage(\"./files\")\n\n\trouter := gin.Default()\n\trouter.POST(\"/upload\", func(c *gin.Context) {\n\t\t// parse\n\t\trequest, err := parser.Parse(c.Request)\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\n\t\t// get the form\n\t\timages, err := request.GetForm(\"images\")\n\t\tif err != nil {\n\t\t\tfmt.Println(err)\n\t\t}\n\n\t\t// save\n\t\tfor key, image := range images {\n\t\t\terr = store.Save(\"images\", \"image_\"+strconv.Itoa(key), image)\n\t\t\tif err != nil {\n\t\t\t\tfmt.Println(err)\n\t\t\t}\n\t\t}\n\t})\n\trouter.Run()\n}\n```\nYou can use baraka with the other http server libraries, just pass the http.Request to the parser.Parse function.\n\n## Filtering Parts\nYou can filter parts by their properties, like part's content type. Parser can inspect the part's bytes and detect the type of the part with the Inspector.\n\n```go\n// create a parser\nparser := baraka.NewParser(baraka.ParserOptions{\n\tMaxFileSize:   5 \u003c\u003c 20,\n\tMaxFileCount:  5,\n\tMaxParseCount: 5,\n})\n\n// give parser an inspector\nparser.SetInspector(baraka.NewDefaultInspector(512))\n// give parser a filter\nparser.SetFilter(baraka.NewExtensionFilter(\".jpg\"))\n```\n\nNow parser will inspect the each part and it will just return the jpeg ones from the Parse function. You can make your own Inspector and Filter.\n\n## Contribute\nPull requests are welcome. please open an issue first to discuss what you would like to change.\n\nPlease make sure to update tests as appropriate.\n\n## License\n[MIT](https://choosealicense.com/licenses/mit/)\n","funding_links":[],"categories":["HarmonyOS","File Handling","文件处理","文件处理`处理文件和文件系统操作的库`","Relational Databases"],"sub_categories":["Windows Manager","Search and Analytic Databases","Advanced Console UIs","检索及分析资料库","SQL 查询语句构建库"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxis%2Fbaraka","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxis%2Fbaraka","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxis%2Fbaraka/lists"}