{"name":"ready-resource","version":"1.0.1","author":{"url":"@mafintosh","name":"Mathias Buus"},"license":"MIT","_id":"ready-resource@1.0.1","homepage":"https://github.com/mafintosh/ready-resource","bugs":{"url":"https://github.com/mafintosh/ready-resource/issues"},"dist":{"shasum":"434a2f01aac799e9a3801f4b9a824defaef1d50c","tarball":"http://registry-npm.ywwl.com/ready-resource/download/ready-resource-1.0.1.tgz","fileCount":6,"integrity":"sha512-iDDdAsoQGHSHH8CnBhq4iIwixwkjZnrWMfwT9oV/Fl1PKCQ5MGg+3e5S/IXLVHLuYhz9T0TRg/PNA5mlxvzaHA==","signatures":[{"sig":"MEUCIQCUROScwp9PkTL4iPV/1sJNODrEKqtBnp/EcI09rt/s0QIgQD+xmNudZc9nDELrjdxgUa7xHQCDeoqk7BwosEMSnqU=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3993,"size":1948,"noattachment":false,"key":"/ready-resource/-/ready-resource-1.0.1.tgz"},"main":"index.js","gitHead":"0e3e14640e94fa963a77cf8781433e237490351b","imports":{"events":{"bare":"bare-events","default":"events"}},"scripts":{"test":"standard && brittle test.js"},"_npmUser":{"name":"mafintosh","email":"mathiasbuus@gmail.com"},"repository":{"url":"git+https://github.com/mafintosh/ready-resource.git","type":"git"},"_npmVersion":"10.2.3","description":"Modern single resource management","directories":{},"_nodeVersion":"20.10.0","_hasShrinkwrap":false,"devDependencies":{"brittle":"^3.1.0","standard":"^17.0.0"},"_npmOperationalInternal":{"tmp":"tmp/ready-resource_1.0.1_1707335928829_0.6299400346827999","host":"s3://npm-registry-packages"},"readme":"# ready-resource\n\nModern single resource management\n\n```\nnpm install ready-resource\n```\n\n## Usage\n\n``` js\nconst ReadyResource = require('ready-resource')\n\nclass Thing extends ReadyResource {\n  constructor () {\n    super()\n  }\n\n  async _open () {\n    // open the resource\n  }\n\n  async _close () {\n    // close the resource\n  }\n}\n\nconst r = new Thing()\n\nawait r.ready() // calls _open once\nawait r.ready() // noop\n\nawait r.close() // calls _close after _open has finished\nawait r.close() // noop\n```\n\n## License\n\nMIT\n","publish_time":1707335929013,"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_cnpm_publish_time":1707335929013,"dist-tags":{"latest":"1.2.0"}}