2016-12-01 21:27:53 +04:00
|
|
|
(**************************************************************************)
|
|
|
|
(* *)
|
|
|
|
(* Copyright (c) 2014 - 2016. *)
|
|
|
|
(* Dynamic Ledger Solutions, Inc. <contact@tezos.com> *)
|
|
|
|
(* *)
|
|
|
|
(* All rights reserved. No warranty, explicit or implicit, provided. *)
|
|
|
|
(* *)
|
|
|
|
(**************************************************************************)
|
|
|
|
|
2017-01-23 14:09:45 +04:00
|
|
|
open Error_monad
|
|
|
|
|
2016-12-01 21:27:53 +04:00
|
|
|
(** Read a JSON document from a string. *)
|
|
|
|
val from_string : string -> (Data_encoding.json, string) result
|
|
|
|
|
|
|
|
(** Read a stream of JSON documents from a stream of strings.
|
|
|
|
A single JSON document may be represented in multiple consecutive
|
|
|
|
strings. But only the first document of a string is considered. *)
|
|
|
|
val from_stream : string Lwt_stream.t -> (Data_encoding.json, string) result Lwt_stream.t
|
|
|
|
|
|
|
|
(** Write a JSON document to a string. This goes via an intermediate
|
|
|
|
buffer and so may be slow on large documents. *)
|
|
|
|
val to_string : Data_encoding.json -> string
|
|
|
|
|
|
|
|
(** Loads a JSON file in memory *)
|
2017-01-23 14:09:45 +04:00
|
|
|
val read_file : string -> Data_encoding.json tzresult Lwt.t
|
2016-12-01 21:27:53 +04:00
|
|
|
|
|
|
|
(** (Over)write a JSON file from in memory data *)
|
2017-01-23 14:09:45 +04:00
|
|
|
val write_file : string -> Data_encoding.json -> unit tzresult Lwt.t
|