Re-enabled stubs for PNG analyser and ICO maker, Implemented Data utils, file utils and PNG parser, Still testing

Update png-analyser.yml, png-chunk-analyser.yml, and 17 more files...
This commit is contained in:
2025-04-03 21:55:09 +02:00
parent 92d7b245a2
commit df93ee47b2
16 changed files with 519 additions and 184 deletions

View File

@@ -0,0 +1,28 @@
/**
* Reads a file and returns its content as a string.
* @param {File} file - The file to read.
* @returns {Promise<string>} A promise that resolves with the file content as a string.
*/
export function loadFileAsText(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = () => resolve(reader.result);
reader.onerror = reject;
reader.readAsText(file);
});
}
/**
* Reads a file and returns its content as a `Uint8Array`.
* @param {File} file - The file to read.
* @returns {Promise<Uint8Array>} A promise that resolves with the file content as a byte buffer.
*/
export function loadFileAsUint8Array(file) {
return new Promise((resolve, reject) => {
const reader = new FileReader();
reader.onload = () => resolve(new Uint8Array(reader.result));
reader.onerror = reject;
reader.readAsArrayBuffer(file);
});
}