zen-fs / dom

DOM backends for ZenFS
https://zen-fs.github.io/dom/
MIT License
11 stars 2 forks source link

WebAccess to OPFS throws TypeError on write #12

Closed atty303 closed 3 months ago

atty303 commented 4 months ago

The errors are as follows

Failed to execute 'write' on 'FileSystemWritableFileStream': The provided ArrayBufferView value must not be resizable.

This is where the resizable ArrayBufferView comes from.

https://github.com/zen-fs/core/blob/main/src/file.ts#L558

const newBuffer = new Uint8Array(new ArrayBuffer(endFp, { maxByteLength: size_max }));

I think there should be a flag in the constructor of PreloadFile to indicate whether resizable buffers should be used. Or maybe the only way to do writeFile with WebAccessFS is to copy the buffer?

james-pre commented 4 months ago

I think this is a good use for FileSystem.metadata.

james-pre commented 4 months ago

Sorry for the repeated "added a commit to zen-fs/core that referenced this issue", I messed up the commit message =[

james-pre commented 4 months ago

@atty303 Does 0.2.10 fix the issue?

atty303 commented 4 months ago

I will wait for ZipFS to update this one as well. (https://github.com/zen-fs/core/issues/64)

james-pre commented 4 months ago

As I mentioned in zen-fs/core#64, I had not released the Zip updates yet. @zenfs/zip v0.4.0 should be up to date.

atty303 commented 3 months ago

I can confirm that this problem has been fixed.