switch to blobs from arraybuffers
Some checks failed
Build and Deploy / build-linux (push) Failing after 1m29s
Build and Deploy / build-macos (push) Failing after 7s
Build and Deploy / build-windows (CLANG64) (push) Has been cancelled
Build and Deploy / package-dist (push) Has been cancelled
Build and Deploy / deploy-itch (push) Has been cancelled
Build and Deploy / deploy-gitea (push) Has been cancelled

This commit is contained in:
2025-05-28 22:33:32 -05:00
parent 53b3f0af9c
commit e86bdf52fe
24 changed files with 287 additions and 433 deletions

View File

@@ -12,6 +12,7 @@
#include <errno.h>
#include <stdio.h>
#include "wildmatch.h"
#include "prosperon.h"
// File descriptor wrapper structure
typedef struct {
@@ -69,7 +70,7 @@ static ssize_t js_fd_write_helper(JSContext *js, int fd, JSValue val)
wrote = write(fd, data, len);
JS_FreeCString(js, data);
} else {
unsigned char *data = JS_GetArrayBuffer(js, &len, val);
unsigned char *data = js_get_blob_data(js, &len, val);
wrote = write(fd, data, len);
}
return wrote;
@@ -200,7 +201,7 @@ JSC_SCALL(fd_slurpbytes,
goto END;
}
ret = JS_NewArrayBufferCopy(js, data, st.st_size);
ret = js_new_blob_stoned_copy(js, data, st.st_size);
free(data);
END:
@@ -408,7 +409,7 @@ JSC_CCALL(file_read,
return JS_ThrowReferenceError(js, "read failed: %s", strerror(errno));
}
ret = JS_NewArrayBufferCopy(js, buf, bytes_read);
ret = js_new_blob_stoned_copy(js, buf, bytes_read);
free(buf);
return ret;
)