package lsp
Install
Dune Dependency
Authors
-
AAndrey Popp <8mayday@gmail.com>
-
RRusty Key <iam@stfoo.ru>
-
LLouis Roché <louis@louisroche.net>
-
OOleksiy Golovko <alexei.golovko@gmail.com>
-
RRudi Grinberg <me@rgrinberg.com>
-
SSacha Ayoun <sachaayoun@gmail.com>
-
Ccannorin <cannorin@gmail.com>
-
UUlugbek Abdullaev <ulugbekna@gmail.com>
-
Thibaut Mattio
-
MMax Lantas <mnxndev@outlook.com>
Maintainers
Sources
sha256=7046491eb9d0417d23d2a0ce39f9bc3bb9b75521453106f723c8e5f18c2584a9
sha512=591fcf1fd2308b56ca2b5f60383d9a24e59aea49bf0dfe4f3b3e1d3a44f0537be07c650523e7f229122c7914fca78bccaafd01c5f79793e38617959f1bcfc7e1
doc/lsp.stdune/Stdune/Temp/index.html
Module Stdune.Temp
Source
Temporary file management
This module provides a high-level interface for temporary files. It ensures that all temporary files created by the application are systematically cleaned up on exit.
val temp_in_dir :
?perms:int ->
what ->
dir:Path.t ->
prefix:string ->
suffix:string ->
Path.t
Create a temporary file or directory inside an existing directory.
Delete the contents of a temporary directory without deleting the directory itself.
temp_file ~dir ~prefix ~suffix
creates a temporary file in dir
. The base name of the file is prefix_num_suffix
, where num
is a random integer number. Note that the file must be created to reserve the name in dir
and prevent other processes from taking it concurrently. If you need a temporary file that does not exist on disk, you can create a temporary directory and safely use any file name there.
val with_temp_file :
dir:Path.t ->
prefix:string ->
suffix:string ->
f:(Path.t Or_exn.t -> 'a) ->
'a
Like temp_file
, but passes the temporary file to the callback f
, and makes sure the temporary file is deleted when f
completes. If f
raises an exception, the exception is re-raised (and the file is still deleted).