Skip to content

as far I see there is no working createIfMissing=false anymore. #118

@axkibe

Description

@axkibe

See following minimal node.js example:

import { default as level } from 'level';
import timers from 'node:timers/promises';

const db = new level.Level( './dbxx', { passive: true, createIfMissing: false } );
await timers.setTimeout( 1000 );
console.log( 'nothing should be done' );

After this is finished, there will be a directory called "dbxx".

in classic-level/index.js it is forced to true, and I dont see the options overriding it anywhere. (also if testing I change this force to false the underlying layer implementation does create the directory anyway)

My use case: I want to offer the user a GUI, where they can point at a directory and then I'll check if this a level db in the format I expect (I tested for a specific key=value pair). Doing this naively will create unwanted level db instances all over the place..

Workaround I came up with: place a marker "MYAPP.meta" in the level db directory and check for that file along with CURRENT and the MANIFEST-? before trying to open level db.. (and thus always creating the database if not existent)

Would be nice tough if this functionality that existed as far I am aware with leveldown existed would be working again.

PS: level version 9.0.0
classic level 2.0.0
abstract level 2.0.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions