Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

client-side dart:io library #1324

Closed
DartBot opened this issue Jan 24, 2012 · 13 comments
Closed

client-side dart:io library #1324

DartBot opened this issue Jan 24, 2012 · 13 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. type-enhancement A request for a change that isn't a bug

Comments

@DartBot
Copy link

DartBot commented Jan 24, 2012

This issue was originally filed by @seaneagan


It would be nice to be able to use the existing server-side dart:io library on the client as well.

Instead of having the dart:html library include the HTML 5 File API directly, the dart:io library could be implemented in the client as wrappers for the HTML 5 API.

If certain operations are not supported by the HTML 5 File API, then an UnsupportedOperationException can be thrown when attempting to use them.

The client side Dart VM could fill in holes that are not available in the HTML 5 File API.

@dgrove
Copy link
Contributor

dgrove commented Jan 25, 2012

Removed Type-Defect label.
Added Type-Enhancement, Area-UI, Triaged labels.

@DartBot
Copy link
Author

DartBot commented Feb 1, 2012

This comment was originally written by @seaneagan


Here is a more detailed look at which sub-libraries of "dart:io" (see http://code.google.com/p/dart/source/browse/branches/bleeding_edge/dart/runtime/bin) could exist in a Dart -> JS environment (web browser) along with their backing JS APIs. These JS APIs could all then be removed from from dart:html (since they are unrelated to HTML):

file, directory -> http://www.w3.org/TR/FileAPI/
input stream, output stream -> http://www.khronos.org/registry/typedarray/specs/latest/
httpclient -> https://developer.mozilla.org/en/XMLHttpRequest
socket -> http://www.w3.org/TR/websockets/
platform -> http://closure-library.googlecode.com/svn/docs/closure_goog_useragent_useragent.js.html
timer -> https://developer.mozilla.org/en/DOM/window.setTimeout

There are a few things which will be in "dart:io" will not make sense on the client, such as an HTTP server. To solve this, either only the smaller sub-libraries would be available in the client, instead of "dart:io" as a whole, or the server-only parts of "dart:io" would just throw UnsupportedOperationException or similar when used in the client.

@DartBot
Copy link
Author

DartBot commented Feb 21, 2012

This comment was originally written by rmin...@google.com


This would be incredibly useful for work I am doing on chromeos. If you want a subset could you just call it dart:clientio or dart:client or something? Either way, I hope it happens.

@dgrove
Copy link
Contributor

dgrove commented Jan 11, 2013

Not sure where this will eventually belong, but it not in area-ui.


cc @blois.
cc @madsager.
Removed Area-UI label.
Added Area-Library label.

@blois
Copy link
Contributor

blois commented Jan 11, 2013

Even APIs such as HTTP server would be very cool to have working for Chrome Applications now that apps can accept socket connections.

@DartBot
Copy link
Author

DartBot commented Jan 11, 2013

This comment was originally written by @financecoding


yep, would be awesome! https://github.com/dart-gde/chrome.dart/blob/master/lib/src/socket.dart has very early support for socket but does not implement dart:io.

@DartBot
Copy link
Author

DartBot commented Jul 13, 2013

This comment was originally written by oj...@quickrworld.com


"The Socket exposes both a Stream and a IOSink interface, making it ideal for using together with other Streams."

Would help if the implementation on the client side does the same; exposing a Stream interface would be most useful.

@DartBot
Copy link
Author

DartBot commented Nov 25, 2014

This comment was originally written by beatg...@gmail.com


It's been over a year since this issue was opened and Dart has been in 1.x for over a year.

Is there any update on whether this is even on the radar for Dart?

@justinfagnani
Copy link
Contributor

We have started a file system abstraction package, that can have implementations in different environments, including Chrome and possibly html5. No one's had time to work on it recently, but contributions should be easy to make.

It of course would require that all IO code be written against this package rather that dart:io, but once done that code would be portable across environments.

https://github.com/google/files.dart

@DartBot
Copy link
Author

DartBot commented Feb 26, 2015

This comment was originally written by @stevenroose


An abstracted HTTP interface would be very beneficial as well.

I'd propose a (fictional) dart:http.HttpClient interface that both dart:io.HttpClient and package:browser_client.BrowserClient can implement.

It's very cumbersome that libraries that try to implement a protocol that is specified around HTTP has to worry about whether it is run in VM or a browser.

@DartBot
Copy link
Author

DartBot commented Feb 26, 2015

This comment was originally written by @zoechi


This is what https://pub.dartlang.org/packages/http does.

@DartBot DartBot added Type-Enhancement area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. labels Feb 26, 2015
@sethladd
Copy link
Contributor

sethladd commented Jun 4, 2015

This isn't planned. Hopefully if/when Dart has configuration/platform configurable libraries, this can be built by the community.

@sethladd sethladd closed this as completed Jun 4, 2015
@kevmoo kevmoo added type-enhancement A request for a change that isn't a bug and removed triaged labels Mar 1, 2016
@jarrodcolburn
Copy link

I'm interested in looking at this issue :) By compiling subset of dart's code to wasm.

Tools like Emscipten's emcc can compile c to wasm. Emcc has a file system api that adapts many of c's stdlib calls to webassembly, please see https://emscripten.org/docs/api_reference/Filesystem-API.html . Example, obscuring filesystem calls as IndexedDB.

Is there any chance that a subset of dart-lang c code can be compiled to wasm? Then used to make dart:io for web?

Does anyone think this is possible? I tried looking into this recently but am unfamiliar with the ninja build system, and want to get an opinion and recommendations on where to start thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. type-enhancement A request for a change that isn't a bug
Projects
None yet
Development

No branches or pull requests

7 participants