{"name":"random-path","version":"1.0.0","license":"MIT","repository":{"type":"git","url":"git+https://github.com/LinusU/node-random-path.git"},"type":"module","exports":"./index.js","scripts":{"test":"standard && node test && ts-readme-generator --check"},"dependencies":{"base32-encode":"^2.0.0","murmur-32":"^1.0.0"},"devDependencies":{"standard":"^16.0.3","ts-readme-generator":"^0.5.1"},"engines":{"node":"^12.20.0 || ^14.13.1 || >=16.0.0"},"gitHead":"9c8f58ef03a17545f1937444017031232b325887","description":"Generate a random path name.","bugs":{"url":"https://github.com/LinusU/node-random-path/issues"},"homepage":"https://github.com/LinusU/node-random-path#readme","_id":"random-path@1.0.0","_nodeVersion":"16.5.0","_npmVersion":"7.19.1","dist":{"integrity":"sha512-I6FGG7uFR3tZqHP7TzcP3Ikt5IyVEG59u7KTjIIjizcdPY6MDjD9CbbKqE+znIv4mrDF6HMlBshoemk0oRRwsQ==","shasum":"4e544014b2d434bee73d0266782711258a196726","tarball":"http://registry-npm.ywwl.com/random-path/download/random-path-1.0.0.tgz","fileCount":6,"unpackedSize":5440,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJg/ApaCRA9TVsSAnZWagAAgzAP/iA9ZOLUBlSwSsx8le1d\nkBqhhqKm6TrC1BkpLWV8POOUKmekBkRs1dlM5Sdqgz4F6Riu8UTVwXAnvRzK\nsJEWpCgpgWryWbaCDOT8PC3gd9Q4YpSmYzK13wDpBe8kdmbsH73QK68MdRbH\nTsHroOdP41azkpoydGVU5Vq1+GDwDo1vI+VCi5dXd1tiRpWdowTtzk4XoR/r\n1cLTaIMgjc9SD9JdXCNHI1ZR7a4IHTCS+28ZW/VXKaJARwddgj7ZjZbxoQZD\nukamEkN0gavcmRzdysoa6oYzdrWZQXLFq4kc8InlB/NMYubL0ytlRN1Cv/TU\njLqTL2c+73w/3loiODk9g2hkHQKnGpw2CkgxfsRhOft+D4fLl8fv0CNi6KL7\nzhrfZAZl3m8fKbMjUwkSdzWMOZyxkrcBxi1C/bP//4+yKmhBWl7Quj1PeWNN\nOe2sczSQQVYAH3yW3RtqsXHQ2pOrFQuf7GMFNNSjnunMpnQtdl2EttcyNNM8\ndAzhTIiV+QArfagDYpSIbe5bSC3+piQvj04h9VvqLLassLxbR3FBdX0Jo613\nRPzoC7Dfwo5d/whgs77OMVhobwXMlU3Zj5f1oYOKZsZM5cCZbrdfF1O1eayE\n0Pbspvia6/cnhgyMEzjMfULGD3N8Zb5yJgekM2+z5SUug4tGpggu+yVuXmsc\nTxli\r\n=zcGe\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCMFw+LxwqxQ5MxZIetj42ZgQyY0KU60oLVBGkE1V87EAIgQBFgfuhRAXrcOsCuTW4xD2HkscHsn8RDS1UCfr7bkgo="}],"size":2065,"noattachment":false,"key":"/random-path/-/random-path-1.0.0.tgz"},"_npmUser":{"name":"linusu","email":"linus@folkdatorn.se"},"directories":{},"maintainers":[{"name":"linusu","email":"linus@folkdatorn.se"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/random-path_1.0.0_1627130458760_0.5701327413374477"},"_hasShrinkwrap":false,"readme":"# Random Path\n\nGenerate a random path name.\n\n## Installation\n\n```sh\nnpm install --save random-path\n```\n\n## Usage\n\n```js\nimport os from 'node:os'\nimport randomPath from 'random-path'\n\nconst path = randomPath(os.tmpDir(), '%s.txt')\n\nconsole.log(path)\n//=> /tmp/Y374CW8.txt\n```\n\n## API\n\n### `randomPath(directory, template)`\n\n- `directory` (`string`, required)\n- `template` (`string`, required)\n- returns `string` - the generated path\n\nGenerates a random path name with the specified `directory` and `template`.\n\n`template` should be a string where `%s` will be replaced with some random characters (e.g. `'linusu-%s'`). The string should contain `%s` exactly once. If you want to include a literal percent sign, escape it with another one, e.g. `'%%string'` becomes `'%string'`.\n\n**Important:** This module makes no guarantees on wether there exists a file at the returned path or not. Do not simply write data to the returned path. If you want a random file, use the higher level module [fs-temp](https://github.com/LinusU/fs-temp).\n\n### `validateTemplate(template)`\n\n- `template` (`string`, required)\n\nCheck to see if the template is a valid template accepted by `randomPath`. Throws an error if the template is invalid.\n\n## See also\n\n- [fs-temp](https://github.com/LinusU/fs-temp) - A quick and simple way to create temporary files and directories.\n","publish_time":1627130458909,"_cnpm_publish_time":1627130458909,"dist-tags":{"latest":"1.0.0"}}