Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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 days ago
JSON representation

Dart / Flutter package, which replaces characters in strings that are illegal/unsafe for filenames.

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");
}
```