Skip to content

Commit 2a6ced3

Browse files
committed
update
1 parent cdd6f55 commit 2a6ced3

File tree

2 files changed

+8
-12
lines changed

2 files changed

+8
-12
lines changed

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ arrays, designed for use in parallel computing.
1111
- Supports creating n-dimensional Zarr arrays and chunking them along any dimension.
1212
- Compresses chunks using a variety of supported compression codecs.
1313
- Supports indexing operations to read/write views of a Zarr array.
14-
- Supports storing arrays in-memory or the local filesystem. It is also
15-
extensible, allowing users to easily create and use their own custom storage
16-
backends. See the example implementing a [Zip file store][9] for more details.
14+
- Supports many storage backends, including in-memory store, the local filesystem,
15+
Amazon S3 and others. It is also extensible, allowing users to easily create and
16+
use their own custom storage backends. See the example implementing a
17+
[Zip archive store][9] for more details.
1718
- Supports both synchronous and asynchronous I/O via [Lwt][4] and [Eio][8]. The user can
1819
easily use their own scheduler of choice. See the [example][10] implementing
1920
a filesystem store that uses the [Picos][11] concurrency library for non-blocking I/O.

zarr-sync/test/test_sync.ml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -251,23 +251,18 @@ module Dir_http_server = struct
251251
S.Response.make_raw ~headers ~code:200 s
252252
);
253253
(* POST request handler *)
254-
S.add_route_handler_stream server ~meth:`POST S.Route.rest_of_path_urlencoded (fun path req ->
255-
let write oc =
256-
let max_size = 1024 * 10 * 1024 in
257-
let req' = S.Request.limit_body_size ~bytes:(Bytes.create 4096) ~max_size req in
258-
S.IO.Input.iter (Out_channel.output oc) req'.body;
259-
Out_channel.flush oc
260-
in
254+
S.add_route_handler server ~meth:`POST S.Route.rest_of_path_urlencoded (fun path req ->
255+
let write oc = Out_channel.(output_string oc req.S.Request.body; flush oc) in
261256
let fspath = Filename.concat dir path in
262257
Zarr.Util.create_parent_dir fspath 0o700;
263258
let f = [Open_wronly; Open_trunc; Open_creat] in
264259
match Out_channel.(with_open_gen f 0o700 fspath write) with
265-
| exception Sys_error e -> S.Response.make_raw ~code:500 e
260+
| exception Sys_error e -> S.Response.fail ~code:500 "Upload error: %s" e
266261
| () ->
267262
let opt = List.assoc_opt "content-type" req.headers in
268263
let content_type = Option.fold ~none:"application/octet-stream" ~some:Fun.id opt in
269264
let headers = [("content-type", content_type); ("Connection", "close")] in
270-
S.Response.make_raw ~headers ~code:201 (Printf.sprintf "%s created" path)
265+
S.Response.make_string ~headers (Ok (Printf.sprintf "%s created" path))
271266
);
272267
(* DELETE request handler *)
273268
S.add_route_handler server ~meth:`DELETE S.Route.rest_of_path_urlencoded (fun path _ ->

0 commit comments

Comments
 (0)