Edwinexd / Edwinexd/sql-validator
Allow open & save to file (window.showOpenFilePicker)
- Lenguaje dominante
- TypeScript
- Estrellas
- 4
- Forks
- 2
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
There is a webapi in development that could be used to allow users to open/create a save file once and then repeatedly save to the same file without creating a bunch of dumps in the users download folder
https://developer.mozilla.org/en-US/docs/Web/API/Window/showOpenFilePicker#browser_compatibility
Example generated by Chatgpt:
```js
// Open file
async function openFile() {
const [fileHandle] = await window.showOpenFilePicker();
const file = await fileHandle.getFile();
const contents = await file.text();
console.log(contents); // Load file contents
return fileHandle; // Return handle for saving
}
// Save file
async function saveFile(fileHandle, data) {
const writableStream = await fileHandle.createWritable();
await writableStream.write(data); // Write new content
await writableStream.close();
}
```
Edit: might be more readily available then I initially thought https://developer.mozilla.org/en-US/docs/Web/API/FileSystemFileHandle
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Línea de trabajo
Comienza con el comportamiento existente del repositorio para abrir, guardar y descargar archivos; en el issue no se nombran archivos fuente ni pruebas. Revisa la documentación de MDN enlazada sobre showOpenFilePicker y FileSystemFileHandle y, después, define la compatibilidad de los navegadores y el comportamiento esperado al guardar repetidamente antes de la implementación. Se considerará terminado cuando sea posible abrir o crear un archivo y guardar contenido posterior en ese archivo sin descargas repetidas.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- typescript
- Área
- frontend, web-dev
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 38/100