Support sqlite mode flags (#73)

* Update mbtiles.js

* some reading

* remove seemingly unused/dead code

* core api functionality

* test note

* grids

* remove index test

* add tilelive example

* vNext

* follow sqlite3 URI filenames

* add mode test

* add mode test

* fix ci

* fix ci

* Update mbtiles.js

* follow sqlite3 URI filenames

* add mode test

* add mode test

* fix ci

* fix ci

* Update readme on mode flags
This commit is contained in:
jingsam
2018-03-27 23:23:48 +08:00
committed by Sam Matthews
parent 6febf74d62
commit 9e9a1ebbb9
3 changed files with 51 additions and 2 deletions
+7 -1
View File
@@ -22,11 +22,17 @@ var MBTiles = require('@mapbox/mbtiles');
All MBTiles instances need to be constructed before any of the methods become available. *NOTE: All methods described below assume you've taken this step.*
```javascript
new MBTiles('./path/to/file.mbtiles', function(err, mbtiles) {
new MBTiles('./path/to/file.mbtiles?mode={ro, rw, rwc}', function(err, mbtiles) {
console.log(mbtiles) // mbtiles object with methods listed below
});
```
The `mode` query parameter is a opening flag of mbtiles. It is optional, default as `rwc`. Available flags are:
- `ro`: readonly mode, will throw error if the mbtiles is not existed.
- `rw`: read and write mode, will throw error if the mbtiles is not existed.
- `rwc`: read, write and create mode, will create a new mbtiles if the mbtiles is not existed.
### Reading
**`getTile(z, x, y, callback)`**