zaru_crystal alternatives and similar shards
Based on the "Misc" category.
Alternatively, view zaru_crystal alternatives based on common mentions on social networks and blogs.
-
sentry
Build/Runs your crystal application, watches files, and rebuilds/restarts app on file changes -
immutable
Thread-safe, persistent, immutable collections for the Crystal language -
crystagiri
An Html parser library for Crystal (like Nokogiri for Ruby) -
crz
Functional programming library for https://github.com/crystal-lang/crystal -
crystal-web-framework-stars
⭐️ Web frameworks for Crystal, most starred on Github -
cron_scheduler
Simple job scheduler with crontab patterns for Crystal Language. -
crystal-futures
Future type implementation for Crystal language -
inflector.cr
Inflector shard for Crystal. A port of ActiveSupport::Inflector -
aasm.cr
:arrows_clockwise: Easy to use finite state machine for Crystal classes -
kreal
Kreal is a model sharing & RPC library built on and works with Kemal seamlessly. -
retriable.cr
Retriable.cr is a simple DSL to retry failed code blocks -
ulid
Universally Unique Lexicographically Sortable Identifier (ULID) in Crystal -
CrSerializer
Extensible annotation based serialization/deserialization library -
circuit_breaker
Implementation of the circuit breaker pattern in crystal -
burocracia.cr
No dependency Crystal shard to validate, generate and format Brazilian burocracias such as CPF, CNPJ and CEP -
wikicr
Wiki in crystal, using Markdown and Git, inspired by dokuwiki. Last features to build are pretty hard, if you have some time to help... :) -
m3u8
Generate and parse m3u8 playlists for HTTP Live Streaming (HLS) in Crystal. -
message_verifier.cr
Rails compatible MessageVerifier for Crystal-lang apps
Access the most powerful time series database as a service
Do you think we are missing an alternative of zaru_crystal or a related project?
README
zaru_crystal
Filename sanitization for Crystal. This is useful when you generate filenames for downloads from user input. Port of the Zaru gem for Ruby.
Installation
- Add the dependency to your
shard.yml
:
dependencies:
zaru_crystal:
github: szTheory/zaru_crystal
- Run
shards install
Usage
require "zaru_crystal"
Zaru.sanitize! " what\ēver//wëird:user:înput:"
# => "whatēverwëirduserînput"
Zaru takes a given filename (a string) and normalizes, filters and truncates it.
It removes the bad stuff but leaves unicode characters in place, so users can use whatever alphabets they want to. Zaru also doesn't remove whitespace– instead, any sequence of whitespace that is 1 or more characters in length is collapsed to a single space. Filenames are truncated so that they are at maximum 255 characters long.
If extra breathing room is required (for example to add your own filename extension later),
you can leave extra room with the :padding
option:
Zaru.sanitize! "A"*400, padding: 100
# resulting filename is 145 characters long
If you need to customize the fallback filename you can add your own fallback
with the :fallback
option:
Zaru.sanitize! "<<<", fallback: "no_file"
# resulting filename is "no_file"
Bad things in filenames
Wikipedia has a good overview on filenames. Basically, on modern-ish operating systems, the following characters are considered no-no (Zaru filters these):
/ \ ? * : | " < >
Additionally the ASCII control characters (hexadecimal 00
to 1f
) are filtered.
All Unicode whitespace at the beginning and end of the potential filename is removed, and any Unicode whitespace within the filename is collapse to a single space character.
Certain filenames are reserved in Windows and are filtered.
zaru_crystal is licensed under the terms of the MIT license.
*Note that all licence references and agreements mentioned in the zaru_crystal README section above
are relevant to that project's source code only.