Enable Native File System API in NW.js

334 views
Skip to first unread message

Ashley Gullen

unread,
Jan 24, 2020, 7:59:51 AM1/24/20
to nw.js
Hi all,

I'd like to try using Chrome's new native file system API in NW.js. I know there are file system methods in Node, but using an API that is also available in the browser would let us keep our web and desktop codebases more similar.

It's currently in origin trial and has a flag in chrome://flags, but I can't figure out how to enable it in NW.js. I've tried adding the following to "chromium-args":
--native-file-system-api
--enable-native-file-system-api
--enable-features=native-file-system-api

What am I missing?

Ashley

Roger Wang

unread,
Jan 25, 2020, 4:26:30 AM1/25/20
to Ashley Gullen, nw.js
Please file an issue and I'll fix it. Thanks.

Roger

--
You received this message because you are subscribed to the Google Groups "nw.js" group.
To unsubscribe from this group and stop receiving emails from it, send an email to nwjs-general...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/nwjs-general/CAABs73jBUoHHfSRZJ%3DA6xptPGFpLk44gsJzvzNh2nemw_W0B_g%40mail.gmail.com.

Ashley Gullen

unread,
Jan 25, 2020, 8:12:43 AM1/25/20
to Roger Wang, nw.js

Roger Wang

unread,
Jan 25, 2020, 8:26:29 PM1/25/20
to nw.js
I just found it can be enabled by adding --enable-features=NativeFileSystemAPI and it works with a simple test here. Anything else please let me know. 

Roger 

Roger Wang

unread,
Jan 27, 2020, 10:46:52 AM1/27/20
to Ashley Gullen, nw.js
Could you attach a sample? It works here without any permission dialog.

In 'chrome://flags', there is a handle displayed for this feature -- 'native-file-system-api'. If you search for it in cs.chromium.org, it will lead you to 'blink::features::kNativeFileSystemAPI', which is 'NativeFileSystemAPI' for the command line.

On Mon, Jan 27, 2020 at 11:40 PM Ashley Gullen <ash...@scirra.com> wrote:
Thanks, that got it working. Is there somewhere we can look up the feature names for the --enable-features flag ourselves in future? It seems different to anything listed in chrome://flags.

Also once the Native File System API is working, according to my tests in NW.js 0.43.6, it shows the same permission prompts as it does in the browser. There's no point having these since the Node APIs give broader file access with no permission prompts. Is there a way to make NW.js automatically approve permission?

Ashley


Ashley Gullen

unread,
Jan 27, 2020, 10:48:30 AM1/27/20
to Roger Wang, nw.js
Thanks, that got it working. Is there somewhere we can look up the feature names for the --enable-features flag ourselves in future? It seems different to anything listed in chrome://flags.

Also once the Native File System API is working, according to my tests in NW.js 0.43.6, it shows the same permission prompts as it does in the browser. There's no point having these since the Node APIs give broader file access with no permission prompts. Is there a way to make NW.js automatically approve permission?

Ashley


On Sun, 26 Jan 2020 at 01:26, Roger Wang <ro...@nwjs.io> wrote:

Ashley Gullen

unread,
Jan 27, 2020, 5:58:00 PM1/27/20
to Roger Wang, nw.js
Here's a minimal example: https://www.dropbox.com/s/70n9ahropz8olxi/nwjs-native-filesystem-api.zip?dl=0

Pick a folder, then click 'Save' to write file.txt to it with text "Hello world". There are two permission prompts, one for read access to the folder, and one for writing files to it. I think there are different prompts for the single-file usage of the API too, maybe others. It would be good if these could auto-approve. Should I file a bug for that?

Ashley

Roger Wang

unread,
Jan 29, 2020, 8:29:16 PM1/29/20
to Ashley Gullen, nw.js
Yes, please file an issue. Thanks.

Roger

Ashley Gullen

unread,
Jan 31, 2020, 11:01:27 AM1/31/20
to Roger Wang, nw.js
Reply all
Reply to author
Forward
0 new messages