Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit ac74412

Browse files
committed
better readme
1 parent a82673a commit ac74412

File tree

1 file changed

+38
-9
lines changed

1 file changed

+38
-9
lines changed

README.md

Lines changed: 38 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# FileSystem.js
2-
FileSystem.js is a Promise-based wrapper library for the HTML5 FileSystem API. It smooths over the rough edges of the existing API and makes it simple to reason about its inherent asynchronicity. It uses native Promises since these have finally arrived in the stable version of Chrome.
2+
FileSystem.js is a Promise-based wrapper library for the HTML5 FileSystem API. It smooths over the rough edges of the existing (FileSystem)[http://dev.w3.org/2009/dap/file-system/pub/FileSystem/] and (File)[http://dev.w3.org/2006/webapi/FileAPI/] APIs and makes it simple to reason about its inherent asynchronicity. It uses native Promises since these have finally arrived in the stable version of Chrome.
33

44
## Supported Browsers
55
- Chrome
@@ -14,34 +14,45 @@ By default, the minimum size (in bytes) will be 5Mb and the type will be persist
1414
If you want to catch errors on the new filesystem object, it can be done as follows:
1515
`fs.catch(onerrorfunction)`
1616

17-
## Examples
18-
### Getting the root directory
17+
### Examples
18+
#### Getting the root directory
19+
```javascript
1920
fs.getRoot().then(function(root) {
2021
// do something with the root directory
2122
})
22-
### Loading a url
23+
```
24+
#### Loading a filesystem url
25+
```javascript
2326
fs.getURL('[path]').then(function(entry) {
2427
// do something with the directory or file
2528
})
26-
### Creating a directory
29+
```
30+
#### Creating a directory
31+
```javascript
2732
fs.getRoot().then(function(root) {
2833
root.makeDirectory('somedir');
2934
}).then(function(directory) {
3035
// do something with the created directory
3136
})
32-
### Creating a file entry and writing to it in a directory
37+
```
38+
#### Creating a file entry and writing to it in a directory
39+
```javascript
3340
fs.getURL('/somedir').then(function(directory) {
3441
return directory.makeFileEntry('somefile.txt');
3542
}).then(function(fileEntry) {
3643
fileEntry.write(new Blob(['who are you?'],{ type: 'text/plaintext' }));
3744
})
38-
### Read all the files in a directory
45+
```
46+
#### Read all the files in a directory
47+
```javascript
3948
fs.getRoot().then(function(root) {
4049
return root.readEntries();
4150
}).then(function(entries) {
4251
// do something with the entries which have just been read
4352
})
44-
### Read all of the ArrayBuffers for entries in a directory
53+
```
54+
#### Read all of the ArrayBuffers for entries in a directory
55+
```javascript
4556
fs.getRoot().then(function(root) {
4657
return root.readEntries();
4758
}).then(function(entries) {
@@ -54,4 +65,22 @@ If you want to catch errors on the new filesystem object, it can be done as foll
5465
return Promise.all(promises);
5566
}).then(function(buffers) {
5667
// do something with the array buffers
57-
})
68+
})
69+
```
70+
71+
## API
72+
### FileSystem
73+
- new FileSystem(minimumSize, type)
74+
- A promise-like object that wraps the local file system.
75+
- **Parameters**:
76+
- **minimumSize** - size in bytes for the browser file system
77+
- **type** - either persistent(window.PERSISTENT == 1) or temporary(window.TEMPORARY == 0)
78+
79+
## License MIT
80+
Copyright (c) 2014 Kirill Klimuk
81+
82+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
83+
84+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
85+
86+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 commit comments

Comments
 (0)