https://github.com/egomobile/sanitize_filename
Dart / Flutter package, which replaces characters in strings that are illegal/unsafe for filenames.
https://github.com/egomobile/sanitize_filename
dart dart-lang dart-package dart2 dartlang dartlanguage escape file filename flutter name package sanitize sanitize-filename sanitizer validate validation
Last synced: 3 months ago
JSON representation
Dart / Flutter package, which replaces characters in strings that are illegal/unsafe for filenames.
- Host: GitHub
- URL: https://github.com/egomobile/sanitize_filename
- Owner: egomobile
- License: lgpl-3.0
- Archived: true
- Created: 2022-06-21T13:05:01.000Z (almost 3 years ago)
- Default Branch: master
- Last Pushed: 2022-12-24T17:09:52.000Z (over 2 years ago)
- Last Synced: 2024-12-16T11:53:17.057Z (4 months ago)
- Topics: dart, dart-lang, dart-package, dart2, dartlang, dartlanguage, escape, file, filename, flutter, name, package, sanitize, sanitize-filename, sanitizer, validate, validation
- Language: Dart
- Homepage: https://pub.dev/packages/sanitize_filename
- Size: 15.6 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
Dart package, which is a clone of the popular [sanitize-filename](https://www.npmjs.com/package/sanitize-filename) npm module by [Parsha Pourkhomami](https://github.com/parshap).
## Usage
```dart
import 'package:sanitize_filename/sanitize_filename.dart';void main() {
const unsafeUserInput = "~/.\u0000ssh/authorized_keys";final safeUserInput1 = sanitizeFilename(unsafeUserInput);
final safeUserInput2 = sanitizeFilename(unsafeUserInput, replacement: '-');// "~.sshauthorized_keys"
print("safeUserInput1: $safeUserInput1");
// "~-.-ssh-authorized_keys"
print("safeUserInput2: $safeUserInput2");
}
```