Ask questionsFile.writeSync(buf) - does not write buffer more than 16384 bytes

When a buffer is writting to a file synchronously, a buffer larger than 16384 is truncated without warning and is not written to the file!

deno 0.32.0 v8 8.1.108 typescript 3.7.2

Code Example: `const buf_size = 40960 //4096 - standard value //16384 - max allowed value !!! const buf = new Uint8Array(buf_size) buf.fill(0x31)

const fn = './deno_file_write_bug.txt' const f = Deno.openSync(fn, 'w') f.writeSync(buf) f.close()

const fi = Deno.lstatSync(fn) console.log(fi.len === buf_size ? true : fi.len)`


Answer questions ry

oops I thought this was about writeFileSync... You're right @afinch7.

@balajahe - write is a low-level I/O call and it does not guarantee the whole buffer will be written. Have a look at Deno.writeAllSync()


Related questions

{WSL 2} Permission denied (os error 13) hot 1
gRPC in Deno? hot 1
deno remove/uninstall subcommand hot 1
Insight required: Resource (TCP) errors hot 1
TCP accept loop doesn't use for-await hot 1
Support d.ts files hot 1
Restore runtime lib generation capability hot 1
disable flaky tests _048_media_types_jsx and _019_media_types hot 1
Typescript Custom Transformers Support hot 1
reorg directory structure hot 1
Centos 7 GLIBC_2.18 not found hot 1
"deno ast script.ts" hot 1
Text decoding performance abysmally slow. hot 1
"deno ast script.ts" hot 1
Can't build master hot 1
Github User Rank List