npm.io
1.0.0 • Published 10 months ago

resource-on-exit

Licence
Apache-2.0
Version
1.0.0
Deps
0
Size
13 kB
Vulns
0
Weekly
0

resource-on-exit

Register sync teardown handlers for a resource

npm install resource-on-exit

Usage

const { add, remove } = require('resource-on-exit')

const file = { fd }

add(file, () => fs.closeSync(file.fd))
remove(file) // to remove

License

Apache-2.0