Merge pull request #3444 from Nemo157/sanitize-filename

Add definition for sanitize-filename
This commit is contained in:
Masahiro Wakame
2015-01-13 18:27:04 +09:00
2 changed files with 28 additions and 0 deletions
@@ -0,0 +1,12 @@
/// <reference path="./sanitize-filename.d.ts" />
import sanitize = require('sanitize-filename');
// Some string that may be unsafe as a filesystem filename
var UNSAFE_FILENAME = "h*ello:/world?\u0000";
// Sanitize the unsafe filename to be safe for use as a filename
var filename: string;
filename = sanitize(UNSAFE_FILENAME);
filename = sanitize(UNSAFE_FILENAME, { replacement: '--' });
+16
View File
@@ -0,0 +1,16 @@
// Type definitions for sanitize-filename v1.1.1
// Project: https://github.com/parshap/node-sanitize-filename
// Definitions by: Wim Looman <https://github.com/Nemo157>
// Definitions: https://github.com/borisyankov/DefinitelyTyped
declare module "sanitize-filename" {
function sanitize(filename: string, options?: sanitize.Options): string;
module sanitize {
interface Options {
replacement: string;
}
}
export = sanitize;
}