{"id":16380148,"url":"https://github.com/dreamscached/sanity","last_synced_at":"2026-06-25T05:31:26.743Z","repository":{"id":45852797,"uuid":"417644033","full_name":"dreamscached/sanity","owner":"dreamscached","description":"📝 Fast extensible file name sanitizer that works in Windows/Linux","archived":false,"fork":false,"pushed_at":"2021-12-22T22:51:55.000Z","size":20,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-01T20:45:16.534Z","etag":null,"topics":["crossplatform","file","file-name","filename","go","go-library","golang","library","sanitizer","string"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/dreamscached/sanity","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/dreamscached.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":"2021-10-15T21:41:40.000Z","updated_at":"2023-05-21T20:55:31.000Z","dependencies_parsed_at":"2022-09-05T07:01:14.080Z","dependency_job_id":null,"html_url":"https://github.com/dreamscached/sanity","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dreamscached%2Fsanity","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dreamscached%2Fsanity/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dreamscached%2Fsanity/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dreamscached%2Fsanity/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dreamscached","download_url":"https://codeload.github.com/dreamscached/sanity/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240035706,"owners_count":19737602,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["crossplatform","file","file-name","filename","go","go-library","golang","library","sanitizer","string"],"created_at":"2024-10-11T03:50:35.104Z","updated_at":"2026-04-23T08:30:18.816Z","avatar_url":"https://github.com/dreamscached.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Sanity\n\nSanity is a fast and easily extensible file name (and in fact any other string) sanitizer.\n\n## Usage\n\n### Built-in rule set\n\nSanity provides a sensible default rule set for Windows and Linux file names that will be enough in most cases:\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/dreamscached/sanity/filename\"\n)\n\nfunc main() {\n\t// Prints 'con_.txt'\n\tfmt.Println(filename.Windows.Sanitize(\"con.txt\"))\n\n\t// Prints 'foobar'\n\tfmt.Println(filename.Unix.Sanitize(\"foo\\x00bar.txt\"))\n}\n```\n\n### Creating custom rule sets\n\nSanity provides a clean and obvious way to create custom rule sets with Rule factory functions. For example, here's\nLinux default file name rule set.\n\n```go\npackage main\n\nimport (\n\t\"github.com/dreamscached/sanity\"\n\t\"github.com/aquilax/truncate\"\n)\n\nvar Unix = sanity.New(\n\tsanity.Replace(\"/\", \" \"),\n\tsanity.StripRune(0x0),\n\tsanity.Truncate(255, truncate.DEFAULT_OMISSION, truncate.PositionEnd),\n)\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdreamscached%2Fsanity","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdreamscached%2Fsanity","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdreamscached%2Fsanity/lists"}