random-access-file-promises
Version:
TypeScript wrapper of random-access-file library with added Promise support
15 lines • 488 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.withRandomAccessFile = void 0;
const random_access_file_1 = require("./random-access-file");
async function withRandomAccessFile(path, fn, opts = {}) {
const raf = new random_access_file_1.RandomAccessFile(path, opts);
try {
return await fn(raf);
}
finally {
await raf.close();
}
}
exports.withRandomAccessFile = withRandomAccessFile;
//# sourceMappingURL=util.js.map