Comments (2)
Hi @vweevers , sure the createReadStream is pretty much a copy from the readme:
function fetchAll() {
const db = level('leveldb')
db.createReadStream()
.on('data', function (data) {
console.log(data.key, '=', data.value)
})
.on('error', function (err) {
console.log('Oh my!', err)
})
.on('close', function () {
console.log('Stream closed')
})
.on('end', function () {
console.log('Stream ended')
})
}
But I just figured out the problem, there are some non-printable characters in the keys. I used createReadStream to fetch everything and write the keys into files, so that I could hex dump them:
$ xxd key3
00000000: 5f66 696c 653a 2f2f 0001 6462 496e 6974 _file://..dbInit
00000010: 436f 6e74 6578 74 Context
No idea what's up with these funky hidden chars, but now I succeed to fetch them via db.get using a suitable matching key:
var funkyKey = "_file://\000\001dbInitContext"
console.log(`fetching dbInitContext with a funky key: ${await db.get(funkyKey)}`);
n.b I thought I might need to use {keyEncoding: 'binary'} on the db.get options, but turns out it works regardless.
Thx
Phil
from level.
For example using createReadStream
Can you share that code as well? So we can see the difference.
from level.
Related Issues (20)
- Raplica & Sharding HOT 4
- Question: Fetch all values HOT 5
- Insert Lock, Read Lock, Dead Lock Concatency Control HOT 2
- Find specific key createReadStream HOT 6
- docker node alpine image exited with code 139 (arm32v7) HOT 4
- Can this be used to polyfill IndexedDB on Node? HOT 3
- [Question] how can "level-js" make data persistence? HOT 2
- db.isOperational is not a function HOT 2
- Trying to store different types of data but getting stored as string HOT 1
- Error while creating a web bundle with esbuild HOT 1
- Recommended way of retrieving a list of all keys? HOT 1
- Exception handling during storing a value HOT 4
- Live streaming values from a level HOT 6
- Types do not export `destroy` property HOT 1
- Random "Error: Database is not open" errors HOT 14
- Minor Compactions is triggered frequently
- Every time my node script restarts, it creates a new .LDB file in the database directory HOT 1
- Checking if a key exists HOT 1
- Get read access to locked database HOT 1
- how to get all sublevel db HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from level.