{"name":"temp-write","version":"6.0.0","description":"Write data to a random temporary file","license":"MIT","repository":{"type":"git","url":"git+https://github.com/sindresorhus/temp-write.git"},"funding":"https://github.com/sponsors/sindresorhus","author":{"name":"Sindre Sorhus","email":"sindresorhus@gmail.com","url":"https://sindresorhus.com"},"type":"module","exports":{"types":"./index.d.ts","default":"./index.js"},"sideEffects":false,"engines":{"node":">=18"},"scripts":{"test":"xo && ava && tsc index.d.ts"},"keywords":["temp","temporary","tempfile","file","filename","path","random","write","fs","string","buffer","uint8array","stream","data"],"dependencies":{"graceful-fs":"^4.2.11","is-stream":"^4.0.1","temp-dir":"^3.0.0"},"devDependencies":{"ava":"^6.1.3","typescript":"^5.5.4","uint8array-extras":"^1.4.0","xo":"^0.59.2"},"_id":"temp-write@6.0.0","gitHead":"465ccb01838960ec8834e17a4282ee0d282dc3ba","types":"./index.d.ts","bugs":{"url":"https://github.com/sindresorhus/temp-write/issues"},"homepage":"https://github.com/sindresorhus/temp-write#readme","_nodeVersion":"18.20.2","_npmVersion":"10.6.0","dist":{"integrity":"sha512-vr6XxpRGvmOXBxybIqTBmKy54TqjcXB/ocwv4iagx/2v/F73RiKHtTC/MU59hi6QaIE9hINn4Nez90gtNePhKw==","shasum":"00efe9beec49e1943061d15cc09f2d2cf6a767eb","tarball":"http://registry-npm.ywwl.com/temp-write/download/temp-write-6.0.0.tgz","fileCount":5,"unpackedSize":6608,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDcVZkFcjJogYcJzc4qu+fdY8tiwXjzLxR6Ok1l7OASPQIhAP80E08SX4n0nEMITKMxe7wcHVb5jbxoUqdIlAm5dAXz"}],"size":2425,"noattachment":false,"key":"/temp-write/-/temp-write-6.0.0.tgz"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/temp-write_6.0.0_1722003723324_0.7645292037441822"},"_hasShrinkwrap":false,"readme":"# temp-write\n\n> Write data to a random temporary file\n\n## Install\n\n```sh\nnpm install temp-write\n```\n\n## Usage\n\n```js\nimport fs from 'node:fs';\nimport tempWrite from 'temp-write';\n\nconst filePath = tempWrite.sync('unicorn');\n//=> '/var/folders/_1/tk89k8215ts0rg0kmb096nj80000gn/T/4049f192-43e7-43b2-98d9-094e6760861b'\n\nfs.readFileSync(filePath, 'utf8');\n//=> 'unicorn'\n\ntempWrite.sync('unicorn', 'pony.png');\n//=> '/var/folders/_1/tk89k8215ts0rg0kmb096nj80000gn/T/4049f192-43e7-43b2-98d9-094e6760861b/pony.png'\n\ntempWrite.sync('unicorn', 'rainbow/cake/pony.png');\n//=> '/var/folders/_1/tk89k8215ts0rg0kmb096nj80000gn/T/4049f192-43e7-43b2-98d9-094e6760861b/rainbow/cake/pony.png'\n```\n\n## API\n\n### tempWrite(fileContent, filePath?)\n\nReturns a `Promise` for the file path of the temporary file.\n\n### tempWrite.sync(fileContent, filePath?)\n\nReturns the file path of the temporary file.\n\n#### fileContent\n\nType: `string | Uint8Array | stream.Readable`\n\nThe data to write to the temporary file. Streams are supported only with the async API.\n\n#### filePath\n\nType: `string`\\\nExamples: `'img.png'` `'foo/bar/baz.png'`\n\nOptionally specify a file path which is appended to the random path.\n\n## Related\n\n- [tempy](https://github.com/sindresorhus/tempy) - Get a random temporary file or directory path\n","publish_time":1722003723498,"maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"_cnpm_publish_time":1722003723498,"dist-tags":{"latest":"6.0.1"}}