File System Access API coming soon - Forum

Forum Navigation
You need to log in to create posts and topics.

File System Access API coming soon

Page 1 of 2Next

The File System Access API allows web apps to read or save changes directly to files and folders on the user's device. It's currently under development and support is still limited to some web browsers (Edge, Chrome and Opera) in Desktop computers, but it works! I'm currently developing a plugin to support this API with simple VisualNEO Web commands and this mini App is the first working sample:

Simple FileSystem API Text Editor:
https://visualneo.com/tutorials/filesystem/

Please check it using any of the supported web browsers and let me know what you think.
Personally I think this is another great step for VisualNEO Web powered Apps.

More info about File System Access API here:
https://github.com/WICG/file-system-access/blob/main/EXPLAINER.md
https://web.dev/file-system-access/

Vadim, farhad2008 and 9 other users have reacted to this post.
Vadimfarhad2008CDY@44asmatDarbdenralPalamarnoyzenTuevisionemojavadrajabihakamiroccocogliano

Great job luishp, thank you.

luishp has reacted to this post.
luishp

@luishp

Works great!!!

I am very happy to see how quickly VisualNEO Web is developing!!!

More and more great features every day!

Thank you so much!!!

Uploaded files:
  • You need to login to have access to uploads.
luishp has reacted to this post.
luishp

It works for me.

Great job @luishp.

Just a perhaps silly question: what's the difference with vartolocalfile and localfiletovar command?

luishp has reacted to this post.
luishp

@luishp

Great find ... if the security (access control) hurdles can be overcome, this takes VisualNEOWin and Web Apps (VisualNEOWeb) to a higher level of interoperability and data sharing.

Question #1 - the sample App worked perfectly with .txt files, but the documentation suggests that other file types can also be specified (e.g. images); I tried selecting a .pdf file ... it took longer to respond, and then displayed the file in its raw text format ... is it possible to access pdf, png/jpg, rtf etc. files ?

Question #2 - does the file access work only in a Windows environment or also Android and/or iOS ?

@roccocogliano

what's the difference with vartolocalfile and localfiletovar command?

I am not sure of the 'context of your question' ... but generally ...

vartolocalfile would the process of writing/saving the values in a [variable] and storing it in a (local) file

localfiletovar would be the opposite i.e. reading the contents of a (local) file into a [variable]

 

Thank you @gaev,

It was just a curiosity.

but what the "Load file" and "Save File" commands do in the example shown by @luishp? I do not understand the difference, the goals are not the same? That is to open and save files on the filesystem? Surely because I don't know how they actually work. =)

Thank you again

@roccocogliano

but what the "Load file" and "Save File" commands do in the example shown by @luishp? I do not understand the difference, the goals are not the same? That is to open and save files on the filesystem? Surely because I don't know how they actually work. =)

a) the example from @luishp is a WebApp ... to date, due to security concerns, WebApps (or even web pages) did not have such access to the user's local (c: etc.) files.

b) since we do not have access to the underlying code, I can not tell what commands are used; I am assuming that the code associated with the click event of the Buttons calls the mentioned Javascript library ... and I am not interested in how it is done, as long as I can have a (plugin) command that does what I want.

3) As for the Button Labels ...

- Load - reads the contents of the selected file and place them in a variable (like FileRead on VisualNEOWin)
- Save - writes the contents of a variable to the same file (like FileWrite on VisualNEOWin)
- Save As - is similar to Save with the added capability of selecting another file

... there is more than one way to describe these processes :-)

@roccocogliano @gaev

Note that current LocalFileToVar needs a File Input object. This plugin does not need a File Input object and can handle asyncronous loading by calling a subroutine when all the content has been loaded from the file. In fact the file content is sent to the subroutine to be processed.

The new commands neoFileRead and neoFileWrite can read and write multiple times to the same file once they have permission. VarToLocalFile fires a file download, not a real file write operation as neoFileWrite does.

Please try saving the content multiple times using my sample app. You only select the target file (and grant permission) once. Successive updates work just as any other desktop application: writing the content to the file (not downloading it again).

We have real file access. And it supports UNICODE characters too :)

