ERROR TypeError: file_system__WEBPACK_IMPORTED_MODULE_3__.readFileSync is not a function arg1:TypeError: file_system__WEBPACK_IMPORTED_MODULE_3__.readFileSync is not a function {stack: 'TypeError: file_system__WEBPACK_IMPORTED_MODU…(https://localhost:4200/polyfills.js:9764:30)', message: 'file_system__WEBPACK_IMPORTED_MODULE_3__.readFileSync is not a function'} message:'file_system__WEBPACK_IMPORTED_MODULE_3__.readFileSync is not a function'
When trying to load a ca certificate in Angular 11:
import * as fs from 'file-system';
const httpOptions =
{
headers: new HttpHeaders({'Content-Type': 'application/json'}),
ca: [fs.readFileSync(['cert.pem', 'key.pem'])],
rejectUnauthorized: false
};
The intention is to solve DEPTH_ZERO_SELF_SIGNED_CERT. A browser is supposed not be allowed to access local file system for security reason, but this ca Option
sounds like feasible.