Skip to content

Commit 284e0db

Browse files
committed
Allow manifest.encodings to be an object
1 parent e09d832 commit 284e0db

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -353,9 +353,19 @@ Does db have the methods `createReadStream`, `createKeyStream` and `createValueS
353353

354354
</details>
355355

356-
### `encodings` (boolean)
356+
### `encodings` (boolean or object)
357357

358-
Do all relevant db methods take `keyEncoding` and `valueEncoding` options? If true, the db must use a default encoding of utf8 and all its operations must return strings rather than buffers by default.
358+
Do all relevant db methods take `keyEncoding` and `valueEncoding` options? If truthy, the db must use a default encoding of utf8 and all its operations must return strings rather than buffers by default.
359+
360+
Support of individual encodings may also be indicated by adding their names as nested properties. For example:
361+
362+
```js
363+
{
364+
encodings: {
365+
utf8: true
366+
}
367+
}
368+
```
359369

360370
<details>
361371
<summary>Support matrix</summary>

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ module.exports = function supports (...manifests) {
3131
openCallback: manifest.openCallback || false,
3232
promises: manifest.promises || false,
3333
streams: manifest.streams || false,
34-
encodings: manifest.encodings || false,
34+
encodings: maybeObject(manifest.encodings),
3535
events: maybeObject(manifest.events),
3636

3737
// Methods that are not part of abstract-leveldown or levelup

0 commit comments

Comments
 (0)