From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail3-relais-sop.national.inria.fr (mail3-relais-sop.national.inria.fr [192.134.164.104]) by sympa.inria.fr (Postfix) with ESMTPS id C2C2A7FD90 for ; Sat, 14 Jan 2017 08:49:51 +0100 (CET) Authentication-Results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=nicolas.ojeda.bar@lexifi.com; spf=None smtp.mailfrom=nicolas.ojeda.bar@lexifi.com; spf=None smtp.helo=postmaster@vrout10.yaziba.net Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of nicolas.ojeda.bar@lexifi.com) identity=pra; client-ip=185.56.204.34; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="nicolas.ojeda.bar@lexifi.com"; x-sender="nicolas.ojeda.bar@lexifi.com"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of nicolas.ojeda.bar@lexifi.com) identity=mailfrom; client-ip=185.56.204.34; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="nicolas.ojeda.bar@lexifi.com"; x-sender="nicolas.ojeda.bar@lexifi.com"; x-conformance=sidf_compatible Received-SPF: None (mail3-smtp-sop.national.inria.fr: no sender authenticity information available from domain of postmaster@vrout10.yaziba.net) identity=helo; client-ip=185.56.204.34; receiver=mail3-smtp-sop.national.inria.fr; envelope-from="nicolas.ojeda.bar@lexifi.com"; x-sender="postmaster@vrout10.yaziba.net"; x-conformance=sidf_compatible IronPort-PHdr: =?us-ascii?q?9a23=3AyyBOKBHHoaALbjIa+vzsL51GYnF86YWxBRYc798d?= =?us-ascii?q?s5kLTJ7yr8ywAkXT6L1XgUPTWs2DsrQf2raQ6PurADVbqb+681k6OKRWUBEEjc?= =?us-ascii?q?hE1ycBO+WiTXPBEfjxciYhF95DXlI2t1uyMExSBdqsLwaK+i764jEdAAjwOhRo?= =?us-ascii?q?LerpBIHSk9631+ev8JHPfglEnjSwbLd9IRmsowjcuMYajZZ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0i6TA7CYymDYbZSo+xh7yB2T+3HodKaWBeFlCMDXDoep2YVPgWbSKSJtZtkjgF?= =?us-ascii?q?Vbi6V48szgqutQ//y7p/NOXY4CwYtZT51Nh0/eLfjx8y9SYnR/iahkGAS2Rpgi?= =?us-ascii?q?siXTYw0KQ39UxwzlKeze5ymfVeGdh76PZZFAE3KciP4fZ9DoXUWwnGel6Sf3Gk?= =?us-ascii?q?T9mvNhu9VJplxd4FZEJ0AJOljB3P1mygCqU9k7GbBZI1tKnb2i6idI5G13/a2f?= =?us-ascii?q?x53BEdScxVODjj2/dy?= X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0AaCwAL13lYhyLMOLldGgEBAQECAQEBA?= =?us-ascii?q?QgBAQEBFgEBAQMBAQEJAQEBgw4BAQEBAX6BCQeOQ4ZCimEPgieSdoIMKoV4AoI?= =?us-ascii?q?RSBYBAQEBAQEBAQEBARIBAQEKCwkKHTCCMxuCHAEEASNLCwULCwQHGh0CAiISA?= =?us-ascii?q?QUBChIGEwgKiFYDEAgEAQmkBD+MA4IlhzoDglYBAQEHAQEBAQEBIossglCEfoJ?= =?us-ascii?q?eBYckDI1/hguGXYsCgkiOJUiQXRQegRICDxcLgWpPFAWDZkmBa3IBiGUBAQE?= X-IPAS-Result: =?us-ascii?q?A0AaCwAL13lYhyLMOLldGgEBAQECAQEBAQgBAQEBFgEBAQM?= =?us-ascii?q?BAQEJAQEBgw4BAQEBAX6BCQeOQ4ZCimEPgieSdoIMKoV4AoIRSBYBAQEBAQEBA?= =?us-ascii?q?QEBARIBAQEKCwkKHTCCMxuCHAEEASNLCwULCwQHGh0CAiISAQUBChIGEwgKiFY?= =?us-ascii?q?DEAgEAQmkBD+MA4IlhzoDglYBAQEHAQEBAQEBIossglCEfoJeBYckDI1/hguGX?= =?us-ascii?q?YsCgkiOJUiQXRQegRICDxcLgWpPFAWDZkmBa3IBiGUBAQE?= X-IronPort-AV: E=Sophos;i="5.33,226,1477954800"; d="scan'208,217";a="209115310" Received: from vrout10-bl.yaziba.net (HELO vrout10.yaziba.net) ([185.56.204.34]) by mail3-smtp-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 14 Jan 2017 08:49:50 +0100 Received: from mtaout10.int.yaziba.net (mtaout10.int.yaziba.net [10.4.20.36]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by vrout10.yaziba.net (mx10.yaziba.net) with ESMTPS id C95AD5255B for ; Sat, 14 Jan 2017 08:49:49 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by mtaout10.int.yaziba.net (Postfix) with ESMTP id C08A7160145 for ; Sat, 14 Jan 2017 08:49:49 +0100 (CET) X-Virus-Scanned: amavisd-new at Received: from mtaout10.int.yaziba.net ([127.0.0.1]) by localhost (mtaout10.int.yaziba.net [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id uVzxOgBBwfOT for ; Sat, 14 Jan 2017 08:49:49 +0100 (CET) Received: from mail-qk0-f174.google.com (mail-qk0-f174.google.com [209.85.220.174]) by mtaout10.int.yaziba.net (Postfix) with ESMTPSA id 79A701600D4 for ; Sat, 14 Jan 2017 08:49:49 +0100 (CET) Received: by mail-qk0-f174.google.com with SMTP id a20so76633036qkc.1 for ; Fri, 13 Jan 2017 23:49:49 -0800 (PST) X-Gm-Message-State: AIkVDXJApRFps1x1a6eqgETBXo7oVJTngsG0ACf2as0JPdLRgI2WQMJqf0ocp8dQQeUv2FCUB8YekozLoXkpZA== X-Received: by 10.55.185.130 with SMTP id j124mr22871717qkf.173.1484380188478; Fri, 13 Jan 2017 23:49:48 -0800 (PST) MIME-Version: 1.0 Received: by 10.200.57.166 with HTTP; Fri, 13 Jan 2017 23:49:27 -0800 (PST) In-Reply-To: <91217907-3b9e-9977-79cc-fc29fe7a290d@gmx.net> References: <91217907-3b9e-9977-79cc-fc29fe7a290d@gmx.net> From: =?UTF-8?Q?Nicol=C3=A1s_Ojeda_B=C3=A4r?= Date: Sat, 14 Jan 2017 08:49:27 +0100 X-Gmail-Original-Message-ID: Message-ID: To: Helmut Brandl Cc: Caml List Content-Type: multipart/alternative; boundary=94eb2c04379cd8a0c80546093149 X-VRSPAM-SCORE: 0 X-VRSPAM-STATE: legit X-VRSPAM-CAUSE: Subject: Re: [Caml-list] Beginners Question for js_of_ocaml --94eb2c04379cd8a0c80546093149 Content-Type: text/plain; charset=UTF-8 Hi Helmut, I am a js_of_ocaml beginner, but it sounds like you could do it using : Js.Unsafe.fun_call (Js.Unsafe.js_expr "readdirSync") [| .. args , wrapped with Js.Unsafe.inject .. |] You can look at the docs at https://ocsigen.org/js_of_ocaml/2.8.3/manual/bindings, especially under "Binding a JS function", where there is an example with the function "decodeURI". Cheers! Best wishes, Nicolas On Sat, Jan 14, 2017 at 12:58 AM, Helmut Brandl wrote: > Hello List, > > I am trying to use js_of_ocaml to compile my ocaml project for the nodejs > ecosystem. Since js_of_ocaml does not compile calls to the 'unix' library I > have to call some javascript functions directly from ocaml. All I need is > to be able to call the javascript functions > > - readdirSync > - mkdirSync > - rmdirSync > - statSync > > and receive the results in ocaml. > > I have looked into the documentation and into the examples, but I have not > found a way on how to do this. All examples are for use in the browser. > Maybe its a stupid question and it is so simple that I, as a beginner in > js_of_ocaml, just don't see it. > > Can anybody give me a hint? Thanks in advance. > > Regards > Helmut > > > -- > Caml-list mailing list. Subscription management and archives: > https://sympa.inria.fr/sympa/arc/caml-list > Beginner's list: http://groups.yahoo.com/group/ocaml_beginners > Bug reports: http://caml.inria.fr/bin/caml-bugs > --94eb2c04379cd8a0c80546093149 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi Helmut,

