{"name":"ready-resource","version":"1.0.2","author":{"url":"@mafintosh","name":"Mathias Buus"},"license":"MIT","_id":"ready-resource@1.0.2","homepage":"https://github.com/mafintosh/ready-resource","bugs":{"url":"https://github.com/mafintosh/ready-resource/issues"},"dist":{"shasum":"59535ae642c035f9e13433892612957926e10800","tarball":"http://registry-npm.ywwl.com/ready-resource/download/ready-resource-1.0.2.tgz","fileCount":4,"integrity":"sha512-RyMZAcDEpGh1SmWqHlDYWJMwpuSK7pCwN9/xzvAh4eFMq4ce72jmsK7ijrnbOSH7JTePoGdulPSFyi3wBtUj6g==","signatures":[{"sig":"MEQCIA7llXCPWxQGMKMeA/cYxGd4U2b7EuAg8in/IGFqkbGiAiBgqU1Td0Llq05tHiIGavsv+OaPeW6DppBb2h2cV0x1KA==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":3120,"size":1579,"noattachment":false,"key":"/ready-resource/-/ready-resource-1.0.2.tgz"},"main":"index.js","gitHead":"0e481708280395dcf580828d6a4eb9b1ad7f353f","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.2_1707335976811_0.3237068793428446","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":1707335976945,"maintainers":[{"name":"mafintosh","email":"mathiasbuus@gmail.com"}],"_cnpm_publish_time":1707335976945,"dist-tags":{"latest":"1.2.0"}}