From 687a6a1453109507c51d31dc50cfc43e225a1913 Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Sun, 28 Apr 2019 20:06:29 +0200 Subject: [PATCH] Document behavior of pending operations on close --- README.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/README.md b/README.md index 53220853..5cafc75e 100644 --- a/README.md +++ b/README.md @@ -131,6 +131,18 @@ The following options are for advanced performance tuning. Modify them only if y close() is an instance method on an existing database object. The underlying LevelDB database will be closed and the `callback` function will be called with no arguments if the operation is successful or with a single `error` argument if the operation failed for any reason. +`leveldown` waits for any pending operations to finish before closing. For example: + +```js +db.put('key', 'value', function (err) { + // This happens first +}) + +db.close(function (err) { + // This happens second +}) +``` + ### `db.put(key, value[, options], callback)`