I'm still exploring the possibilities regarding file types and file operations. Right now only desktop Edge, Chrome and Opera browsers support this API but it's supposed mobile Android phones will support it in the near future too.

More to come...

Vadim, CDY@44 and roccocogliano have reacted to this post.
VadimCDY@44roccocogliano

Ok, now I understand, everything is clearer. A really great job @luishp 👍

Hello and good time and do not be tired! This is definitely a big deal ...
The existing Persian texts in the file are not displayed correctly! But you can write Persian well in it! And saved.

Uploaded files:
  • You need to login to have access to uploads.

@javadrajabihakami I have just tested it with arabic characters and it works fine for me, writing and reading it back.

javadrajabihakami has reacted to this post.
javadrajabihakami

I have updated the sample app with additional functionalities and tests.
Attached a screenshot with current neoFileSystem plugin commands.
I think I have included most of the API.
Please let me know if you have any issue.

Uploaded files:
  • You need to login to have access to uploads.
Vadim, farhad2008 and 3 other users have reacted to this post.
Vadimfarhad2008CDY@44asmatjavadrajabihakami
Quote from luishp on July 2, 2021, 8:43 am

@javadrajabihakami I have just tested it with arabic characters and it works fine for me, writing and reading it back.

Hello, the file created by this plugin in Arabic and Persian works well! But the files in the system, which are in Persian and Arabic, do not display properly! Maybe I have a problem! Thanks

Quote from javadrajabihakami on July 3, 2021, 7:06 am
Quote from luishp on July 2, 2021, 8:43 am

@javadrajabihakami I have just tested it with arabic characters and it works fine for me, writing and reading it back.

Hello, the file created by this plugin in Arabic and Persian works well! But the files in the system, which are in Persian and Arabic, do not display properly! Maybe I have a problem! Thanks

I was ashamed of the problem! My text file was not in Unicode format! My problem is solved and it works well with Persian and Arabic. Thanks dear friend

@luishp Me parece unas funcionalidades que darán más potencia a VisualNeo. Ya estoy esperándolas-

@luishp

Felicitaciones por este plugin

Estoy haciendo algunas pruebas para conocer el funcionamiento del mismo, y me pregunto algunas cosas :

1.Existe la posibilidad partiendo de la base que la carpeta a consultar es siempre la misma en mi caso, de poder guardar de alguna manera el resultado del "handle obtenido" mediante "neoFolderBox" para no tener que llamar esa funcion cada vez que quiero buscar si existe un archivo e ir directamente a la opcion "neoFileList", intente reflejarlo en un texto pero no se ve nada. O el handle cambia cada vez que ejecutamos la aplicacion?

2. Una vez obtenida la lista de archivos se puede obtener alguno de ellos y usarlo en otras funciones de VisualNeo, ejemplo si es una lista de videos en una carpeta, puedo cargarla en el reproductor multimedia de videos?

Hola @gustavo1973

O el handle cambia cada vez que ejecutamos la aplicacion?

No estoy seguro pero creo que cambia cada vez que ejecutamos la aplicación. Es decir, necesitamos el consentimiento expreso del usuario para poder acceder a la carpeta y sus archivos cada vez que ejecuta la aplicación.

Una vez obtenida la lista de archivos se puede obtener alguno de ellos y usarlo en otras funciones de VisualNeo, ejemplo si es una lista de videos en una carpeta, puedo cargarla en el reproductor multimedia de videos?

Tenemos que experimentar todos un poco con esto, aunque yo diría que debería ser posible ya que obtenemos los permisos de lectura.

Saludos.

@luishp

Wow, what a phantastic new feature. Many,many thanks. This opens real new dimensions, also for my apps. Just 1 question: Is it possible to get a fileHandle without an open-file -dialog? Means, how can I open/read a file in background? maybe there is a possible work around by auto-click an hidden button. But also for this I would have to define trhe path of the file? Anyway, again Thanks a lot for this perfect tool!

Hi @impulsmedia, thank you for your nice comments :)

Is it possible to get a fileHandle without an open-file -dialog?

I don't think so. Due to security restrictions it must be the user who selects the file or folder to work into at first.

Best regards.

Page 1 of 2Next
Open chat
1
Do you need more info?
Hi, do you have any doubt?