-
Notifications
You must be signed in to change notification settings - Fork 3.5k
Open
Labels
Description
The following program works find under node and bun:
import { openSync, closeSync, constants } from "node:fs";
// Create or open a file for writing, creates if it doesn't exist
const fd = openSync("./log.txt", constants.O_WRONLY | constants.O_CREAT);
// ... operations
closeSync(fd);
But not under deno:
$ ~/.deno/bin/deno -A test.mjs
error: Uncaught (in promise) TypeError: creating or truncating a file requires write or append access
const fd = openSync("missing.txt", constants.O_RDONLY | constants.O_CREAT);
^
at openSync (ext:deno_node/_fs/_fs_open.ts:43:12)
at file:///usr/local/google/home/sbc/dev/wasm/emscripten/test.mjs:3:12
The C equivalent also seem to work fine, so I think maybe deno is wrong here?
#include <stdio.h>
#include <fcntl.h>
#include <sys/stat.h>
int main() {
int fd = open("missing.txt", O_RDONLY|O_CREAT, 0x777);
printf("%d\n", fd);
return 0;
}
Reactions are currently unavailable