mirror of
https://github.com/denoland/deno.git
synced 2025-07-31 00:54:18 +00:00
feat(unstable): Add file locking APIs (#11746)
This commit adds following unstable APIs: - Deno.flock() - Deno.flockSync() - Deno.funlock() - Deno.funlockSync()
This commit is contained in:
parent
46e4ba38b2
commit
93d83a84db
7 changed files with 283 additions and 0 deletions
|
@ -385,6 +385,22 @@
|
|||
await core.opAsync("op_fsync_async", rid);
|
||||
}
|
||||
|
||||
function flockSync(rid, exclusive) {
|
||||
core.opSync("op_flock_sync", rid, exclusive === true);
|
||||
}
|
||||
|
||||
async function flock(rid, exclusive) {
|
||||
await core.opAsync("op_flock_async", rid, exclusive === true);
|
||||
}
|
||||
|
||||
function funlockSync(rid) {
|
||||
core.opSync("op_funlock_sync", rid);
|
||||
}
|
||||
|
||||
async function funlock(rid) {
|
||||
await core.opAsync("op_funlock_async", rid);
|
||||
}
|
||||
|
||||
window.__bootstrap.fs = {
|
||||
cwd,
|
||||
chdir,
|
||||
|
@ -433,5 +449,9 @@
|
|||
fdatasyncSync,
|
||||
fsync,
|
||||
fsyncSync,
|
||||
flock,
|
||||
flockSync,
|
||||
funlock,
|
||||
funlockSync,
|
||||
};
|
||||
})(this);
|
||||
|
|
|
@ -136,5 +136,9 @@
|
|||
createHttpClient: __bootstrap.fetch.createHttpClient,
|
||||
http: __bootstrap.http,
|
||||
dlopen: __bootstrap.ffi.dlopen,
|
||||
flock: __bootstrap.fs.flock,
|
||||
flockSync: __bootstrap.fs.flockSync,
|
||||
funlock: __bootstrap.fs.funlock,
|
||||
funlockSync: __bootstrap.fs.funlockSync,
|
||||
};
|
||||
})(this);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue