Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 14b739a

Browse files
committedSep 4, 2017
updated readme related to #1
1 parent 9a756e0 commit 14b739a

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed
 

‎README.md

+33
Original file line numberDiff line numberDiff line change
@@ -39,4 +39,37 @@ Before running the tests make sure you are serving the app via `ng serve`.
3939

4040
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).
4141

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+
declare global {
62+
interface Window {
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.
4275

0 commit comments

Comments
 (0)
Please sign in to comment.