mapbox / node-mbtiles

mbtiles utility, renderer, and storage backend for tilelive

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Windows: Open database on another drive

cloakedch opened this issue · comments

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?