Skip to content

Windows: Open database on another drive #112

@cloakedch

Description

@cloakedch

How can one open an mbtiles database that is stored on a different drive letter than windows?

Given

new MBTiles(path, (err, mbtiles) => { console.log(err); });

I tried the following values for path:

D:\\maps.mbtiles
D://maps.mbtiles
file:///D:\\maps.mbtiles
file://D:\\maps.mbtiles
\\\\D:\\maps.mbtiles
\\D:\\maps.mbtiles

The file exists (I can fs.stat() the file), I can even read it withfs.readFile(). Just node-mbtiles doesn't seem to get along with it.

I have consulted the source and it seems that on line 83 in mbiltes.js it uses uri.pathname to parse the input file, which does not include a drive letter.

Any ideas how to get it working?

EDIT:

How about using url.fileURLToPath(dbPath) instead of using uri.pathname?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions