Add definition for sanitize-filename

This commit is contained in:
Wim Looman
2015-01-12 13:24:35 +13:00
parent 6ee44e03b8
commit b1ce1cc514
2 changed files with 28 additions and 0 deletions

View File

@@ -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: '--' });

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;
}