{"_id":"@cjser/filenamify__v6_0_0","name":"@cjser/filenamify__v6_0_0","dist-tags":{"latest":"6.0.0-cjser.2"},"versions":{"6.0.0-cjser.2":{"name":"@cjser/filenamify__v6_0_0","version":"6.0.0-cjser.2","description":"Convert a string to a valid safe filename","license":"MIT","repository":{"type":"git","url":"https://code.moenext.com/3rdeye/cjser.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{".":{"require":"./dist-cjser/index.cjs","default":"./index.js"},"./browser":{"require":"./dist-cjser/browser.cjs","default":"./filenamify.js"}},"engines":{"node":">=16"},"scripts":{"test":"xo && ava && tsd"},"keywords":["filename","safe","sanitize","file","name","string","path","filepath","convert","valid","dirname"],"dependencies":{"@cjser/filename-reserved-regex__v3_0_0":"3.0.0-cjser.2"},"devDependencies":{"ava":"^5.2.0","tsd":"^0.28.1","xo":"^0.54.1"},"main":"./dist-cjser/index.cjs","cjser":{"sourceVersion":"6.0.0","cjserVersion":2,"original":{"name":"filenamify","version":"6.0.0","exports":{".":"./index.js","./browser":"./filenamify.js"},"repository":"sindresorhus/filenamify","dependencies":{"filename-reserved-regex":"^3.0.0"},"files":["filenamify-path.d.ts","filenamify-path.js","filenamify.d.ts","filenamify.js","index.d.ts","index.js"],"scripts":{"test":"xo && ava && tsd"}}},"_id":"@cjser/filenamify__v6_0_0@6.0.0-cjser.2","gitHead":"a4bef54d7d22d3d9a6b84528457938d84cd65fe7","_nodeVersion":"20.14.0","_npmVersion":"10.7.0","dist":{"integrity":"sha512-kFOGBpPMaV+mTDRe71QsbEUT63q+6L0LItmv8mahobqvw8gb8SbYw1ZIpx++172eEnKnijQXqqYQE1cYj/qvEQ==","shasum":"b1298363338296985b5cce6c0ab2b6ea4c4c5564","tarball":"https://registry.npmjs.org/@cjser/filenamify__v6_0_0/-/filenamify__v6_0_0-6.0.0-cjser.2.tgz","fileCount":11,"unpackedSize":17525,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICuke0yDdhrmIyI431rJnone05CFBSVoucHCeosZa9RTAiEAt20xpBxTk470/oSPUhouyrtXU1GDjvary0lNio3GbBI="}]},"_npmUser":{"name":"nanahira","email":"nanahira@momobako.com"},"directories":{},"maintainers":[{"name":"nanahira","email":"nanahira@momobako.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/filenamify__v6_0_0_6.0.0-cjser.2_1778158106088_0.530813911123569"},"_hasShrinkwrap":false}},"time":{"created":"2026-05-07T12:48:26.028Z","6.0.0-cjser.2":"2026-05-07T12:48:26.270Z","modified":"2026-05-07T12:48:26.449Z"},"maintainers":[{"name":"nanahira","email":"nanahira@momobako.com"}],"description":"Convert a string to a valid safe filename","keywords":["filename","safe","sanitize","file","name","string","path","filepath","convert","valid","dirname"],"repository":{"type":"git","url":"https://code.moenext.com/3rdeye/cjser.git"},"author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"license":"MIT","readme":"# filenamify\n\n> Convert a string to a valid safe filename\n\nOn Unix-like systems, `/` is reserved. On Windows, [`<>:\"/\\|?*`](http://msdn.microsoft.com/en-us/library/aa365247%28VS.85%29#naming_conventions) along with trailing periods are reserved.\n\n## Install\n\n```sh\nnpm install filenamify\n```\n\n## Usage\n\n```js\nimport filenamify from 'filenamify';\n\nfilenamify('<foo/bar>');\n//=> '!foo!bar!'\n\nfilenamify('foo:\"bar\"', {replacement: '🐴'});\n//=> 'foo🐴bar🐴'\n```\n\n## API\n\n### filenamify(string, options?)\n\nConvert a string to a valid filename.\n\n### filenamifyPath(path, options?)\n\nConvert the filename in a path a valid filename and return the augmented path.\n\n```js\nimport {filenamifyPath} from 'filenamify';\n\nfilenamifyPath('foo:bar');\n//=> 'foo!bar'\n```\n\n#### options\n\nType: `object`\n\n##### replacement\n\nType: `string`\\\nDefault: `'!'`\n\nString to use as replacement for reserved filename characters.\n\nCannot contain: `<` `>` `:` `\"` `/` `\\` `|` `?` `*`\n\n##### maxLength\n\nType: `number`\\\nDefault: `100`\n\nTruncate the filename to the given length.\n\nOnly the base of the filename is truncated, preserving the extension. If the extension itself is longer than `maxLength`, you will get a string that is longer than `maxLength`, so you need to check for that if you allow arbitrary extensions.\n\nSystems generally allow up to 255 characters, but we default to 100 for usability reasons.\n\n## Browser-only import\n\nYou can also import `filenamify/browser`, which only imports `filenamify` and not `filenamifyPath`, which relies on `path` being available or polyfilled. Importing `filenamify` this way is therefore useful when it is shipped using `webpack` or similar tools, and if `filenamifyPath` is not needed.\n\n```js\nimport filenamify from 'filenamify/browser';\n\nfilenamify('<foo/bar>');\n//=> '!foo!bar!'\n```\n\n## Related\n\n- [filenamify-cli](https://github.com/sindresorhus/filenamify-cli) - CLI for this module\n- [filenamify-url](https://github.com/sindresorhus/filenamify-url) - Convert a URL to a valid filename\n- [valid-filename](https://github.com/sindresorhus/valid-filename) - Check if a string is a valid filename\n- [unused-filename](https://github.com/sindresorhus/unused-filename) - Get a unused filename by appending a number if it exists\n- [slugify](https://github.com/sindresorhus/slugify) - Slugify a string\n\n## cjser\n\nThis package is a CommonJS-compatible build generated by cjser for projects that still need `require()` support. The source version matches the original npm package version, with a cjser prerelease suffix for this generated build.\nOriginal repository: https://github.com/sindresorhus/filenamify\n","readmeFilename":"readme.md","_rev":"1-752d4a18c53902e82ec9b1a5d7cc57be"}