fix: lint
Signed-off-by: Andrew Calcutt <acalcutt@techidiots.net>
This commit is contained in:
parent
2ea3515d38
commit
3f45c38663
4 changed files with 28 additions and 10 deletions
10
src/main.js
10
src/main.js
|
|
@ -8,7 +8,11 @@ import { fileURLToPath } from 'url';
|
|||
import request from 'request';
|
||||
import { server } from './server.js';
|
||||
import MBTiles from '@mapbox/mbtiles';
|
||||
import { PMtilesOpen, PMtilesClose, GetPMtilesInfo } from './pmtiles_adapter.js';
|
||||
import {
|
||||
PMtilesOpen,
|
||||
PMtilesClose,
|
||||
GetPMtilesInfo,
|
||||
} from './pmtiles_adapter.js';
|
||||
|
||||
const __filename = fileURLToPath(import.meta.url);
|
||||
const __dirname = path.dirname(__filename);
|
||||
|
|
@ -119,7 +123,9 @@ const startWithinputFile = async (inputFile) => {
|
|||
let FileOpenInfo = PMtilesOpen(inputFile);
|
||||
const info = await GetPMtilesInfo(FileOpenInfo.pmtiles);
|
||||
const metadata = info.metadata;
|
||||
if (FileOpenInfo.fd !== undefined) {PMtilesClose(FileOpenInfo.fd);}
|
||||
if (FileOpenInfo.fd !== undefined) {
|
||||
PMtilesClose(FileOpenInfo.fd);
|
||||
}
|
||||
FileOpenInfo = null;
|
||||
|
||||
if (
|
||||
|
|
|
|||
|
|
@ -30,8 +30,8 @@ export const PMtilesOpen = (FilePath) => {
|
|||
let pmtiles = undefined;
|
||||
let fd = undefined;
|
||||
|
||||
if(isValidHttpUrl(FilePath)) {
|
||||
const source = new PMTiles.FetchSource(FilePath)
|
||||
if (isValidHttpUrl(FilePath)) {
|
||||
const source = new PMTiles.FetchSource(FilePath);
|
||||
pmtiles = new PMTiles.PMTiles(source);
|
||||
} else {
|
||||
fd = fs.openSync(FilePath, 'r');
|
||||
|
|
@ -123,14 +123,18 @@ const ArrayBufferToBuffer = (array_buffer) => {
|
|||
return buffer;
|
||||
};
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string
|
||||
*/
|
||||
function isValidHttpUrl(string) {
|
||||
let url;
|
||||
|
||||
|
||||
try {
|
||||
url = new URL(string);
|
||||
} catch (_) {
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
return url.protocol === "http:" || url.protocol === "https:";
|
||||
}
|
||||
return url.protocol === 'http:' || url.protocol === 'https:';
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,11 @@ import Pbf from 'pbf';
|
|||
import { VectorTile } from '@mapbox/vector-tile';
|
||||
|
||||
import { getTileUrls, fixTileJSONCenter } from './utils.js';
|
||||
import { PMtilesOpen, GetPMtilesInfo, GetPMtilesTile } from './pmtiles_adapter.js';
|
||||
import {
|
||||
PMtilesOpen,
|
||||
GetPMtilesInfo,
|
||||
GetPMtilesTile,
|
||||
} from './pmtiles_adapter.js';
|
||||
|
||||
export const serve_data = {
|
||||
init: (options, repo) => {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,11 @@ import polyline from '@mapbox/polyline';
|
|||
import proj4 from 'proj4';
|
||||
import request from 'request';
|
||||
import { getFontsPbf, getTileUrls, fixTileJSONCenter } from './utils.js';
|
||||
import { PMtilesOpen, GetPMtilesInfo, GetPMtilesTile } from './pmtiles_adapter.js';
|
||||
import {
|
||||
PMtilesOpen,
|
||||
GetPMtilesInfo,
|
||||
GetPMtilesTile,
|
||||
} from './pmtiles_adapter.js';
|
||||
|
||||
const FLOAT_PATTERN = '[+-]?(?:\\d+|\\d+.?\\d+)';
|
||||
const PATH_PATTERN =
|
||||
|
|
|
|||
Loading…
Reference in a new issue