{"name":"sanitize-filename","version":"1.5.3","description":"Sanitize a string for use as a filename","main":"index.js","scripts":{"test":"tape test.js","test-browser":"zuul --local --open -- test.js","test-browser-sauce":"zuul -- test.js"},"repository":{"type":"git","url":"git+ssh://git@github.com/parshap/node-sanitize-filename.git"},"keywords":["file","name","filename","sanitize","validate","escape"],"author":{"name":"Parsha Pourkhomami"},"license":"WTFPL OR ISC","devDependencies":{"browserify":"^12.0.1","concat-stream":"^1.5.1","mktemp":"^0.4.0","tape":"^4.2.2","zuul":"^3.7.2"},"dependencies":{"truncate-utf8-bytes":"^1.0.0"},"contributors":[{"name":"Parsha Pourkhomami","email":"parshap@gmail.com"},{"name":"Joel Mukuthu","email":"joelmukuthu@gmail.com"}],"gitHead":"2bfbf0ce18608cc24d199049bf120afb1aa2d4a8","bugs":{"url":"https://github.com/parshap/node-sanitize-filename/issues"},"homepage":"https://github.com/parshap/node-sanitize-filename#readme","_id":"sanitize-filename@1.5.3","_shasum":"4c35f7fb9572bdcee2f426974210467e57f6b574","_from":".","_npmVersion":"2.12.1","_nodeVersion":"0.12.7","_npmUser":{"name":"parshap","email":"parshap+npm@gmail.com"},"maintainers":[{"name":"parshap","email":"supster+npm@gmail.com"}],"dist":{"shasum":"4c35f7fb9572bdcee2f426974210467e57f6b574","tarball":"http://registry-npm.ywwl.com/sanitize-filename/download/sanitize-filename-1.5.3.tgz","integrity":"sha512-tDbzXRb3oyKmsvx+TfXODgYjTqmSbN5Ra1I1qlSswxCK9nfeyEAGBUJxZy8P6IKK0j39W0PM+PUYfx7ShZIB+A==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQC77SilHLcYvn5qQigPgnc7y33rHzsEuBmNU2PRhwlVIgIhANO+w+G5MANJkW93ym7Hjov6Sdjt/3BHzL9OXRctm9ag"}],"size":31884,"noattachment":false,"key":"/sanitize-filename/-/sanitize-filename-1.5.3.tgz"},"directories":{},"readme":"# sanitize-filename [![build status](https://secure.travis-ci.org/parshap/node-sanitize-filename.svg?branch=master)](http://travis-ci.org/parshap/node-sanitize-filename)\n\nSanitize a string to be safe for use as a filename by removing directory\npaths and invalid characters.\n\n## Install\n\n[npm: *sanitize-filename*](https://www.npmjs.com/package/sanitize-filename)\n\n```\nnpm install sanitize-filename\n```\n\n## Example\n\n```js\nvar sanitize = require(\"sanitize-filename\");\n\n// Some string that may be unsafe or invalid as a filename\nvar UNSAFE_USER_INPUT = \"~/.\\u0000ssh/authorized_keys\";\n\n// Sanitize the string to be safe for use as a filename.\nvar filename = sanitize(UNSAFE_USER_INPUT);\n// -> \"~.sshauthorized_keys\"\n```\n\n## Details\n\n*sanitize-filename* removes the following:\n\n * [Control characters][] (`0x00`–`0x1f` and `0x80`–`0x9f`)\n * [Reserved characters][] (`/`, `?`, `<`, `>`, `\\`, `:`, `*`, `|`, and\n   `\"`)\n * Unix reserved filenames (`.` and `..`)\n * Trailing periods and spaces ([for Windows][windows trailing])\n * Windows reserved filenames (`CON`, `PRN`, `AUX`, `NUL`, `COM1`,\n   `COM2`, `COM3`, `COM4`, `COM5`, `COM6`, `COM7`, `COM8`, `COM9`,\n   `LPT1`, `LPT2`, `LPT3`, `LPT4`, `LPT5`, `LPT6`, `LPT7`, `LPT8`, and\n   `LPT9`)\n\n[control characters]: https://en.wikipedia.org/wiki/C0_and_C1_control_codes\n[reserved characters]: https://kb.acronis.com/content/39790\n[windows trailing]: https://msdn.microsoft.com/en-us/library/aa365247(v=vs.85).aspx#Naming_Conventions\n\nThe resulting string is truncated to [255 bytes in length][255]. The\nstring will not contain any directory paths and will be safe to use as a\nfilename.\n\n[255]: http://unix.stackexchange.com/questions/32795/what-is-the-maximum-allowed-filename-and-folder-size-with-ecryptfs\n\n### Empty String `\"\"` Result\n\nAn empty string `\"\"` can be returned. For example:\n\n```js\nvar sanitize = require(\"sanitize-filename\");\nsanitize(\"..\")\n// -> \"\"\n\n```\n\n### Non-unique Filenames\n\nTwo different inputs can return the same value. For example:\n\n```js\nvar sanitize = require(\"sanitize-filename\");\nsanitize(\"file?\")\n// -> \"file\"\nsanitize (\"*file*\")\n// -> \"file\"\n```\n\n### File Systems\n\nSanitized filenames will be safe for use on modern Windows, OS X, and\nUnix file systems (`NTFS`, `ext`, etc.).\n\n[`FAT` 8.3 filenames][8.3] are not supported.\n\n[8.3]: https://en.wikipedia.org/wiki/8.3_filename\n\n#### Test Your File System\n\nThe test program will use various strings (including the [Big List of\nNaughty Strings][blns]) to create files in the working directory. Run\n`npm test` to run tests against your file system.\n\n[blns]: https://github.com/minimaxir/big-list-of-naughty-strings\n\n## API\n\n### `sanitize(inputString, [options])`\n\nSanitize `inputString` by removing or replacing invalid characters.\n\nOptions:\n\n * `options.replacement`: *optional, string/function, default: `\"\"`*. If passed\n as a string, it's used as the replacement for invalid characters. If passed as\n a function, the function will be called with the invalid characters and it's\n return value will be used as the replacement. See [`String.prototype.replace`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace)\n for more info.\n","publish_time":1447056100878,"_cnpm_publish_time":1447056100878,"dist-tags":{"latest":"1.6.5"}}