Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / pas2js / 2024-05

ZenFS added

6 messages · 3 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Michael Van Canneyt

Hello,

I've added an import unit for the ZenFS filesystem emulation in PasJS (packages/zenfs). There is a demo for it in demo (demo/zenfs).

More importantly, for those interested in WebAssembly, it is used to implement a storage backend for WASI file support needed by a WebAssembly module. This was hitherto unimplemented.

So now, if you use pas2js to load a webassembly, you can furnish your webassembly with a virtual filesystem in the browser. There is a demo for this as well (demo/wasienv/filesystem/)

You can see it at work here:

https://www.freepascal.org/~michael/pas2js-demos/wasienv/filesystem/

and here:

https://www.freepascal.org/~michael/fresnel/basic/

(The webassembly code displays an image. It loads the image from a PNG file...)

I plan to use the same backend to make the file routines in the units SysUtils, Classes and IOUtils for pas2js functional.

Enjoy,

Michael.

Jy V
to Michael Van Canneyt

Well done Michael,

This is an important milestone,
demonstrating the well-designed architecture of FreePascal to support Wasi,

I was wondering if you are thinking of any limitation using Wasi backend as WebStorage similar to your BrowserApp but when targeting Pas2JS Service Worker App ?

Kind Regards, Jyv.

On Tue, May 21, 2024 at 2:42?PM Michael Van Canneyt via Pas2js <

Show quoted text 38 lines
wrote: Hello, I've added an import unit for the ZenFS filesystem emulation in PasJS (packages/zenfs). There is a demo for it in demo (demo/zenfs). More importantly, for those interested in WebAssembly, it is used to implement a storage backend for WASI file support needed by a WebAssembly module. This was hitherto unimplemented. So now, if you use pas2js to load a webassembly, you can furnish your webassembly with a virtual filesystem in the browser. There is a demo for this as well (demo/wasienv/filesystem/) You can see it at work here: https://www.freepascal.org/~michael/pas2js-demos/wasienv/filesystem/ and here: https://www.freepascal.org/~michael/fresnel/basic/ (The webassembly code displays an image. It loads the image from a PNG file...) I plan to use the same backend to make the file routines in the units SysUtils, Classes and IOUtils for pas2js functional. Enjoy, Michael. _______________________________________________ Pas2js maillist - https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20240521/205d64af/attachment.htm>

Jy V
to Jy V

Sorry for the typo, I meant the backend WebAccess provided by ZenFS (the same backend declared in your Pas2JS BrowserApp).

Show quoted text 54 lines
Well done Michael, This is an important milestone, demonstrating the well-designed architecture of FreePascal to support Wasi, I was wondering if you are thinking of any limitation using Wasi backend as WebStorage similar to your BrowserApp but when targeting Pas2JS Service Worker App ? Kind Regards, Jyv. On Tue, May 21, 2024 at 2:42?PM Michael Van Canneyt via Pas2js < > wrote: > > Hello, > > I've added an import unit for the ZenFS filesystem emulation in PasJS > (packages/zenfs). There is a demo for it in demo (demo/zenfs). > > More importantly, for those interested in WebAssembly, it is used to > implement a storage backend for WASI file support needed by a > WebAssembly module. This was hitherto unimplemented. > > So now, if you use pas2js to load a webassembly, you can furnish your > webassembly with a virtual filesystem in the browser. > There is a demo for this as well (demo/wasienv/filesystem/) > > You can see it at work here: > > https://www.freepascal.org/~michael/pas2js-demos/wasienv/filesystem/ > > and here: > > https://www.freepascal.org/~michael/fresnel/basic/ > > (The webassembly code displays an image. It loads the image from a PNG > file...) > > I plan to use the same backend to make the file routines in the units > SysUtils, Classes and > IOUtils for pas2js functional. > > Enjoy, > > Michael. > _______________________________________________ > Pas2js maillist - > https://lists.freepascal.org/cgi-bin/mailman/listinfo/pas2js >

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/pas2js/attachments/20240521/80b22b3a/attachment.htm>

Michael Van Canneyt
to Jean SUZINEAU
Jean SUZINEAU wrote 9 lines
Hello, I'm trying to load files from the server and copy them in the local ZenFS file storage. I saw in the fresnelhost.js of the demo https://www.freepascal.org/~michael/fresnel/basic/ that it uses a function PreLoadFilesIntoDirectory, but I couldn't find the corresponding pascal source, maybe this is private to your project or not yet released ?

No, this function is part of the WASI host class for runnning webassembly programs. Look for the wasienv and wasihostapp units in packages/wasi/src.

These functions can be copied and used even if you don't use Webassembly. I will create a zenfsutils unit that has this function, makes life easier.

Michael.