I am a js_of_ocaml beginner,= but it sounds like you could do it using :

=C2=A0= Js.Unsafe.fun_call (Js.Unsafe.js_expr "readdirSync") [| .. args = , wrapped with Js.Unsafe.inject .. |]

You can look= at the docs at https://ocsigen.org/js_of_ocaml/2.8.3/manual/bindings, especiall= y under
"Binding a JS function", where there is an exam= ple with the function "decodeURI".

Cheer= s!

Best wishes,
Nicolas





On Sat, Jan 14, 2017 at 12:58 AM, Hel= mut Brandl <helmut.brandl@gmx.net> wrote:
Hello List,

I am trying to use js_of_ocaml to compile my ocaml project for the nodejs e= cosystem. Since js_of_ocaml does not compile calls to the 'unix' li= brary I have to call some javascript functions directly from ocaml. All I n= eed is to be able to call the javascript functions

- readdirSync
- mkdirSync
- rmdirSync
- statSync

and receive the results in ocaml.

I have looked into the documentation and into the examples, but I have not = found a way on how to do this. All examples are for use in the browser. May= be its a stupid question and it is so simple that I, as a beginner in js_of= _ocaml, just don't see it.

Can anybody give me a hint? Thanks in advance.

Regards
Helmut


--
Caml-list mailing list.=C2=A0 Subscription management and archives:
https://sympa.inria.fr/sympa/arc/caml-list
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
Bug reports: http://caml.inria.fr/bin/caml-bugs

--94eb2c04379cd8a0c80546093149--