No browser.js file in /dist folder
Hi, I just tried 1.0.6 and according to the docs there should be a module in node_modules/magic-bytes.js/dist/browser.js but there isn't. Has this changed and you forgot to update the docs or is something else wrong here?
Yes, I deleted it when refactoring to typescript.
Previously I used webpack to bundle the whole library into a single file. I dropped the whole build system because nowadays I think it's something that's more up to the user using the library on how to bundle the modules.
Yes, I deleted it when refactoring to typescript.
Previously I used webpack to bundle the whole library into a single file. I dropped the whole build system because nowadays I think it's something that's more up to the user using the library on how to bundle the modules.
So the documentation for html is outdated.
// import magic-bytes.js
import { filetypename } from 'magic-bytes.js';
// add an event listener to the file input
document.getElementById("file").addEventListener('change', (event, x) => {
const fileReader = new FileReader();
fileReader.onloadend = (f) => {
// convert the file to a Uint8Array
const bytes = new Uint8Array(f.target.result);
// console.log the file type
console.log("Possible filetypes: " + filetypename(bytes))
}
fileReader.readAsArrayBuffer(event.target.files[0])
})
I've updated the readme to reflect a new npm goal npm run example which runs the example