neutralinojs / neutralino.js

JavaScript API for Neutralinojs
https://neutralino.js.org/docs/api/overview
MIT License
237 stars 47 forks source link

`appendBinaryFile()` should not accept data which is not binary #113

Open Sadaf-A opened 3 months ago

Sadaf-A commented 3 months ago

currently appendBinaryFile() accepts data even if it is not binary. It should only accept binary data

godspeed-03 commented 3 months ago

Since JavaScript (the language TypeScript compiles down to) is dynamically typed, there's no runtime check to ensure the argument matches the specified type. In this case : appendBinaryFile(path: string, data: ArrayBuffer), here the type of data parameter is ArrayBuffer even if accept data which is not binary perhaps because the code isn't type-checked by TypeScript at runtime. @Sadaf-A if this if the case then if can be fixed with instace check which will check the type of data at runtime.

Looking forward to dicuss it with you :smile: