{"name":"is-safe-filename","version":"0.1.0","keywords":["filename","safe","secure","path","traversal","security","validate","check","local"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"is-safe-filename@0.1.0","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/is-safe-filename#readme","bugs":{"url":"https://github.com/sindresorhus/is-safe-filename/issues"},"dist":{"shasum":"740c5f147adbffb6807cd61a798004230b5dfbb6","tarball":"http://registry-npm.ywwl.com/is-safe-filename/download/is-safe-filename-0.1.0.tgz","fileCount":5,"integrity":"sha512-sHJhnOtbNZw/t54s31NnbkkcwfHzTOpgi5n1bnlLu+40p/gU3ZHu+JX8CjIsnWUQkqWtvmNpJqCYUyaaKSPLZw==","signatures":[{"sig":"MEUCIQCs5jaKa0jIRBM1fApb3eQPuq0DuHx34f/ybh1J7zNwRwIgBEHhMOCDC/etiUUqB44GlEiuP2gWe3mjPjqWuGXalN4=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":4177,"size":1810,"noattachment":false,"key":"/is-safe-filename/-/is-safe-filename-0.1.0.tgz"},"type":"module","types":"./index.d.ts","engines":{"node":">=20"},"exports":{"types":"./index.d.ts","default":"./index.js"},"funding":"https://github.com/sponsors/sindresorhus","gitHead":"6b895ae1473425300ae3b6d0d32bcba9fe1d63f1","scripts":{"test":"xo && ava && tsc index.d.ts"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/is-safe-filename.git","type":"git"},"_npmVersion":"11.7.0","description":"Check if a filename is safe to use in a path join operation","directories":{},"sideEffects":false,"_nodeVersion":"25.3.0","_hasShrinkwrap":false,"devDependencies":{"xo":"^0.60.0","ava":"^6.2.0","typescript":"^5.7.3"},"_npmOperationalInternal":{"tmp":"tmp/is-safe-filename_0.1.0_1769258734407_0.33149123976551764","host":"s3://npm-registry-packages-npm-production"},"readme":"# is-safe-filename\n\n> Check if a filename is safe to use in a path join operation\n\nA safe filename is one that won't escape the intended directory via path traversal.\n\nThis is a purely lexical check. It does not account for symlinks that may exist on the filesystem.\n\n## Install\n\n```sh\nnpm install is-safe-filename\n```\n\n## Usage\n\n```js\nimport isSafeFilename from 'is-safe-filename';\n\nisSafeFilename('foo');\n//=> true\n\nisSafeFilename('../foo');\n//=> false\n\nisSafeFilename('foo/bar');\n//=> false\n```\n\n## API\n\n### isSafeFilename(filename)\n\nReturns `true` if the filename is safe.\n\n### assertSafeFilename(filename)\n\nThrows an error if the filename is not safe.\n\n```js\nimport {assertSafeFilename} from 'is-safe-filename';\n\nassertSafeFilename('foo');\n// No error\n\nassertSafeFilename('../foo');\n//=> Error: Unsafe filename: \"../foo\"\n```\n\n### unsafeFilenameFixtures\n\nA list of common unsafe filename fixtures for testing path traversal vulnerabilities.\n\nUseful for testing that your code properly rejects unsafe filenames.\n\n```js\nimport {unsafeFilenameFixtures} from 'is-safe-filename';\n\nfor (const filename of unsafeFilenameFixtures) {\n\tassert.throws(() => myFunction(filename));\n}\n```\n","publish_time":1769258734571,"_cnpm_publish_time":1769258734571,"dist-tags":{"latest":"0.1.1"}}