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

support open_in with an URL argument #112

Open
gasche opened this issue Feb 14, 2013 · 2 comments
Open

support open_in with an URL argument #112

gasche opened this issue Feb 14, 2013 · 2 comments

Comments

@gasche
Copy link

gasche commented Feb 14, 2013

The (very real) use case is a desperate university student with no computer at home, and only access to a public computer in his or her school's library, severely restricted (basic Caml installation, no right to install additional libraries or basically write any file on the computer), willing to work on image manipulation in OCaml.

The following could work in TryOCaml:

let image = open_in_bin "http://orion.math.iastate.edu/burkardt/data/bmp/snail.bmp";;
(* then use parsing code from http://pauillac.inria.fr/~cheno/lettre/lettre1.html *)

Current (incorrect) output:

Exception:
Sys_error
 "http://orion.math.iastate.edu/burkardt/data/bmp/snail.bmp: no such file or directory".
@hhugo
Copy link

hhugo commented Aug 5, 2014

Sys_js.register_autoload allows to do that (with CORS restriction https://developer.mozilla.org/en-US/docs/Web/HTTP/Access_control_CORS)
see https://github.com/ocsigen/js_of_ocaml/blob/master/toplevel/toplevel.ml#L146

In the js_of_ocaml toplevel, the following will load http://ocsigen.org/resources/logos/text_js_of_ocaml_with_shadow.png
let image = open_in_bin "/http/ocsigen.org/resources/logos/text_js_of_ocaml_with_shadow.png"

@cpitclaudel
Copy link

@hhugo Is this documented somewhere? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants