{"_id":"sanitize-filename@1.6.5","bugs":{"url":"https://github.com/parshap/node-sanitize-filename/issues"},"dist":{"shasum":"169cd02f71b5f894ac9c120ba845904f35af8dd1","tarball":"http://registry-npm.ywwl.com/sanitize-filename/download/sanitize-filename-1.6.5.tgz","fileCount":11,"integrity":"sha512-+dVApt46/oAFWRP0KBSnYNLRw1peY7o/b12tmpllPNFpjfwkPuZut1+DiKaD9zYx5r2SHwc+XMLSBaDiyUJw3g==","signatures":[{"sig":"MEUCIEl2R0kbEStLFBfc/oCCaig/M1qTaGSz4nUH6gGjajVNAiEAuD65fkq4MHTb62ovQBTPrqvt5EE8tDCggMLWNErE9OI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCuAlyEi+VYBop1bf0yACAH76NRd0kx86Yf4qJePVtz5gIhAJf5BxlJ29z1KqHc2hxBceqVvJrVmdXR2F+cZOewUdT0"}],"unpackedSize":19178,"size":7165,"noattachment":false,"key":"/sanitize-filename/-/sanitize-filename-1.6.5.tgz"},"main":"index.js","name":"sanitize-filename","types":"index.d.ts","author":{"name":"Parsha Pourkhomami"},"gitHead":"50256c1d4519718c0b8e405bd4db47ab2617dfc1","license":"WTFPL OR ISC","scripts":{"test":"tape test.js","test-browser":"airtap --local --open -- test.js","test-browser-sauce":"airtap -- test.js"},"version":"1.6.5","_npmUser":{"name":"parshap","email":"parshap+npm@gmail.com"},"homepage":"https://github.com/parshap/node-sanitize-filename#readme","keywords":["file","name","filename","sanitize","validate","escape"],"repository":{"url":"git+ssh://git@github.com/parshap/node-sanitize-filename.git","type":"git"},"_npmVersion":"11.12.1","description":"Sanitize a string for use as a filename","directories":{},"maintainers":[{"name":"parshap","email":"parshap+npm@gmail.com"}],"_nodeVersion":"25.9.0","contributors":[{"name":"Parsha Pourkhomami","email":"parshap@gmail.com"},{"name":"Joel Mukuthu","email":"joelmukuthu@gmail.com"}],"dependencies":{"truncate-utf8-bytes":"^1.0.0"},"_hasShrinkwrap":false,"devDependencies":{"tape":"^4.2.2","airtap":"^2.0.3","mktemp":"^0.4.0","browserify":"^14.0.0","concat-stream":"^1.5.1"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sanitize-filename_1.6.5_1794092587258_0.4493447929162152"},"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":1794092587340,"_cnpm_publish_time":1794092587340,"dist-tags":{"latest":"1.6.5"}}