1- # STATUS
1+ # lev
22
3- [ ![ development sponsored by voltra.co] ( https://img.shields.io/badge/Development%20sponsored%20by-Voltra.co-yellow.svg )] ( https://voltra.co/ )
4-
5- # SYNOPSIS
63A simple and convenient commandline tool and REPL for [ ` leveldb ` ] ( http://leveldb.org/ ) .
74
8- # FEATURES
9- - REPL with colorized tab-completion and zsh/fish style key suggestions
10- - REPL automatically saves and reloads REPL history
5+ ## Features
6+ * [ REPL] ( #repl-commands )
7+ * with colorized tab-completion and zsh/fish style key suggestions
8+ * automatically saves and reloads REPL history
9+ * [ CLI] ( #cli-commands )
1110
12- # SCREENSHOT
1311![ screenshot] ( /docs/screenshot.png )
1412
15- # INSTALLATION
13+ ## Summary
14+
15+ <!-- START doctoc generated TOC please keep comment here to allow auto update -->
16+ <!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
17+
18+
19+ - [ Installation] ( #installation )
20+ - [ REPL commands] ( #repl-commands )
21+ - [ GET < ; key> ; ] ( #get-ltkeygt )
22+ - [ PUT < ; key> ; < ; value> ; ] ( #put-ltkeygt-ltvaluegt )
23+ - [ DEL < ; key> ; ] ( #del-ltkeygt )
24+ - [ LS] ( #ls )
25+ - [ START < ; key-pattern> ; ] ( #start-ltkey-patterngt )
26+ - [ END < ; key-pattern> ; ] ( #end-ltkey-patterngt )
27+ - [ LIMIT < ; number> ; ] ( #limit-ltnumbergt )
28+ - [ REVERSE] ( #reverse )
29+ - [ CLI commands] ( #cli-commands )
30+ - [ --get < ; key> ; ] ( #--get-ltkeygt )
31+ - [ --put < ; key> ; ] ( #--put-ltkeygt )
32+ - [ --del < ; key> ; ] ( #--del-ltkeygt )
33+ - [ --batch < ; operations> ; ] ( #--batch-ltoperationsgt )
34+ - [ --keys] ( #--keys )
35+ - [ --values] ( #--values )
36+ - [ --all] ( #--all )
37+ - [ --start < ; key-pattern> ; ] ( #--start-ltkey-patterngt )
38+ - [ --end < ; key-pattern> ; ] ( #--end-ltkey-patterngt )
39+ - [ --match < ; key-pattern> ; ] ( #--match-ltkey-patterngt )
40+ - [ --limit < ; number> ; ] ( #--limit-ltnumbergt )
41+ - [ --reverse] ( #--reverse )
42+ - [ --line] ( #--line )
43+ - [ --length] ( #--length )
44+ - [ --valueEncoding < ; string> ; ] ( #--valueencoding-ltstringgt )
45+ - [ --location < ; string> ; ] ( #--location-ltstringgt )
46+
47+ <!-- END doctoc generated TOC please keep comment here to allow auto update -->
48+
49+ ## Installation
1650
1751```
1852$ npm install -g lev
1953```
2054
21- # BASIC USAGE
55+ ## REPL commands
2256
23- ```
57+ Start the REPL
58+ ``` sh
59+ # in the current directory
60+ $ lev
61+ # somewhere else
2462$ lev path/to/db
2563```
2664
27- # REPL COMMANDS
2865Use upper or lower case for the following commands.
2966
30- ## GET < ; key> ;
67+ ### GET < ; key> ;
3168Get a key from the database.
3269
33- ## PUT < ; key> ; < ; value> ;
70+ ### PUT < ; key> ; < ; value> ;
3471Put a value into the database. If you have ` keyEncoding ` or ` valueEncoding `
3572set to ` json ` , these values will be parsed from strings into ` json ` .
3673
37- ## DEL < ; key> ;
74+ ### DEL < ; key> ;
3875Delete a key from the database.
3976
40- ## LS
77+ ### LS
4178Get all the keys in the current range.
4279
43- ## START < ; key-pattern> ;
80+ ### START < ; key-pattern> ;
4481Defines the start of the current range. You can also use ` GT ` or ` GTE ` .
4582
46- ## END < ; key-pattern> ;
83+ ### END < ; key-pattern> ;
4784Defines the end of the current range. You can also use ` LT ` or ` LTE ` .
4885
49- ## LIMIT < ; number> ;
86+ ### LIMIT < ; number> ;
5087Limit the number of records in the current range (defaults to 5000).
5188
52- ## REVERSE
89+ ### REVERSE
5390Reverse the records in the current range.
5491
55- # CLI COMMANDS
56- These all match the parameters used with
57- [ ` levelup ` ] ( https://github.com/rvagg/node-levelup ) . The default encoding
58- for the database is set to ` json ` .
92+ ## CLI commands
93+ These all match the parameters used with [ ` levelup ` ] ( https://github.com/rvagg/node-levelup ) . The default encoding for the database is set to ` json ` .
5994
60- ## --get < ; key> ;
95+ ### --get < ; key> ;
6196Get a value
6297``` sh
6398lev --get foo
6499```
65100
66- ## --put < ; key> ;
101+ ### --put < ; key> ;
67102Put a value
68103``` sh
69104lev --put foo --value bar
70105```
71106
72- ## --del < ; key> ;
107+ ### --del < ; key> ;
73108Delete a value
74109``` sh
75110lev --del foo
76111```
77112
78- ## --batch < ; operations> ;
113+ ### --batch < ; operations> ;
79114Put or delete several values, using [ ` levelup ` batch syntax] ( https://github.com/Level/levelup#dbbatcharray-options-callback-array-form )
80115``` sh
81116lev --batch ' [
@@ -120,20 +155,20 @@ gzip -dk leveldb.export.gz
120155lev /tmp/my-new-db --batch leveldb.export
121156```
122157
123- ## --keys
158+ ### --keys
124159List all the keys in the current range. Will tabularize the output by default (see ` --line ` ).
125160``` sh
126161lev --keys
127162```
128163
129- ## --values
164+ ### --values
130165List all the values in the current range.
131166Emit as a new-line delimited stream of json.
132167``` sh
133168lev --values
134169```
135170
136- ## --all
171+ ### --all
137172List all the keys and values in the current range.
138173Emit as a new-line delimited stream of json.
139174``` sh
@@ -145,7 +180,7 @@ lev --all > leveldb.export
145180lev /tmp/my-new-db --batch leveldb.export
146181```
147182
148- ## --start < ; key-pattern> ;
183+ ### --start < ; key-pattern> ;
149184Specify the start of the current range. You can also use ` gt ` or ` gte ` .
150185``` sh
151186# output all keys after 'foo'
@@ -156,7 +191,7 @@ lev --keys --gte 'foo'
156191lev --values --start ' foo'
157192```
158193
159- ## --end < ; key-pattern> ;
194+ ### --end < ; key-pattern> ;
160195Specify the end of the current range. You can also use ` lt ` and ` lte ` .
161196``` sh
162197# output all keys before 'fooz'
@@ -169,7 +204,7 @@ lev --values --end 'fooz'
169204lev --keys --start ' foo' --end ' fooz'
170205```
171206
172- ## --match < ; key-pattern> ;
207+ ### --match < ; key-pattern> ;
173208Filter keys or values by a pattern applied on the key
174209``` sh
175210lev --keys --match ' f*'
@@ -181,28 +216,28 @@ lev --match 'f*'
181216
182217See [ ` minimatch ` doc] ( https://github.com/isaacs/minimatch#readme ) for patterns
183218
184- ## --limit < ; number> ;
219+ ### --limit < ; number> ;
185220Limit the number of records emitted in the current range.
186221``` sh
187222lev --keys --limit 10
188223lev --values --start ' foo' --end ' fooz' --limit 100
189224lev --match ' f*' --limit 10
190225```
191226
192- ## --reverse
227+ ### --reverse
193228Reverse the stream.
194229``` sh
195230lev --keys --reverse
196231lev --keys --start ' foo' --end ' fooz' --limit 100 --reverse
197232```
198233
199- ## --line
234+ ### --line
200235Output one key per line (instead of the default tabularized output)
201236``` sh
202237lev --keys --line
203238```
204239
205- ## --length
240+ ### --length
206241Output the length of the current range
207242``` sh
208243# Count all the key/value pairs in the database
@@ -211,13 +246,13 @@ lev --length
211246lev --start ' foo' --end ' fooz' --length
212247```
213248
214- ## --valueEncoding < ; string> ;
249+ ### --valueEncoding < ; string> ;
215250Specify the encoding for the values (Defaults to 'json').
216251``` sh
217252lev --values --valueEncoding buffer
218253```
219254
220- ## --location < ; string> ;
255+ ### --location < ; string> ;
221256Specify the path to the LevelDB to use. Defaults to the current directory.
222257``` sh
223258lev --location /tmp/test-db --keys
0 commit comments