Alert on invalid filename (fixes #1)
This commit is contained in:
parent
13900c8092
commit
634df5ebf4
1 changed files with 8 additions and 3 deletions
|
@ -229,9 +229,14 @@ async function pickDirectory(e){
|
|||
return;
|
||||
}
|
||||
const dat = {type: "FeatureCollection", features: geojsons};
|
||||
try {
|
||||
const file = await dirHandle.getFileHandle(`${filename}.geojson`, {
|
||||
create: true
|
||||
});
|
||||
} catch (error) {
|
||||
alert(`Could not open file: ${error.message}`);
|
||||
return
|
||||
}
|
||||
const blob = new Blob([JSON.stringify(dat)]);
|
||||
const writableStream = await file.createWritable();
|
||||
await writableStream.write(blob);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue