sanitize_filename 1.0.5 copy "sanitize_filename: ^1.0.5" to clipboard
sanitize_filename: ^1.0.5 copied to clipboard

Replaces characters in strings that are illegal/unsafe for filenames.

Dart package, which is a clone of the popular sanitize-filename npm module by Parsha Pourkhomami.

Usage #

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");
}
8
likes
160
points
6.98k
downloads

Publisher

verified publishere-go-mobile.de

Weekly Downloads

Replaces characters in strings that are illegal/unsafe for filenames.

Repository (GitHub)
View/report issues

Documentation

API reference

License

LGPL-3.0 (license)

More

Packages that depend on sanitize_filename