You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+33
Original file line number
Diff line number
Diff line change
@@ -39,4 +39,37 @@ Before running the tests make sure you are serving the app via `ng serve`.
39
39
40
40
To get more help on the Angular CLI use `ng help` or go check out the [Angular CLI README](https://github.com/angular/angular-cli/blob/master/README.md).
41
41
42
+
## Add support for file system ([no official support](https://github.com/angular/angular-cli/issues/4227)):
43
+
44
+
Create a file called `native.js` in the `src` folder and insert the following:
45
+
46
+
```js
47
+
window.fs=require('fs');
48
+
```
49
+
50
+
Add this file to the `.angular-cli.json` scripts array:
51
+
52
+
```json
53
+
"scripts": [
54
+
"native.js"
55
+
],
56
+
```
57
+
58
+
Add the following lines to `polyfills.ts`:
59
+
60
+
```ts
61
+
declareglobal {
62
+
interfaceWindow {
63
+
fs:any;
64
+
}
65
+
}
66
+
```
67
+
68
+
After that you can access the filesystem with:
69
+
70
+
```ts
71
+
window.fs.writeFileSync('sample.txt', 'my data');
72
+
```
73
+
74
+
See this [pull request](https://github.com/PKief/angular-cli-electron/pull/1/files) to follow the changes.
0 commit comments