{"_id":"clean-write","_rev":"2-9c4104ae1c10330ee75bdef120490a18","name":"clean-write","dist-tags":{"latest":"0.0.1"},"versions":{"0.0.1":{"name":"clean-write","version":"0.0.1","main":"build/src/main.js","scripts":{"test":"gulp test"},"husky":{"hooks":{"pre-push":"gulp check --full"}},"description":"Cleanup corrupted files on write errors","keywords":["write","clean","cleanup","safe","fs","filesystem","error-handling","error","exceptions","exception-handling","exit","corruption","nodejs","javascript","es6","library","server","files","concurrency","guards"],"license":"Apache-2.0","homepage":"https://git.io/fj7vJ","repository":{"type":"git","url":"git+https://github.com/ehmicky/clean-write.git"},"bugs":{"url":"https://github.com/ehmicky/clean-write/issues"},"author":{"name":"ehmicky","email":"ehmicky@gmail.com","url":"https://github.com/ehmicky"},"directories":{"lib":"src","test":"test"},"dependencies":{"core-js":"^3.1.4","path-exists":"^4.0.0","signal-exit":"^3.0.2"},"devDependencies":{"ava":"^2.2.0","gulp":"^4.0.2","gulp-shared-tasks":"^0.30.33","husky":"^3.0.2"},"engines":{"node":">=8.12.0"},"gitHead":"a986ff569da2ddb818cc3a7253d5902b072a15d5","_id":"clean-write@0.0.1","_nodeVersion":"12.8.0","_npmVersion":"6.10.3","dist":{"integrity":"sha512-K3mI0/N3KmhCZyTjnudAWmG9s4Kj7eps1ziLrwFPb7futyVzGu4axG1xlwjItfwMS68meZ4qq0U1t+T/6ECe1w==","shasum":"8914bac1d403059b7e300214f4546ee76d019530","tarball":"https://registry.npmjs.org/clean-write/-/clean-write-0.0.1.tgz","fileCount":6,"unpackedSize":18299,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdTDW2CRA9TVsSAnZWagAAiZoP/3isCApNzkk2rXwBarQw\nOQlTTDxElugiIZGh05oF3fCa/a1d9Qd9ivJENYaa0PAh6iznTrTRLICGus+s\nBDoj8Lzw8ocKj8S8i8HEwAk/EGLHa6iDnU+o6JovpMx1UxkbXrlfNBPKAxZx\nRwXIyLO6ydwxYOBc8YwSrs3LXPLfdN7Ir+3PgxqYIM5J0ajc6/3FONS1CFgY\nFb5nCW+jqGR+IPHGq42y5n+LFen3ftViOxpAPw8ifekyKAb3FmatFyeeWAvL\n0Lsbm/8oxwjeoCOum0pKcKL/PM8aYlN9rpVotGjsaSt1cVqW/6vnw73b+Fvv\n+Y6k/35yxM/NVCzo8JHdAlUXo9lYECGE5VbDYnoDn21i+Bb+YMY3ETbTo/bq\n2JQ6JNV7UTiMevTAXPX5tlKNHVzDc7NlSD/wUkPrgKE64+A1d/ioRjb5Ss5e\n3Y5VWeHlxhe3T3RaL9VTUcgy1RTS8dWtn1hdUjmeffhgVqzQh/ERHLGcUJdC\nGjgTnv8RRV3mdFPmmy+UxgS+MHERx1Xh35hzs2biBbP4fgk9vZiCskgT3+RO\nIoYT5SD7P3/RaaxBvNscE2szwj1tvVTvX4qp6hGWYCE02l2ejUneMT0VVdlq\nxZc8zbZL7dExby/TQ/r1RH6QOb8r46Nbxu9ZtIRLOteNGSS8zXtWrGZ2bbjP\nehWN\r\n=V36+\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIAWzR3oyDVMWuwz3UMVQYxgKLOf0VOPV9ZyqDTx7YKPSAiEAvxv2il7spnd0Q/uA1AMmHfH4te1oeOJwXBtd0QV71SQ="}]},"maintainers":[{"name":"ehmicky","email":"ehmicky@gmail.com"}],"_npmUser":{"name":"ehmicky","email":"ehmicky@gmail.com"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/clean-write_0.0.1_1565275573247_0.35430774642333684"},"_hasShrinkwrap":false,"deprecated":"Please use write-file-atomic instead"}},"time":{"created":"2019-08-08T14:46:13.246Z","0.0.1":"2019-08-08T14:46:13.602Z","modified":"2022-04-12T06:37:57.189Z"},"maintainers":[{"name":"ehmicky","email":"ehmicky@gmail.com"}],"description":"Cleanup corrupted files on write errors","homepage":"https://git.io/fj7vJ","keywords":["write","clean","cleanup","safe","fs","filesystem","error-handling","error","exceptions","exception-handling","exit","corruption","nodejs","javascript","es6","library","server","files","concurrency","guards"],"repository":{"type":"git","url":"git+https://github.com/ehmicky/clean-write.git"},"author":{"name":"ehmicky","email":"ehmicky@gmail.com","url":"https://github.com/ehmicky"},"bugs":{"url":"https://github.com/ehmicky/clean-write/issues"},"license":"Apache-2.0","readme":"[![Codecov](https://img.shields.io/codecov/c/github/ehmicky/clean-write.svg?label=tested&logo=codecov)](https://codecov.io/gh/ehmicky/clean-write)\n[![Travis](https://img.shields.io/badge/cross-platform-4cc61e.svg?logo=travis)](https://travis-ci.org/ehmicky/clean-write)\n[![Node](https://img.shields.io/node/v/clean-write.svg?logo=node.js)](https://www.npmjs.com/package/clean-write)\n[![Gitter](https://img.shields.io/gitter/room/ehmicky/clean-write.svg?logo=gitter)](https://gitter.im/ehmicky/clean-write)\n[![Twitter](https://img.shields.io/badge/%E2%80%8B-twitter-4cc61e.svg?logo=twitter)](https://twitter.com/intent/follow?screen_name=ehmicky)\n[![Medium](https://img.shields.io/badge/%E2%80%8B-medium-4cc61e.svg?logo=medium)](https://medium.com/@ehmicky)\n\nCleanup corrupted files on write errors.\n\nWhen an exception is thrown while a file is being written, that file will be\ncorrupted. The same problem occurs when the process exits unexpectedly (for\nexample with `CTRL-C`).\n\nThis library removes corrupted files in such cases.\n\n# Example\n\n<!-- Remove 'eslint-skip' once estree supports top-level await -->\n<!-- eslint-skip -->\n\n```js\nconst cleanWrite = require('clean-write')\n\nconst { writeFile } = require('fs')\nconst { promisify } = require('util')\nconst writeFileAsync = promisify(writeFile)\n\nconst filePath = './path/to/file.js'\nconst writeFunction = async function() {\n  await writeFileAsync(filePath, 'example')\n}\n\n// If an exception happens or if the program exits, the file will be removed\nawait cleanWrite(writeFunction, filePath)\n```\n\n# Install\n\n```bash\nnpm install clean-write\n```\n\n# Usage\n\n## cleanWrite(writeFunction, filePath)\n\n`writeFunction`: `() => Promise<void>`<br>`filePath`: `string`<br>_Returns_:\n`Promise<void>`\n\nThe file is removed if either:\n\n- `writeFunction()` throws an exception or returns a rejected `Promise`\n- the process exits before `writeFunction()` completes\n\n# Support\n\nIf you found a bug or would like a new feature, _don't hesitate_ to\n[submit an issue on GitHub](../../issues).\n\nFor other questions, feel free to\n[chat with us on Gitter](https://gitter.im/ehmicky/clean-write).\n\nEveryone is welcome regardless of personal background. We enforce a\n[Code of conduct](CODE_OF_CONDUCT.md) in order to promote a positive and\ninclusive environment.\n\n# Contributing\n\nThis project was made with ❤️. The simplest way to give back is by starring and\nsharing it online.\n\nIf the documentation is unclear or has a typo, please click on the page's `Edit`\nbutton (pencil icon) and suggest a correction.\n\nIf you would like to help us fix a bug or add a new feature, please check our\n[guidelines](CONTRIBUTING.md). Pull requests are welcome!\n\n<!-- Thanks go to our wonderful contributors: -->\n\n<!-- ALL-CONTRIBUTORS-LIST:START -->\n<!-- prettier-ignore -->\n<table><tr><td align=\"center\"><a href=\"https://twitter.com/ehmicky\"><img src=\"https://avatars2.githubusercontent.com/u/8136211?v=4\" width=\"100px;\" alt=\"ehmicky\"/><br /><sub><b>ehmicky</b></sub></a><br /><a href=\"https://github.com/ehmicky/clean-write/commits?author=ehmicky\" title=\"Code\">💻</a> <a href=\"#design-ehmicky\" title=\"Design\">🎨</a> <a href=\"#ideas-ehmicky\" title=\"Ideas, Planning, & Feedback\">🤔</a> <a href=\"https://github.com/ehmicky/clean-write/commits?author=ehmicky\" title=\"Documentation\">📖</a></td></tr></table>\n\n<!-- ALL-CONTRIBUTORS-LIST:END -->\n","readmeFilename":"README.md"}