UNPKG

18 kBMarkdownView Raw
1## 2.0.0 @ October 2017
2
3### Summary
4
5There has been quite some work done for this new major version:
6
71. Make `levelup` more generic by reducing focus on [`leveldown`](https://github.com/Level/leveldown) and [`LevelDB`](https://github.com/google/leveldb).
82. Make `levelup` more generic by removing code related to encodings, which would allow \*down implementations to manage encodings themselves.
93. Use [`standard`](https://github.com/standard/standard) as linter to avoid bikeshedding.
104. Add a native `Promise` API for promise using geeks. Many have been asking for this. Also `async/await` is awesome. Breaking change: previously, if you did not pass a callback to an async function and there was an error, `levelup` would emit an `error` event instead. This is no longer true.
11
12Point `1` and `2` also helps out with reducing complexity.
13
14### Upgrade Guide
15
16Since `levelup` no longer tries to load `leveldown` as a default backend you have to provide a backend instance yourself.
17
18So if you previously did:
19
20```
21$ npm i levelup leveldown --save
22```
23
24And in your code you did something like:
25
26```js
27const levelup = require('levelup')
28const db = levelup('/path/to/db')
29```
30
31You should now do (for identical functionality):
32
33```js
34const levelup = require('levelup')
35const encode = require('encoding-down')
36const leveldown = require('leveldown')
37const db = levelup(encode(leveldown('/path/to/db')))
38```
39
40Note that we have moved out encodings into [`encoding-down`](https://github.com/level/encoding-down), which in itself is a \*down that wraps a \*down (meta ftw). It basically just sits in between `levelup` and the _actual_ backend to operate on encodings for keys and values. Default encoding is `'utf8'` like before.
41
42This obviously means everyone has to do a lot of code rewrite which is bad. So we aim to fix this by putting that code into [`level@2.0.0`](https://github.com/level/level), which already is used as a convenience package.
43
44Switching from `levelup` and `leveldown` combo to only using `level` you would do:
45
46```js
47const level = require('level')
48const db = level('/path/to/db')
49```
50
51Also, we aim to simplify using `memdown` in the same way by updating `level-mem`.
52
53For more advanced usage with custom versions of `abstract-leveldown`, the first parameter to `levelup()` should be an `abstract-leveldown` instead of passing a factory function via `options.db`.
54
55So if you previously did:
56
57```js
58const db = levelup('/path/to/db', {
59 db: function (location) {
60 return new CustomLevelDOWN(location)
61 }
62})
63```
64
65You should now do (for identical functionality):
66
67```js
68const encode = require('encoding-down')
69const db = levelup(encode(new CustomLevelDOWN('/path/to/db')))
70```
71
72## 1.0.0 @ May 14 2015
73
74 * [[`6ae45d83b6`](https://github.com/level/levelup/commit/6ae45d83b6)] - dispatchError() and readError() are voids (Lars-Magnus Skog)
75 * [[`c8e22e70bd`](https://github.com/level/levelup/commit/c8e22e70bd)] - util.deprecate static functions (Julian Gruber)
76 * [[`ef0ba86c99`](https://github.com/level/levelup/commit/ef0ba86c99)] - target multiple iojs versions, remove notifications (Lars-Magnus Skog)
77 * [[`e19ec96ed7`](https://github.com/level/levelup/commit/e19ec96ed7)] - deprecate .approximateSize() (Julian Gruber)
78 * [[`9c32ca9fcd`](https://github.com/level/levelup/commit/9c32ca9fcd)] - refactor read streams using level-iterator-stream and level-codec (Julian Gruber)
79 * [[`8015e088cb`](https://github.com/level/levelup/commit/8015e088cb)] - tap -> tape + faucet (Lars-Magnus Skog)
80 * [[`af125b580c`](https://github.com/level/levelup/commit/af125b580c)] - fix readStream *AsBuffer options (Julian Gruber)
81 * [[`61b44463da`](https://github.com/level/levelup/commit/61b44463da)] - update dependencies (Lars-Magnus Skog)
82 * [[`90352e999c`](https://github.com/level/levelup/commit/90352e999c)] - update changelog from 0.18.6 to 0.19.0 (Lars-Magnus Skog)
83 * [[`b17e9e775b`](https://github.com/level/levelup/commit/b17e9e775b)] - Fixed valueEncoding bug by passing options without array. (Braydon Fuller)
84 * [[`9576842794`](https://github.com/level/levelup/commit/9576842794)] - Added test for valueEncoding "hex" for createReadStream (Braydon Fuller)
85 * [[`b9ce2ba2c5`](https://github.com/level/levelup/commit/b9ce2ba2c5)] - s/rvagg\/node-/level\// (Lars-Magnus Skog)
86 * [[`7460209eb6`](https://github.com/level/levelup/commit/7460209eb6)] - fix stream-bench.js (Julian Gruber)
87 * [[`2a2780c65c`](https://github.com/level/levelup/commit/2a2780c65c)] - refactor ltgt encoding (Julian Gruber)
88 * [[`f53e349ec7`](https://github.com/level/levelup/commit/f53e349ec7)] - refactor iterators using new deferred-leveldown (Julian Gruber)
89 * [[`e811f7e598`](https://github.com/level/levelup/commit/e811f7e598)] - remove leveled tests (Julian Gruber)
90 * [[`b37cf16445`](https://github.com/level/levelup/commit/b37cf16445)] - fix benchmarks by installing leveldown@^0.10.4 (Julian Gruber)
91 * [[`187711c96c`](https://github.com/level/levelup/commit/187711c96c)] - use level-codec (Julian Gruber)
92 * [[`a1fda6bf2f`](https://github.com/level/levelup/commit/a1fda6bf2f)] - extract error codes into level-errors module (Lars-Magnus Skog)
93 * [[`f4e5a44530`](https://github.com/level/levelup/commit/f4e5a44530)] - remove reference to write-stream and iterators (Lars-Magnus Skog)
94 * [[`7372fceb4a`](https://github.com/level/levelup/commit/7372fceb4a)] - Changed options for get to same as put (Richard Littauer)
95 * [[`7686899b6c`](https://github.com/level/levelup/commit/7686899b6c)] - add node 0.12 and iojs on travis (Lars-Magnus Skog)
96 * [[`4aa6e8b7a5`](https://github.com/level/levelup/commit/4aa6e8b7a5)] - remove encoding option (Julian Gruber)
97 * [[`b0247a436e`](https://github.com/level/levelup/commit/b0247a436e)] - Added errors to the available namespace when requiring 'levelup'. (Braydon Fuller)
98 * [[`8b8da57f7a`](https://github.com/level/levelup/commit/8b8da57f7a)] - clean up old level-ws reference (Lars-Magnus Skog)
99 * [[`3d26d39a43`](https://github.com/level/levelup/commit/3d26d39a43)] - update README with info on why WriteStream was removed (Lars-Magnus Skog)
100 * [[`ba51315047`](https://github.com/level/levelup/commit/ba51315047)] - add Jarrett Cruger as contributor (Lars-Magnus Skog)
101 * [[`ed89907f33`](https://github.com/level/levelup/commit/ed89907f33)] - remove unused dependencies (Lars-Magnus Skog)
102 * [[`6067bb4467`](https://github.com/level/levelup/commit/6067bb4467)] - \[doc\] beginning of readme adjustment (Jarrett Cruger)
103 * [[`78a06b3c10`](https://github.com/level/levelup/commit/78a06b3c10)] - \[fix\] update travis and package.json scripts (Jarrett Cruger)
104 * [[`fcdd49b039`](https://github.com/level/levelup/commit/fcdd49b039)] - \[rm test\] remove fstream based tests (Jarrett Cruger)
105 * [[`fb73bdecc0`](https://github.com/level/levelup/commit/fb73bdecc0)] - \[fix\] remove `copy` as it requires write-stream (Jarrett Cruger)
106 * [[`616da299f9`](https://github.com/level/levelup/commit/616da299f9)] - \[fix test\] remove references to write-stream in tests (Jarrett Cruger)
107 * [[`a712e623a7`](https://github.com/level/levelup/commit/a712e623a7)] - \[fix\] remove references to write-stream (Jarrett Cruger)
108 * [[`9e6a6b7ef4`](https://github.com/level/levelup/commit/9e6a6b7ef4)] - update logo and copyright (Lars-Magnus Skog)
109 * [[`8b339def43`](https://github.com/level/levelup/commit/8b339def43)] - check notFound on err (Brian Woodward)
110 * [[`36658a2c7d`](https://github.com/level/levelup/commit/36658a2c7d)] - support values to be null/undefined (David Björklund)
111 * [[`f0bc944005`](https://github.com/level/levelup/commit/f0bc944005)] - explicit devdep versions (Rod Vagg)
112 * [[`c951f094eb`](https://github.com/level/levelup/commit/c951f094eb)] - Use newer memdown store. Fixes build. (Eduardo Sorribas)
113 * [[`c2c12c9380`](https://github.com/level/levelup/commit/c2c12c9380)] - better document #del method (Ben West)
114 * [[`2410aa3aff`](https://github.com/level/levelup/commit/2410aa3aff)] - resolve #261, explain args to callback to #del (Ben West)
115 * [[`ef28adbe71`](https://github.com/level/levelup/commit/ef28adbe71)] - explicit devdep versions (Rod Vagg)
116 * [[`723391bb93`](https://github.com/level/levelup/commit/723391bb93)] - Use newer memdown store. Fixes build. (Eduardo Sorribas)
117 * [[`23b3f7be19`](https://github.com/level/levelup/commit/23b3f7be19)] - better document #del method (Ben West)
118 * [[`02bb5c3856`](https://github.com/level/levelup/commit/02bb5c3856)] - resolve #261, explain args to callback to #del (Ben West)
119 * [[`e77bbd4c7d`](https://github.com/level/levelup/commit/e77bbd4c7d)] - support values to be null/undefined (David Björklund)
120 * [[`b9117a001b`](https://github.com/level/levelup/commit/b9117a001b)] - fixes the leveldb link (Manuel Ernst)
121 * [[`3d541dbfc9`](https://github.com/level/levelup/commit/3d541dbfc9)] - remove 0.8 from travis (Rod Vagg)
122
123## 0.19.0 @ Aug 26 2014
124
125 * [[`7f14058440`](https://github.com/level/levelup/commit/7f14058440)] - minor whitespace changes (Rod Vagg)
126 * [[`9e6d335df2`](https://github.com/level/levelup/commit/9e6d335df2)] - fix license (Rod Vagg)
127 * [[`74caa18c09`](https://github.com/level/levelup/commit/74caa18c09)] - minor style fixes (Rod Vagg)
128 * [[`1c7bc43d01`](https://github.com/level/levelup/commit/1c7bc43d01)] - update nodeico badge (Rod Vagg)
129 * [[`b6357cc323`](https://github.com/level/levelup/commit/b6357cc323)] - Use highest/lowest instead of largest/smallest (Arnout Engelen)
130 * [[`e45ce4e9d5`](https://github.com/level/levelup/commit/e45ce4e9d5)] - Document what 'limit' does in 'reverse' mode (Arnout Engelen)
131 * [[`9004e9db69`](https://github.com/level/levelup/commit/9004e9db69)] - Discourage the use of start/end a bit (Arnout Engelen)
132 * [[`6178d69cdc`](https://github.com/level/levelup/commit/6178d69cdc)] - merge (Dominic Tarr)
133 * [[`e3ab0ebe03`](https://github.com/level/levelup/commit/e3ab0ebe03)] - document with comments (Dominic Tarr)
134 * [[`bb88572c15`](https://github.com/level/levelup/commit/bb88572c15)] - unmention bops (Dominic Tarr)
135 * [[`45df8e668e`](https://github.com/level/levelup/commit/45df8e668e)] - clarify ltgt (Dominic Tarr)
136 * [[`54eba03305`](https://github.com/level/levelup/commit/54eba03305)] - binary encoding in the browser (Calvin Metcalf)
137
138## 0.18.6 @ Jul 26 2014
139
140 * (lots of stuff since 0.18.1 not recorded in changelog, ooops)
141 * Extracted encoding / codec to separate modules (@dominictarr)
142
143## 0.18.1 @ Nov 20 2013
144
145 * Make chained-batch obey global LevelUP object options (@mcavage)
146
147## 0.18.0 @ Nov 18 2013
148
149 * Upgrade to LevelDOWN@0.10.0 (and bops@0.1.0 and readable-stream@1.1.9) (@rvagg)
150
151## 0.17.0 @ Oct 01 2013
152
153 * Undo factory pattern, use plain prototypal object and expose full prototype (@rvagg)
154 * Move Batch object to batch.js and expose (@rvagg)
155 * Use new package, DeferredLevelDOWN to handle all deferred open logic (@rvagg)
156 * Code cleanup, update deps (xtend) (@rvagg, @juliangruber)
157
158## 0.16.0 @ Sep 10 2013
159
160 * Added `notFound` boolean property and `status=404` property to NotFoundError (@rvagg)
161 * Upgrade to errno@0.1.0 which aliases .type and .name properties (@rvagg)
162 * ReadStream gracefully handles multiple destroy() calls (@mcollina)
163
164## 0.15.0 @ Aug 25 2013
165
166 * New ReadStream: upgrade to streams2, remove all state-management cruft, remove fstream support (@substack)
167 * Update LevelDOWN dependency to ~0.8.0 with Iterator lt/lte/gt/gte support and NAN as a dependency
168 * Added @substack as contributor
169
170## 0.14.0 @ Aug 19 2013
171
172 * Encodings overhaul, allow custom encoders/decoders for `keyEncoding` or `valueEncoding` (@dominictarr)
173
174## 0.13.0 @ Aug 11 2013
175
176 * Update LevelDOWN dependency version ~0.7.0 for Node 0.8->0.11 compatibility
177
178## 0.12.0 @ Jul 25 2013
179
180 * Update LevelDOWN dependency version ~0.6.2
181
182## 0.11.0 @ Jul 17 2013
183
184 * Remove all Function#bind calls for better browser compatibility (@juliangruber)
185 * Switch from direct Buffer access to bops for better browser compatibility (@juliangruber)
186 * WriteStream#end accepts `data` argument (@pgte)
187 * Added @pgte as contributor
188
189## 0.10.0 @ Jun 14 2013
190
191 * Upgrade to LevelDOWN@0.6.0 which upgrades to LevelDB@1.11.0, some important bugfixes: https://groups.google.com/forum/#!topic/leveldb/vS1JvmGlp4E
192
193## 0.9.0 @ 21 May 2013
194
195 * Use LevelDOWN@0.5.0, see https://github.com/level/leveldown/blob/master/CHANGELOG.md for details
196 * Race-condition(ish) fixed in ReadStream--createReadStream() does not start immediately and therefore allowed put()s to happen before the stream starts (@dominictarr)
197 * ReadStream doesn't emit "ready" event (@dominictarr)
198 * Allow separate encodings per operation in db.batch() (@juliangruber)
199 * Allow separate encodings per write() in WriteStream (@juliangruber)
200 * WriteStream supports "type" option ("put" [default] or "del") on constructor and individual write()s (@mcollina)
201 * Remove "leveldown" from dependencies (see http://r.va.gg/2013/05/levelup-v0.9-some-major-changes.html) (@rvagg)
202 * Expose LevelDOWN (or LevelDOWN substitute) as `db` property on LevelUP instance (e.g. db.db.approximateSize())
203 * Chained batch exposed from LevelDOWN, invoked with argument-less db.batch() (@juliangruber, @rvagg)
204 * Significantly improve ReadStream performance by replacing .bind() and .apply() (@mcollina, @kesla)
205 * Better Browserify support (@rvagg, @juliangruber, @maxogden, etc.)
206 * Deprecate secondary LevelDB-specific operations on LevelUP, prefer direct LevelDOWN access (approximateSize(), repair(), destroy(), getProperty()--new in LevelDOWN@0.5.0) (@rvagg)
207
208## 0.8.0 @ 17 Apr 2013
209
210 * More comprehensive argument checking, will now report back directly or throw if there is a problem rather than on nextTick (@rvagg)
211 * Expose `.options` property on LevelUP instances. (@rvagg)
212 * Further clarify 'encoding' -> 'valueEncoding' shift. db.options.valueEncoding is now authoritative even if user used 'encoding' on initialisation. (@rvagg)
213 * 'level' package now published to npm that bundles LevelUP & LevelDOWN and exposes LevelUP directly; for planned shift to detaching LevelDOWN as a direct-dependency of LevelUP. (@rvagg)
214
215## 0.7.0 @ 8 Apr 2013
216
217 * Windows support in LevelDOWN @0.2.0 (@rvagg)
218 * added 'db' option on constructor to replace LevelDOWN (@rvagg)
219 * added repair() & destroy() aliases for LevelDOWN implementations (@rvagg)
220 * fix early 'close' emit in WriteStream (@rvagg)
221 * improved ReadStream reverse=true start key handling (@kesla)
222 * ReadStream empty start & end keys ignored rather than segfault (@kesla)
223 * 'encoding' option now an alias for 'valueEncoding' only, 'keyEncoding' defaults to 'utf8' and must be changed explicitly (@rvagg)
224
225## 0.6.2 @ 4 Mar 2013
226
227 * use `xtend` package instead of internal util._extend @ralphtheninja
228 * internal cleanup of `callback` argument detection @ralphtheninja
229 * move deferred-open-operations into an internal `this._db` wrapper rather than make them call public .get()/.put() etc. for a second time @dominictarr
230
231## 0.6.1 @ 1 Mar 2013
232
233 * internal code cleanup & refactoring @ralphtheninja
234 * fix multiple iterator.end() calls in ReadStreams throwing errors (destroy() called while read/next is in progress) #82 #83 #84 @rvagg
235
236## 0.6.0 @ Feb 25 2013
237
238 * complete transition to LevelDOWN for the LevelDB binding. No native code left in LevelUP @rvagg
239 - LevelDOWN now keeps its own ChangeLog at: https://github.com/level/leveldown/blob/master/CHANGELOG.md
240 - LevelDB@1.9.0 and Snappy@1.1.0 are included in LevelDOWN@0.1.2
241 * simplify callback signature (remove extra, undocumented properties from some callbacks) @rvagg / @dominictarr
242
243## 0.5.4 @ Feb 16 2013
244
245 * explicit namespaces in C++ @rvagg
246 * memory leak, Persistent<Function> callback not Dispose()d for `readStream()` @rvagg
247 * allow one next() at a time, improve end() handling @rvagg
248 * ensure iterator end & next don't conflict @rvagg
249 * remove CloseError @ralphtheninja
250 * fix put/batch bug in WriteStream#_process() @ralphtheninja
251 * remove `useBatch` in `copy()` @rvagg
252 * move encodingOpts levelup.js -> util.js @ralphtheninja
253
254## 0.5.3-1 @ Feb 5 2013
255
256 * non-shrinkwrapped release @rvagg
257
258## 0.5.3 @ Jan 28 2013
259
260 * `location` exposed as read-only property on db object @rvagg
261 * swap bufferstream dependency for simple-bufferstream, remove unnecessary compile @rvagg
262 * comment out all sqlite3 benchmarks @ralphtheninja
263 * put LevelUP() into closure @ralphtheninja
264
265## 0.5.2 @ Jan 24 2013
266
267 * fix: incorrect scope in approximateSize function @sandfox
268
269## 0.5.1 @ Jan 10 2013
270
271 * change `createIfMissing` option default to `true` @rvagg
272 * use util._extend instead of local variant @rvagg
273 * adjust copyright & contributors @rvagg
274 * idempotent open and close, and emit _state as events @dominictarr
275 * fix: check that UINT32_OPTION_VALUE is a Uint32 @kesla
276 * feature: Support setting size of LRU-cache @kesla
277 * use util.inherits() from node core @ralphtheninja
278
279## 0.4.4 @ Jan 1 2013
280
281 * set maxListeners to Infinity to prevent warnings when using deferred open @juliangruber
282
283## 0.4.3 @ Dec 31 2012
284
285 * added @kesla to contributors list @rvagg
286 * feature: added approximateSize() @kesla
287
288## 0.4.2 @ Dec 30 2012
289
290 * process.nextTick->setImmediate with polyfill Node 0.9.5 compat @rvagg
291 * added @ralphtheninja to contributors list @rvagg
292
293## 0.4.1 @ Dec 20 2013
294
295 * remove `useBatch` option on `writeStream()` @rvagg
296
297## 0.4.0 @ Dec 18 2013
298
299 * remove old, unused util functions @rvagg
300 * speed up batch() & allow non-Strings to C++ @rvagg
301 * fix batch() benchmarks @rvagg
302 * improved compression test @rvagg
303 * added SQLite3 to test suite @rvagg
304 * remove compile warnings on osx @rvagg
305 * return Strings not Buffers from C++ when possible @rvagg
306 * optimised encoders & decoders @rvagg
307 * added basic get() benchmarks @rvagg
308 * revamped benchmark suite @rvagg
309 * allow JS Strings through to native layer @rvagg
310 * cleaner build for osx @rvagg
311 * remove compile warnings for solaris @rvagg
312 * LevelDB 1.7 @rvagg
313 * added `compress` boolean on open() @rvagg
314
315## 0.3.x and prior
316
317 * stuff